I think this might be way more complicated than is needed.  I believe there are 
structural extended packages that would allow you to run a FreeSurfer command 
without needing to replicate FreeSurfer files.  As for how to get a 
parcellation from an atlas surface to a subject’s volume, I could tell you how 
to do that using Connectome Workbench tools, file formats, and our atlas, but I 
don’t know the details for FreeSurfer.

Peace,

Matt.

From: Simon Baker <[email protected]<mailto:[email protected]>>
Date: Tuesday, November 10, 2015 at 11:34 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Cc: "Harms, Michael" <[email protected]<mailto:[email protected]>>, Timothy 
Coalson <[email protected]<mailto:[email protected]>>, Matt Glasser 
<[email protected]<mailto:[email protected]>>
Subject: Re: [HCP-Users] Custom parcellation for HCP data

Thanks for the pointers Michael, Tim, and Matt. We've tried a range of 
approaches but we're still having trouble creating the custom parcellation. 
Below describes the updated version of our pipeline. Although this version 
improves the spatial alignment between the custom parcellation and the T1w 
volume, the quality of the parcellation is still lacking compared to e.g. 
ribbon.nii.gz.

--

1. Create a high-resolution annotation (parcellation) by randomly parcellating 
the fsaverage surface into N regions of approximately equal volume.

2. Map the annotation from the source subject (fsaverage) to the target subject 
using mri_surf2surf.

mri_surf2surf --srcsubject fsaverage --hemi xh --sval-annot highres.annot 
--trgsubject ${SUBJECTID} --srcsurfreg sphere.reg --trgsurfreg 
/MNINonLinear/Native/${SUBJECTID}.X.sphere.native.surf.gii --tval 
xh.highres.annot

3. Obtain vertices and faces data from 
/MNINonLinear/Native/${SUBJECTID}.X.white.native.surf.gii

4. Using the vertices and faces data obtained in step 3 as inputs for the 
write_surf Matlab function, create the xh.white surface file.

5. Obtain thickness data from 
/MNINonLinear/Native/${SUBJECTID}.X.thickness.native.shape.gii

6. Using T1wImage = /T1w/T1w_acpc_dc_restore.nii.gz and T1wImageBrain = 
/T1w/T1w_acpc_dc_restore_brain.nii.gz, we replicate some of the steps found in 
HCP's FreeSurferPipeline.sh in order to generate /mri/orig.mgz. Specifically:

#Make Spline Interpolated Downsample to 1mm
Mean=`fslstats T1wImageBrain -M`

flirt -interp spline -in T1wImage -ref T1wImage -applyisoxfm 1 -out T1wImage_1mm

applywarp --rel --interp=spline -i T1wImage -r T1wImage_1mm 
--premat=/usr/local/fsl/etc/flirtsch/ident.mat -o T1wImage_1mm

applywarp --rel --interp=nn -i T1wImageBrain -r T1wImage_1mm 
--premat=/usr/local/fsl/etc/flirtsch/ident.mat -o T1wImageBrain_1mm

fslmaths T1wImage_1mm -div $Mean -mul 150 -abs T1wImage_1mm

mri_convert T1wImage_1mm /mri/orig/001.mgz

#Initial Recon-all Steps
recon-all -subjid ${SUBJECTID} -sd ${SUBJECTS_DIR} -motioncor -talairach 
-nuintensitycor -normalization

7. Convert the custom parcellation annotation into a custom parcellation volume 
using mri_label2vol, with /mri/orig.mgz serving as the output template volume.

mri_label2vol --annot xh.custom.annot --temp /mri/orig.mgz --identity --proj 
frac 0 1 .1 --subject ${SUBJECTID} --hemi xh --o xh_custom_vol.mgz

8. Resample and reslice the custom parcellation volume.

mri_convert --resample_type nearest --reslice_like T1wImage xh_custom_vol.mgz 
xh_custom_vol.nii

9. Combine the resampled and resliced custom parcellation volume from each 
hemisphere to create a single custom parcellation volume (custom_vol.nii).

10. Find c_ras offset and generate matrix

MatrixX=$(mri_info --cras T1wImage | cut -d " " -f 1)
MatrixY=$(mri_info --cras T1wImage | cut -d " " -f 2)
MatrixZ=$(mri_info --cras T1wImage | cut -d " " -f 3)
echo "1 0 0 ""$MatrixX" > c_ras_xfm.mat
echo "0 1 0 ""$MatrixY" >> c_ras_xfm.mat
echo "0 0 1 ""$MatrixZ" >> c_ras_xfm.mat
echo "0 0 0 1" >> c_ras_xfm.mat

11. Invert the c_ras offset matrix

convert_xfm -omat c_ras_xfm_inv.mat -inverse c_ras_xfm.mat

12. Apply the inverted c_ras offset matrix to the custom parcellation volume 
(custom_vol.nii)

flirt -in custom_vol.nii -applyxfm -init c_ras_xfm_inv.mat -out 
parcellation.nii -paddingsize 0.0 -interp nearestneighbour -ref T1wImage

13. [Not sure why, but then we had to] Warp the output from the previous step 
in order to align the parcellation with T1wImage (i.e., 
/T1w/T1w_acpc_dc_restore.nii.gz).

applywarp --rel --interp=nn -i parcellation.nii -r T1wImage -w 
/MNINonLinear/xfms/standard2acpc_dc.nii.gz -o parcellation_native.nii

14. See attached screenshot2.jpeg showing /T1w/T1w_acpc_dc_restore, /T1w/ribbon 
(blue), and parcellation_native (yellow).

--

The alignment of parcellation_native is a bit off and it appears to be 
grainy/pixelated. Do you have any suggestions as to why this is the case?

Kind regards,

Simon Baker
Brain & Mental Health Laboratory
Institute of Cognitive & Clinical Neuroscience
Monash University


On 20 October 2015 at 09:20, Glasser, Matthew 
<[email protected]<mailto:[email protected]>> wrote:
FreeSurfer might do it if you simply specify the correct extension, but if not, 
mris_convert will do the conversion.

Peace,

Matt.

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Timothy Coalson <[email protected]<mailto:[email protected]>>
Date: Monday, October 19, 2015 at 4:44 PM
To: "Harms, Michael" <[email protected]<mailto:[email protected]>>
Cc: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>, Simon 
Baker <[email protected]<mailto:[email protected]>>
Subject: Re: [HCP-Users] Custom parcellation for HCP data

Additionally, if you generate a cortex-only parcellation, you shouldn't need to 
put it into a volume to use it with the HCP CIFTI data.  However, I'm not sure 
how to get freesurfer to write GIFTI label files, and unless you generate it on 
the fs_LR 32k mesh, you'll need to resample it (via registered sphere 
surfaces).  If you can get the label data into matlab, though, you can write it 
as .func.gii files, and use wb_command to turn it into label.gii, and then to 
.dlabel.nii for use with CIFTI data.  Some care may be needed to keep the right 
and left labels separate.

Tim


On Mon, Oct 19, 2015 at 10:08 AM, Harms, Michael 
<[email protected]<mailto:[email protected]>> wrote:

Hi,
Did you see this recent thread on the list:
http://www.mail-archive.com/hcp-users%40humanconnectome.org/msg01910.html

cheers,
-MH

--
Michael Harms, Ph.D.
-----------------------------------------------------------
Conte Center for the Neuroscience of Mental Disorders
Washington University School of Medicine
Department of Psychiatry, Box 8134
660 South Euclid Ave. Tel: 314-747-6173<tel:314-747-6173>
St. Louis, MO  63110 Email: [email protected]<mailto:[email protected]>

From: Simon Baker <[email protected]<mailto:[email protected]>>
Date: Sunday, October 18, 2015 8:16 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [HCP-Users] Custom parcellation for HCP data

Hi all,

We want to create a custom parcellation for use with the connectome project 
data. However, we have not been able to achieve accurate spatial alignment 
between the random parcellation volume and the T1w volume. Specifically, there 
appears to be an "offset," possibly due to a mismatch between the origin of 
these volumes. In the following we describe the relevant steps of our pipeline. 
Please suggest any changes that might help to resolve the issue.

1. Create a high-resolution annotation (parcellation) by randomly parcellating 
the fsaverage surface into N regions of approximately equal volume.

2. Map the annotation from the source subject (fsaverage) to the target subject 
using mri_surf2surf.

mri_surf2surf --srcsubject fsaverage --hemi lh --sval-annot highres.annot 
--trgsubject ${SUBJECTID} --srcsurfreg sphere.reg --trgsurfreg 
${SUBJECTS_DIR}/${SUBJECTID}/MNINonLinear/Native/${SUBJECTID}.L.sphere.native.surf.gii
 --tval lh.highres.annot

[repeat for rh]

3. Obtain vertices and faces data from 
${SUBJECTS_DIR}/${SUBJECTID}/MNINonLinear/Native/${SUBJECTID}.L.white.native.surf.gii

[repeat for rh]

4. Using the vertices and faces data obtained in step 3 as inputs for the 
write_surf Matlab function, create the lh.white surface file.

[repeat for rh]

5. Obtain thickness data from 
${SUBJECTS_DIR}/${SUBJECTID}/MNINonLinear/Native/${SUBJECTID}.L.thickness.native.shape.gii

[repeat for rh]

6. Convert the annotation into a volume using mri_label2vol.

mri_label2vol --annot lh.highres.annot --temp 
${SUBJECTS_DIR}/${SUBJECTID}/T1w/T1w_acpc_dc_restore.nii.gz --identity --proj 
frac 0 1 .1 --subject ${SUBJECTID} --hemi lh --o vol_lh.nii

[repeat for rh]

7. Configure the volume (remove unwanted ROIs).

[repeat for rh]

8. Combine the configured volumes from each hemisphere to create the random 
parcellation volume.

9. Overlay the random parcellation volume on the template volume.

See attached screenshot.jpeg showing the misalignment between the random 
parcellation volume and the template volume.

Kind regards,

Simon Baker
Brain & Mental Health Laboratory
Institute of Cognitive & Clinical Neuroscience
Monash University


_______________________________________________
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]<mailto:[email protected]>
http://lists.humanconnectome.org/mailman/listinfo/hcp-users


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


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

Reply via email to