Differences between revisions 1 and 23 (spanning 22 versions)
Revision 1 as of 2004-09-02 14:02:39
Size: 4444
Editor: JulieBates
Comment:
Revision 23 as of 2017-12-01 17:19:03
Size: 7166
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Describe mri_annotation2label here. '''Index''' <<TableOfContents>>
Line 3: Line 3:
'''Index'''
[[TableOfContents]]
Software version described:
Line 6: Line 5:
 * $Date: 2007/11/16 20:32:50 $
 * $Revision: 1.15 $
 * Use usage or version option to see version you are using
Line 8: Line 10:
mri_annotation2label - Converts annotation into label files mri_annotation2label - Inputs an annotation file and produces corresponding label files.
Line 11: Line 13:
mri_annotation2label [Flagged arguments]
Line 13: Line 16:
== Required Flagged Arguments ==
Line 14: Line 18:
== Positional Arguments == || --subject <subjid> || source subject ||
|| --hemi <lh or rh> || hemisphere (with surface) ||
Line 16: Line 21:
== Required Flagged Arguments ==
|| --srcreg || srcreg.dat ||
|| --targreg || targreg.dat ||
== Optional Arguments ==
|| --label <int> || extract only a single label ||
|| --labelbase || output will be base-XXX.label ||
|| --outdir dir || output will be dir/hemi.name.label ||
|| --seg segfile || output will be segmentation 'volume' ||
|| --segbase base || add base to the annotation number to get seg value ||
|| --ctab colortable || colortable like FreeSurferColorLUT.txt ||
|| --border borderfile || output will be a binary overlay of the parc borders. Creates an overlay file in which the boundaries of the parcellations are set to 1 and everything else is 0. This can then be loaded as an overlay in tksurfer. ||
|| --border-annot borderannot || default goes in subject/label ||
|| --annotation annotation || selects input annotation file, as found in SUBJECTS_DIR/labels. Default is 'aparc' ||
|| --sd <SUBJECTS_DIR> || specify SUBJECTS_DIR on the command line ||
|| --surface surfacename || name of surface, default is 'white' if omitted. This selects the surface file that the program will read in order to create RAS coordinates for each vertex listed in a label file. Argument can also be --surf ||
|| --stat statfile || surface overlay file (curv or volume format). Put the value from the statfile into the Stat field n the labe. statfile must be a curv of surface overlay (eg mgh) format (eg lh.thickness) ||
|| --lobes <lobesfile> || create an annotation based on cortical lobes. Note that the precentral and postcentral labels are not included as part of the 'frontal' or 'parietal' lobes. The lobar annotation is saved to <lobesfile>. ||
|| --lobesStrict <lobesfile> || use a slightly stricter lobe definition that adds the precentral to the 'frontal' and includes the postcentral with the 'parietal' lobe. The lobar annotation is saved to <lobesfile>. ||
|| --lobesStrictPHCG <lobesfile> || use stricter lobe definition, and adds an additional lobe called parahippocampalgyrus which includes parahippocampal, entorhinal, temporalpole, and fusiform. The lobar annotation is saved to <lobesfile>. ||
|| --help || displays help information ||
|| --version || displays version information ||
= Description =
The main purpose of this program is to convert an annotation file into multiple label files or into a segmentation 'volume'. It can also create a border overlay. Optionally it can create output files that contain label information in other forms. (This program cannot export the annotation file's LUT to text format -- if you need to do that, for example to verify it, you could use [[mris_anatomical_stats]].
Line 20: Line 42:
== Optional Flagged Arguments ==
|| --targsubj subjid || default is talairach ||
|| --xfm xfmrname || xfm file name relative to transforms ||
|| --sd subjects_dir || default is env SUBJECTS_DIR ||
|| --fvol funcvol || path to example functional volume ||
|| --help ||
|| --version ||
 
= Outputs =
Inputs are specified via subject, hemisphere, and optionally, if the defaults are not wanted, a base name for the annotation, and a specific surface to be used for the R,A,S coordinates that will be placed in the label files.
Line 30: Line 44:
== Positional Arguments ==  * By default, the base name for the annotation file is 'aparc', so that the actual input annotation file is SUBJECTS_DIR/subject/label/lh.aparc.annot or rh.aparc.annot.
 * A separate label file is created for each annotation index.
 * The output file names can take one of two forms:
 * If --outdir dir is used, then the output will be dir/hemi.name.label, where 'name' is the corresponding name in the lookup table in the annotation file.
 * If --labelbase is used, name of the file is composed using the pattern: labelbase-XXX.label, where XXX is the zero-padded 3 digit annotation index. If labelbase includes a directory path, that directory must already exist.
 * If there are no points in the annotation file for a particular index, no label file is created.
 * The xyz (R,A,S) coordinates in the label file are obtained from the values at that vertex of the specified surface. The default surface is 'white'. Other options include 'pial' and 'orig'.
 *The human-readable names that correspond to the annotation indices for aparc are embedded in the annotation file itself. It is no longer necessary (or possible) to specify the table explicitly with the --table option.
Line 32: Line 53:
== Required Flagged Arguments ==
|| --srcreg || srcreg.dat ||
|| --targreg || targreg.dat ||
=== Details for 'seg' output file label numbers ===
The seg option causes the program to output a 'volume-encoded surface segmentation file'. This is simply the list of per-vertex label values (count = count of vertices), dumped into a file whose format looks like an FS volume file... which some other FS programs are equipped to load. (Ie: it is not actually volume data). See details below.
Line 36: Line 56:
== Optional Flagged Arguments ==
|| --targsubj subjid || default is talairach ||
|| --xfm xfmrname || xfm file name relative to transforms ||
|| --sd subjects_dir || default is env SUBJECTS_DIR ||
|| --fvol funcvol || path to example functional volume ||
|| --help ||
|| --version ||
 
= Outputs =
= Description =
This program will convert an annotation into multiple label files.
User specifies the subject, hemisphere, label base, and (optionally)
the annotation base and surface. By default, the annotation base is
aparc. The program will retrieves the annotations from
SUBJECTS_DIR/subject/label/hemi_annotbase.annot. A separate label file
is created for each annotation index. The output file names can take
one of two forms: (1) If --outdir dir is used, then the output will
be dir/hemi.name.lable, where name is the corresponding name in
the table. (2) If --labelbase is used, name of the file conforms to
labelbase-XXX.label, where XXX is the zero-padded 3 digit annotation
index. If labelbase includes a directory path, that directory must
already exist. If there are no points in the annotation file for a
particular index, no label file is created. The xyz coordinates in the
label file are obtained from the values at that vertex of the
specified surface. The default surface is 'white'. Other options
include 'pial' and 'orig'. [[BR]]

The human-readable names that correspond
to the annotation indices for aparc depend upon how the annotations
were created. They are created with the program mris_ca_label, and
the human readable names are in the file given as the argument to
the -t flag. Unfortunately, this information is not maintained inside
the annotation file, and it must be supplied to mri_annotation2label
through the --table flag.
The label values stored in this situation may be recorded verbatim, or may be increased by an offset amount segbase. By default, these label values are intended to match the index for the label as found in $FREESURFER_HOME/FreeSurferColorLUT.txt; This requires that the annotation file base name be either aparc or aparc.a2005s, in order to invoke the following behavior: If aparc and hemi=lh, then segbase=1000, with segbase values for rh and for aparc.a2005s. This makes the index match that found in aparc+aseg.mgz. If the annotation is neither aparc nor aparc.a2005s, then segbase=0. This behavior can be overridden by manually specifying a segbase with --segbase.
Line 73: Line 60:
 mri_annotation2label --subject LW --hemi rh
        --labelbase ./labels/aparc-rh
        --table $FREESURFER_HOME/Simple_surface_labels2002.txt

  
This will get annotations from $SUBJECTS_DIR/LW/label/rh_aparc.annot
 
and then create about 94 label files: aparc-rh-001.label,
  
aparc-rh-002.label, ... Note that the directory 'labels' must already
 
exist.
{{{
mri_annotation2label --subject LW \
  --hemi rh \
  --labelbase ./labels/aparc-rh
}}}
This will get annotations from $SUBJECTS_DIR/LW/label/rh_aparc.annot and then create about 94 label files: aparc-rh-001.label, aparc-rh-002.label, ... Note that the directory 'labels' must already exist.
Line 83: Line 68:
mri_annotation2label --subject LW --hemi rh 
       --outdir ./labels 
        --table $FREESURFER_HOME/Simple_surface_labels2002.txt

  
This will do the same thing as above except that the output files
 
will have names of the form lh.S_occipital_anterior.label

description
{{{
mri_annotation2label --subject LW \
  
--hemi rh
  --outdir ./labels
}}}
This will do the same thing as above except that the output files will have names of the form lh.S_occipital_anterior.label
Line 93: Line 76:
If the name of the label base does not include a forward slash (ie, '/')
  
then the program will attempt to put the label files in    $SUBJECTS_DIR/subject/label. So, if you want the labels to go into the
  
current directory, make sure to put a './' in front of the label base.
If the name of the label base does not include a forward slash (ie, '/') then the program will attempt to put the label files in $SUBJECTS_DIR/subject/label. So, if you want the labels to go into the current directory, make sure to put a './' in front of the label base.
Line 99: Line 79:
 1. Start tksurfer:          tksurfer -LW lh inflated
       read_annotations lh_aparc
    
When a point is clicked on, it prints out a lot of info, including
    
something like:
       annot = S_temporalis_sup (93, 3988701) (221, 220, 60)
     This indicates that annotion number 93 was hit. Save this point.
      2. Start another tksurfer and load the label:
       tksurfer -LW lh inflated
       [edit label field and hit the 'Read' button]
     Verify that label pattern looks like the annotation as seen in
     the tksurfer window from step 1.
 1. Start tksurfer:
  .
tksurfer -LW lh inflated read_annotations lh_aparc
  .
When a point is clicked on, it prints out a lot of info, including something like:
   . annot = S_temporalis_sup (93, 3988701) (221, 220, 60)
  This indicates that annotion number 93 was hit. Save this point.
Line 113: Line 85:
  3. Load label into tkmedit
       tkmedit LW T1
       [Load the label]
      [Goto the point saved from step 1]
 1. Start another tksurfer and load the label:
  . tksurfer -LW lh inflated [edit label field and hit the 'Read' button]
  . Verify that label pattern looks like the annotation as seen in the tksurfer window from step 1.
Line 118: Line 89:
 1. Load label into tkmedit
  . tkmedit LW T1 [Load the label]
  . [Goto the point saved from step 1]
Line 121: Line 94:

= Links =
FreeSurfer, FsFast

= Methods Description =

= References =
[[mris_label2annot]], LabelsClutsAnnotationFiles
Line 131: Line 97:
Report bugs to <analysis-bugs@nmr.mgh.harvard.edu>

= Author/s =

Report bugs to < analysis-bugs@nmr.mgh.harvard.edu >

Index

Software version described:

  • $Date: 2007/11/16 20:32:50 $
  • $Revision: 1.15 $
  • Use usage or version option to see version you are using

Name

mri_annotation2label - Inputs an annotation file and produces corresponding label files.

Synopsis

mri_annotation2label [Flagged arguments]

Arguments

Required Flagged Arguments

--subject <subjid>

source subject

--hemi <lh or rh>

hemisphere (with surface)

Optional Arguments

--label <int>

extract only a single label

--labelbase

output will be base-XXX.label

--outdir dir

output will be dir/hemi.name.label

--seg segfile

output will be segmentation 'volume'

--segbase base

add base to the annotation number to get seg value

--ctab colortable

colortable like FreeSurferColorLUT.txt

--border borderfile

output will be a binary overlay of the parc borders. Creates an overlay file in which the boundaries of the parcellations are set to 1 and everything else is 0. This can then be loaded as an overlay in tksurfer.

--border-annot borderannot

default goes in subject/label

--annotation annotation

selects input annotation file, as found in SUBJECTS_DIR/labels. Default is 'aparc'

--sd <SUBJECTS_DIR>

specify SUBJECTS_DIR on the command line

--surface surfacename

name of surface, default is 'white' if omitted. This selects the surface file that the program will read in order to create RAS coordinates for each vertex listed in a label file. Argument can also be --surf

--stat statfile

surface overlay file (curv or volume format). Put the value from the statfile into the Stat field n the labe. statfile must be a curv of surface overlay (eg mgh) format (eg lh.thickness)

--lobes <lobesfile>

create an annotation based on cortical lobes. Note that the precentral and postcentral labels are not included as part of the 'frontal' or 'parietal' lobes. The lobar annotation is saved to <lobesfile>.

--lobesStrict <lobesfile>

use a slightly stricter lobe definition that adds the precentral to the 'frontal' and includes the postcentral with the 'parietal' lobe. The lobar annotation is saved to <lobesfile>.

--lobesStrictPHCG <lobesfile>

use stricter lobe definition, and adds an additional lobe called parahippocampalgyrus which includes parahippocampal, entorhinal, temporalpole, and fusiform. The lobar annotation is saved to <lobesfile>.

--help

displays help information

--version

displays version information

Description

The main purpose of this program is to convert an annotation file into multiple label files or into a segmentation 'volume'. It can also create a border overlay. Optionally it can create output files that contain label information in other forms. (This program cannot export the annotation file's LUT to text format -- if you need to do that, for example to verify it, you could use mris_anatomical_stats.

Inputs are specified via subject, hemisphere, and optionally, if the defaults are not wanted, a base name for the annotation, and a specific surface to be used for the R,A,S coordinates that will be placed in the label files.

  • By default, the base name for the annotation file is 'aparc', so that the actual input annotation file is SUBJECTS_DIR/subject/label/lh.aparc.annot or rh.aparc.annot.
  • A separate label file is created for each annotation index.
  • The output file names can take one of two forms:
  • If --outdir dir is used, then the output will be dir/hemi.name.label, where 'name' is the corresponding name in the lookup table in the annotation file.
  • If --labelbase is used, name of the file is composed using the pattern: labelbase-XXX.label, where XXX is the zero-padded 3 digit annotation index. If labelbase includes a directory path, that directory must already exist.
  • If there are no points in the annotation file for a particular index, no label file is created.
  • The xyz (R,A,S) coordinates in the label file are obtained from the values at that vertex of the specified surface. The default surface is 'white'. Other options include 'pial' and 'orig'.
  • The human-readable names that correspond to the annotation indices for aparc are embedded in the annotation file itself. It is no longer necessary (or possible) to specify the table explicitly with the --table option.

Details for 'seg' output file label numbers

The seg option causes the program to output a 'volume-encoded surface segmentation file'. This is simply the list of per-vertex label values (count = count of vertices), dumped into a file whose format looks like an FS volume file... which some other FS programs are equipped to load. (Ie: it is not actually volume data). See details below.

The label values stored in this situation may be recorded verbatim, or may be increased by an offset amount segbase. By default, these label values are intended to match the index for the label as found in $FREESURFER_HOME/FreeSurferColorLUT.txt; This requires that the annotation file base name be either aparc or aparc.a2005s, in order to invoke the following behavior: If aparc and hemi=lh, then segbase=1000, with segbase values for rh and for aparc.a2005s. This makes the index match that found in aparc+aseg.mgz. If the annotation is neither aparc nor aparc.a2005s, then segbase=0. This behavior can be overridden by manually specifying a segbase with --segbase.

Examples

Example 1

mri_annotation2label --subject LW \
  --hemi rh \
  --labelbase ./labels/aparc-rh

This will get annotations from $SUBJECTS_DIR/LW/label/rh_aparc.annot and then create about 94 label files: aparc-rh-001.label, aparc-rh-002.label, ... Note that the directory 'labels' must already exist.

Example 2

mri_annotation2label --subject LW \
  --hemi rh
  --outdir ./labels

This will do the same thing as above except that the output files will have names of the form lh.S_occipital_anterior.label

Bugs

If the name of the label base does not include a forward slash (ie, '/') then the program will attempt to put the label files in $SUBJECTS_DIR/subject/label. So, if you want the labels to go into the current directory, make sure to put a './' in front of the label base.

Testing

  1. Start tksurfer:
    • tksurfer -LW lh inflated read_annotations lh_aparc
    • When a point is clicked on, it prints out a lot of info, including something like:
      • annot = S_temporalis_sup (93, 3988701) (221, 220, 60)
      This indicates that annotion number 93 was hit. Save this point.
  2. Start another tksurfer and load the label:
    • tksurfer -LW lh inflated [edit label field and hit the 'Read' button]
    • Verify that label pattern looks like the annotation as seen in the tksurfer window from step 1.
  3. Load label into tkmedit
    • tkmedit LW T1 [Load the label]
    • [Goto the point saved from step 1]

See Also

mris_label2annot, LabelsClutsAnnotationFiles

Reporting Bugs

Report bugs to < analysis-bugs@nmr.mgh.harvard.edu >

mri_annotation2label (last edited 2017-12-04 12:27:47 by MorganFogarty)