Annotation Coordinates: Difference between revisions

From CCN Wiki
Jump to navigation Jump to search
Line 15: Line 15:


== But my coordinates are embedded in .annot files! ==
== But my coordinates are embedded in .annot files! ==
This will require a preparatory step: We must first decompile the .annot files into a series of .label files. Suppose we have lh and rh .annot files for some functionally-defined labels (e.g., from a group-wise GLM contrast). We saved these labels to ?h.p001_blobs.annot
This will require a preparatory step: We must first decompile the .annot files into a series of .label files. Suppose we have lh and rh .annot files for some functionally-defined labels (e.g., from a group-wise GLM contrast), and we saved these labels to ?h.p001_blobs.annot
  ANNOTATION=p001_blobs
  ANNOTATION=p001_blobs
  for HEMI in ( lh rh ); do
  for HEMI in ( lh rh ); do

Revision as of 13:09, 23 August 2018

When visualizing spatial relationships among network nodes representing regions in surface space, it is necessary to assign each node a position in 3D space. The XYZ coordinates of each vertex associated with a label can be found in the corresponding .label files in the label/regenerated_?h_* directories that were generated when carrying out the Lausanne parcellation. For example, to calculate representative spatial locations for the labels in the 60 label parcellation, the associated label files are in label/regenerated_?h_60.


The .label files are plaintext, and are formatted as follows:

#!ascii label  , from subject FS_T1_501 vox2ras=TkReg
1858
50139  -32.785  -24.134  19.744 0.0000000000
50148  -32.758  -24.176  19.440 0.0000000000
50149  -33.035  -24.591  18.914 0.0000000000
50157  -33.293  -24.616  18.023 0.0000000000
51159  -32.615  -23.587  20.632 0.0000000000
... etc.

After the header row and the number of vertices in the file, the left-most column is the vertex number, and the three following columns are the x,y,z coordinates for that vertex. A reasonable value for the representative spatial location of that node can be obtained by calculating the mean x,y,z coordinate.

But my coordinates are embedded in .annot files!

This will require a preparatory step: We must first decompile the .annot files into a series of .label files. Suppose we have lh and rh .annot files for some functionally-defined labels (e.g., from a group-wise GLM contrast), and we saved these labels to ?h.p001_blobs.annot

ANNOTATION=p001_blobs
for HEMI in ( lh rh ); do
  mri_annotation2label --subject fsaverage --hemi ${HEMI} --outdir ${HEMI} --annotation ${ANNOTATION} 
done

This will create lh and rh output directories in your current working directory (we use separate directories to make bookkeeping and the next step a little easier). In each of the output directories will be a series of .label files for the next step.

getSegCoords.m

A MATLAB script has been written to facilitate the calculation of mean segment coordinates. This script, getSegCoords.m can be found in the ubfs Scripts/Matlab folder. It takes a number of optional parameters, but if called without providing any parameters, you will be prompted to select specific files and folders that the script needs to complete its task.

[xyz, hemi, segnames]=getSegCoords

Called this way, without any parameters, the script will assume that the paired lh and rh files and directories have names that differ only with respect to the '?h' characters (by default, the automatch option is set to true). You will be prompted to first identify the label directory (i.e., the directory that contains the ?h.segment_id.label files) for the left hemisphere. The right hemisphere directory will be figured out automatically. The function then calls parseFSSegments.m for each hemisphere, which requires you to identify the '*.sum.txt' files that contain the individual segment names.