Differences between revisions 6 and 18 (spanning 12 versions)
Revision 6 as of 2006-05-23 18:34:43
Size: 2017
Comment:
Revision 18 as of 2008-11-20 15:36:05
Size: 3044
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[wiki:Self:FsTutorial top] | [wiki:Self:FsTutorial/FslFeatFreeSurfer previous] [[FsTutorial|top]] | [[FsTutorial/FslFeatFreeSurfer|previous]]
Line 3: Line 3:
 *To follow this exercise exactly be sure you've downloaded the [wiki:Self:FsTutorial/Data tutorial data set] before you begin. If you choose not to download the data set you can follow these instructions on your own data, but you will have to substitute your own specific paths and subject names.  *To follow this exercise exactly be sure you've downloaded the [[FsTutorial/Data|tutorial data set]] before you begin. If you choose not to download the data set you can follow these instructions on your own data, but you will have to substitute your own specific paths and subject names.

Type the following prior to beginning the exercises:
----
{{{
tcsh
setenv SUBJECTS_DIR $FREESURFER_HOME/subjects/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/fbert-feat
ln -s $FREESURFER_HOME/subjects/fsaverage
ln -s $FREESURFER_HOME/subjects/bert
}}}
----
The subjects 'fsaverage' and 'bert' may already exist in the subjects directory, so ignore any warnings that might be issued that say 'File exists'.
Line 8: Line 20:
----
Line 9: Line 22:
aseg2feat --feat fbert.feat --aseg aparc+aseg aseg2feat --feat fbert1.feat --aseg aparc+aseg
Line 11: Line 24:
and
This command
will create fbert.feat/reg/freesurfer/aparc+aseg.nii.gz. These are segmentations, meaning that each voxel has an integer value that corresponds to a particular structure. The mapping from structure number to name is given in ${FREESURFER_HOME}/FreeSurferColorLUT.txt.
----
This comm
and will create fbert1.feat/reg/freesurfer/aparc+aseg.nii.gz. These are segmentations, meaning that each voxel has an integer value that corresponds to a particular structure. The mapping from structure number to name is given in ${FREESURFER_HOME}/FreeSurferColorLUT.txt.
Line 17: Line 30:
----
Line 18: Line 32:
avwmaths ./fbert.feat/reg/freesurfer/aparc+aseg.nii.gz \ fslmaths ./fbert1.feat/reg/freesurfer/aparc+aseg.nii.gz \
Line 20: Line 34:
    ./fbert.feat/reg/freesurfer/lh.putamen.nii.gz     ./fbert1.feat/reg/freesurfer/lh.putamen.nii.gz
Line 22: Line 36:
----
Line 23: Line 38:
----
Line 25: Line 41:
    -overlay ./fbert.feat/reg/freesurfer/lh.putamen.nii.gz \
    -overlay-reg ./fbert.feat/reg/freesurfer/anat2exf.register.dat \
    -fthresh 0.5 -fmid 1 -fslope 1 \
    -
segmentation ${SUBJECTS_DIR}/bert/mri/aparc+aseg.mgz \
    ${FREESURFER_HOME}/FreeSurferColorLUT.txt
    -overlay ./fbert1.feat/reg/freesurfer/lh.putamen.nii.gz \
    -overlay-reg ./fbert1.feat/reg/freesurfer/anat2exf.register.dat \
    -fthresh 0.5 -segmentation aparc+aseg.mgz
Line 31: Line 45:
----
You should see the image below:<<BR>>
{{attachment:tkm-lh.putamen-cor-128-small.jpg}}
Line 32: Line 49:
You should see the image below:[[BR]]
attachment:tkm-lh.putamen-cor-128-small.jpg
=== 3.0 Creating ROI summaries ===
Once you have the segmentation mapped to the subject's native functional space, you can create summaries of the functional activation. Eg,:
----
{{{
mri_segstats --seg fbert1.feat/reg/freesurfer/aparc+aseg.nii.gz \
  --nonempty --ctab-default \
  --in fbert1.feat/stats/cope1.nii.gz --sum fbert1.segstats.dat
}}}
----
This will create fbert1.segstats.dat which will be a text file with a table of data. Each row will be a segmentation. The columns will contain various measures, including the number of functional voxels and the mean, stddev, min, max, and range of the cope over each ROI. [[FsTutorial/FslFeatSegStats| Here is an example]].

top | previous

Mapping automatic segmentations to the functional space

  • To follow this exercise exactly be sure you've downloaded the tutorial data set before you begin. If you choose not to download the data set you can follow these instructions on your own data, but you will have to substitute your own specific paths and subject names.

Type the following prior to beginning the exercises:


tcsh
setenv SUBJECTS_DIR $FREESURFER_HOME/subjects/buckner_data/tutorial_subjs
cd $SUBJECTS_DIR/fbert-feat
ln -s $FREESURFER_HOME/subjects/fsaverage
ln -s $FREESURFER_HOME/subjects/bert


The subjects 'fsaverage' and 'bert' may already exist in the subjects directory, so ignore any warnings that might be issued that say 'File exists'.

1.0 Mapping the segmentations

The cortical and subcortical segmentations automatically generated by freesurfer can be mapped into the functional space, which can be useful for doing region of interest (ROI) analysis. This can be done with aseg2feat:


aseg2feat --feat fbert1.feat --aseg aparc+aseg


This command will create fbert1.feat/reg/freesurfer/aparc+aseg.nii.gz. These are segmentations, meaning that each voxel has an integer value that corresponds to a particular structure. The mapping from structure number to name is given in ${FREESURFER_HOME}/FreeSurferColorLUT.txt.

2.0 Creating binary masks

The segmentation for a particular structure can be extracted to create a binary mask (i.e., a volume where the voxel value is 1 if it is in the structure and 0 otherwise). To make a binary mask of the left putamen, which has been assigned label 12 (see ${FREESURFER_HOME}/FreeSurferColorLUT.txt), use the following command:


fslmaths ./fbert1.feat/reg/freesurfer/aparc+aseg.nii.gz \
    -thr 12 -uthr 12 \
    ./fbert1.feat/reg/freesurfer/lh.putamen.nii.gz


To view this binary mask on the anatomical:


tkmedit bert orig.mgz -aux brain.mgz \
    -overlay ./fbert1.feat/reg/freesurfer/lh.putamen.nii.gz \
    -overlay-reg ./fbert1.feat/reg/freesurfer/anat2exf.register.dat \
    -fthresh 0.5 -segmentation aparc+aseg.mgz 


You should see the image below:
tkm-lh.putamen-cor-128-small.jpg

3.0 Creating ROI summaries

Once you have the segmentation mapped to the subject's native functional space, you can create summaries of the functional activation. Eg,:


mri_segstats --seg fbert1.feat/reg/freesurfer/aparc+aseg.nii.gz  \
  --nonempty --ctab-default \
  --in fbert1.feat/stats/cope1.nii.gz --sum fbert1.segstats.dat


This will create fbert1.segstats.dat which will be a text file with a table of data. Each row will be a segmentation. The columns will contain various measures, including the number of functional voxels and the mean, stddev, min, max, and range of the cope over each ROI. Here is an example.

FsTutorial/MapSegmentationsToFunctionalSpace (last edited 2021-09-22 11:39:22 by DevaniCordero)