Mri binarize: Difference between revisions

From CCN Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:


For T1 & T2
For T1 & T2
  mri_label2vol --annot T1_rh.200functional_subclusters.annot --temp f.nii --o rh.T1_200funclust.mgz --subject fsaverage --hemi rh --reg reg.2mm.mni152.dat
  mri_label2vol --annot T1_rh.200functional_subclusters.annot --temp T1.mgz --o rh.T1_200funclust.mgz --subject fsaverage --hemi rh --reg reg.mni152.2mm.dat
  mri_label2vol --annot T1_lh.200functional_subclusters.annot --temp f.nii --o lh.T1_200funclust.mgz --subject fsaverage --hemi lh --reg reg.2mm.mni152.dat
  mri_label2vol --annot T1_lh.200functional_subclusters.annot --temp T1.mgz --o lh.T1_200funclust.mgz --subject fsaverage --hemi lh --reg reg.mni152.2mm.dat


  mri_label2vol --annot T2_rh.200functional_subclusters.annot --temp f.nii --o rh.T2_200funclust.mgz --subject fsaverage --hemi rh --reg reg.2mm.mni152.dat
  mri_label2vol --annot T2_rh.200functional_subclusters.annot --temp T1.mgz --o rh.T2_200funclust.mgz --subject fsaverage --hemi rh --reg reg.mni152.2mm.dat
  mri_label2vol --annot T2_lh.200functional_subclusters.annot --temp f.nii --o lh.T2_200funclust.mgz --subject fsaverage --hemi lh --reg reg.2mm.mni152.dat
  mri_label2vol --annot T2_lh.200functional_subclusters.annot --temp T1.mgz --o lh.T2_200funclust.mgz --subject fsaverage --hemi lh --reg reg.mni152.2mm.dat
 
Questions: Does it make sense to use fsaverage's T1.mgz as a template, vs the brainmask.  Registery reg.mni152.2mm.dat vs. reg.2mm.mni152.dat ??





Revision as of 16:48, 31 March 2017

If you have data from different time points, as with the booth data, and want to make comparisons of ROI's across time points you'll want to be looking at the same voxels. Here's how to do that with freesurfer.

At this point you should have conducted group stats (mri_glmfit) and pulled out whatever ROI's of interest. Now you'll need to convert your group average .annot label file to a volume, so that we can use the binarize function.

For T1 & T2

mri_label2vol --annot T1_rh.200functional_subclusters.annot --temp T1.mgz --o rh.T1_200funclust.mgz --subject fsaverage --hemi rh --reg reg.mni152.2mm.dat
mri_label2vol --annot T1_lh.200functional_subclusters.annot --temp T1.mgz --o lh.T1_200funclust.mgz --subject fsaverage --hemi lh --reg reg.mni152.2mm.dat
mri_label2vol --annot T2_rh.200functional_subclusters.annot --temp T1.mgz --o rh.T2_200funclust.mgz --subject fsaverage --hemi rh --reg reg.mni152.2mm.dat
mri_label2vol --annot T2_lh.200functional_subclusters.annot --temp T1.mgz --o lh.T2_200funclust.mgz --subject fsaverage --hemi lh --reg reg.mni152.2mm.dat

Questions: Does it make sense to use fsaverage's T1.mgz as a template, vs the brainmask. Registery reg.mni152.2mm.dat vs. reg.2mm.mni152.dat ??


Now that you have volumes, use the mri_binarize function to set significant voxels (specified by min) to 1 and 2 (specified by binval)

For Left and Right Hemi

mri_binarize --i lh.T1_200funclust.mgz --min 0.1 --binval 1 --o T1_sig_lh.mgz
mri_binarize --i lh.T2_200funclust.mgz --min 0.1 --binval 2 --o T2_sig_lh.mgz
mri_binarize --i rh.T1_200funclust.mgz --min 0.1 --binval 1 --o T1_sig_rh.mgz
mri_binarize --i rh.T2_200funclust.mgz --min 0.1 --binval 2 --o T2_sig_rh.mgz

Use fscalc to combine left and right hemi's. This will cause voxels only in T1 to be one, only in T2 to be 2, and voxels in both to be 3.

fscalc T1_sig_lh.mgz add T2_sig_lh.mgz --o sig_T1_T2_lh.mgz 
fscalc T1_sig_rh.mgz add T2_sig_rh.mgz --o sig_T1_T2_rh.mgz 


Then we convert our new volumes back to label files (can also use mri_cor2label), for both left and right hemi's.

mris_seg2annot 
--seg sig_T1_T2_lh.mgz 
--ctab sig_T1_T2_200subclust_lh_CLUT.txt
--s fsaverage
--h lh
--o sig_T1_T2_200subclust_lh.annot
mris_seg2annot 
--seg sig_T1_T2_rh.mgz 
--ctab sig_T1_T2_200subclust_rh_CLUT.txt
--s fsaverage
--h rh
--o sig_T1_T2_200subclust_rh.annot

There seems to be a missing step here where voxels labeled as 3 need to be assigned to an independent label file.

#

And, finally apply the new annot file to each subject, for Left and Right Hemi

mri_surf2surf \
--srcsubject fsaverage \
--trgsubject FS_T1_501 \
--hemi lh \
--sval-annot $SUBJECTS_DIR/fsaverage/label/sig_T1_T2_200subclust_lh.annot \
--tval $SUBJECTS_DIR/FS_T1_501/label/sig_T1_T2_200subclust_lh.annot
mri_surf2surf \
--srcsubject fsaverage \
--trgsubject FS_T1_501 \
--hemi rh \
--sval-annot $SUBJECTS_DIR/fsaverage/label/sig_T1_T2_200subclust_rh.annot \
--tval $SUBJECTS_DIR/FS_T1_501/label/sig_T1_T2_200subclust_rh.annot