You should be able to use external binary format with the GIFTI toolbox as well.

Peace,

Matt.

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Estrid Jakobsen 
<[email protected]<mailto:[email protected]>>
Date: Friday, March 17, 2017 at 10:26 AM
To: Timothy Coalson <[email protected]<mailto:[email protected]>>
Cc: Estrid Jakobsen <[email protected]<mailto:[email protected]>>, 
"[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [HCP-Users] extracting hemispheres from dconn files

Hi,

Both the gifti toolbox and ciftiopen run into memory problems when loading such 
large files, even with 128GB of RAM available, which is why I have previously 
used fread to load "external binary gifti" files created with -cifti-convert 
(which seems to work correctly).
I will try using -cifti-restrict-dense-map to create the 29k matrices and then 
manually insert the medial wall mask in matlab. I want to visualize maps using 
SurfStat, so the extra zeros are necessary.

Thanks again,

Estrid

On Tue, Mar 14, 2017 at 11:23 PM, Timothy Coalson 
<[email protected]<mailto:[email protected]>> wrote:
1) No, a simple fread cannot correctly read any of our usual data file formats 
(the -to-gifti-ext conversion is not a "usual" data format, see #4) - they have 
headers on them, some of them are gzip compressed, and gifti is not a binary 
format anyway (it is XML, which in unusual circumstances can make use of a 
secondary binary file).  There is matlab code available specifically for the 
task of correctly reading in cifti and gifti data:

https://wiki.humanconnectome.org/display/PublicData/HCP+Users+FAQ#HCPUsersFAQ-2.HowdoyougetCIFTIfilesintoMATLAB?

The gifti toolbox it mentions is the recommended way to read gifti files into 
matlab.  Behind the scenes, ciftiopen and ciftisave use -cifti-convert, and 
then the gifti toolbox, to prevent any guessing and data scrambling on your 
part.

2) No, -cifti-restrict-dense-map will not expand the file to add the medial 
wall indices with zeroes.  What are you wanting to do with it that you need 
these extra zeroes in the matrix?  This can be done with 
-cifti-create-dense-from-template, but first you'll need to make a template 32k 
cifti file (only needs 1 map, not an entire square) with 
-cifti-create-dense-scalar or similar.

3) No, .surf.gii files cannot be used as ROIs, they are surface geometry 
(coordinate) files.  You can use the standard grayordinate space ROIs (in the 
pipelines repository, global/templates/91282_Greyordinates/*.shape.gii) or just 
make some all-1s metric files (.func.gii) with -metric-math, the result of 
-cifti-restrict-dense-map will be 29k with either (as long as you don't cross 
your hemispheres).

4) -cifti-convert does not create metric files (metric files are single 
surface, all vertices).  It abuses whichever output format is chosen in order 
to stuff the entire cifti matrix into it, to allow for tricks for exchanging 
cifti data with other tools that don't have cifti support.

Tim


On Tue, Mar 14, 2017 at 11:31 AM, Estrid Jakobsen 
<[email protected]<mailto:[email protected]>> wrote:
Hi Tim,

Thanks for your reply. I see my mistake was in assuming the output from 
cifti-separate would be 32k x 32k and loading it in to matlab as such, using 
fread(fid,[32492 32492], 'float32'). Since the file is actually 32k x 91k it's 
no wonder the vertices aren't correct.

Is it possible to get to the 32k x 32k matrices using -cifti-restrict-dense-map 
(instead of 29k x 29k) and if so, can you advise how? Can I simply use a 
surf.gii file as -left-roi and -right-roi?

Presumably I can follow this with -cifti-convert -to-gifti-ext to convert from 
dconn to metric and then load the matrix into matlab using fread as before?

Thanks again!

Estrid

On Mon, Mar 13, 2017 at 7:51 PM, Timothy Coalson 
<[email protected]<mailto:[email protected]>> wrote:
That command should do what you intended, though it will give you two 32k x 91k 
files, not 32k x 32k.  Another possibility for doing this (which can also get 
you to the single-hemisphere 29k x 29k cifti file by running it twice) is 
-cifti-restrict-dense-map, which is also far less painful to load the results 
into wb_view, as it remains a dconn file (data loaded on demand, not in 
advance, knows not to show it as 91k maps in a combobox).

I ran the exact command you quoted on the same file downloaded from 
ConnectomeDB, using workbench v1.1.1 linux64 (debian/ubuntu) as previously 
released on our website, and the resulting files I got look nothing like your 
capture (I am trying it again with v1.2.3 now, but it takes a while to run 
things on files this large - very little has changed in this command, so I 
expect the same result).  Did you do anything after the -cifti-separate that 
you didn't mention?  Which map(s) in the output file did you check?  What 
version of workbench and OS did you run it on, and how much memory did the 
machine have?

Tim


On Mon, Mar 13, 2017 at 10:13 AM, Estrid Jakobsen 
<[email protected]<mailto:[email protected]>> wrote:
Hi folks,

I have a question regarding extracting the left and right hemispheres from 
.dconn cifti files. I've tried using wb_command -cifti-separate on the 
820-subject group average dense connectome (see command below), but when I then 
visualize a connectivity vector from the resulting 32k x 32k matrix, the 
vertices appear to be scrambled (see attached image). I'm guessing this might 
have something to do with the command not being intended for separating 
symmetrical matrices and perhaps only extracting correctly along one 
dimension...?

Is there a way to extract the left and right 32k matrices from the dense 
connectome, or would I have to go back and create them myself from the PCA 
Eigenmaps?

Thanks in advance!

Estrid

wb_command -cifti-separate 
HCP_S900_820_rfMRI_MSMAll_groupPCA_d4500ROW_zcorr.dconn.nii ROW -metric 
CORTEX_RIGHT HCP_S900_820_rfMRI_MSMAll_groupPCA_d4500ROW_zcorr_RIGHT.func.gii 
-metric CORTEX_LEFT 
HCP_S900_820_rfMRI_MSMAll_groupPCA_d4500ROW_zcorr_LEFT.func.gii


****************
Estrid Jakobsen

Postdoctoral Fellow
Cognitive Neurosciences
Montreal Neurological Institute and Hospital, McGill University

Max Planck Research Group Neuroanatomy and Connectivity
Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig

_______________________________________________
HCP-Users mailing list
[email protected]<mailto:[email protected]>
http://lists.humanconnectome.org/mailman/listinfo/hcp-users




--
****************
Estrid Jakobsen

Postdoctoral Fellow
Cognitive Neurosciences
Montreal Neurological Institute and Hospital, McGill University

Max Planck Research Group Neuroanatomy and Connectivity
Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig




--
****************
Estrid Jakobsen

Postdoctoral Fellow
Cognitive Neurosciences
Montreal Neurological Institute and Hospital, McGill University

Max Planck Research Group Neuroanatomy and Connectivity
Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig

_______________________________________________
HCP-Users mailing list
[email protected]<mailto:[email protected]>
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

________________________________
The materials in this message are private and may contain Protected Healthcare 
Information or other information of a sensitive nature. If you are not the 
intended recipient, be advised that any unauthorized use, disclosure, copying 
or the taking of any action in reliance on the contents of this information is 
strictly prohibited. If you have received this email in error, please 
immediately notify the sender via telephone or return mail.

_______________________________________________
HCP-Users mailing list
[email protected]
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to