Differences between revisions 11 and 31 (spanning 20 versions)
Revision 11 as of 2006-11-14 12:55:56
Size: 2327
Editor: ThomasYeo
Comment:
Revision 31 as of 2008-02-16 07:19:23
Size: 4762
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
== Overlay Annotation on Surface in Tksurfer == This page tells you how to display an annotation on tksurfer, read an annotation file into matlab or freesurfer.

(Readers stumbling across this page might also like LabelsClutsAnnotationFiles --GW)

= Overlay Annotation on Surface in Tksurfer =
Line 14: Line 18:
====Faster way==== ==== Faster way ====
Line 23: Line 27:
== Reading Into Matlab == = Reading Into Matlab =
Line 28: Line 32:
v = N x 1 vector, v(i) = i-1 (you can usually ignore v) (1) v = N x 1 vector, v(i) = i-1 (you can usually ignore v)
Line 30: Line 34:
L = N x 1 vector, L(i) = label of ith vertex of mesh (2) L = N x 1 vector, L(i) = label of ith vertex of mesh
Line 32: Line 36:
ct = colortable structure (3) ct = colortable structure
Line 34: Line 38:
=== What is a colortable? === ==== What is a colortable (matlab version, see freesurfer version below) ====
Line 37: Line 41:
ct.numEntries = # structures that are specified (scalar) (1) ct.numEntries = # structures that are specified (scalar)
Line 39: Line 43:
ct.orig_tab = location of riginal colortable (string). It's mainly for book-keeping (2) ct.orig_tab = location of riginal colortable (string). It's mainly for book-keeping
Line 41: Line 45:
ct.struct_names = list of structure names (cell). The number of strings should be equal to the number of entries. For example, ct.struct_names{1} could be 'central sulcus' (3) ct.struct_names = list of structure names (cell). The number of strings should be equal to the number of entries. For example, ct.struct_names{1} could be 'central sulcus'
Line 43: Line 47:
ct.table = ct.numEntries x 5 matrix. Row i describes the color and label of the ith structure. ct.table(1,j) specifies the red color value of structure j (0 to 255). ct.table(2,j) specifies the green color value of structure j (0 to 255). ct.table(3, j) specifies the blue color value of structure j (0 to 255). ct.table(4,j) is all zeros. Finally ct.table(5,j) = ct.table(1,j) + ct.table(2,j)*2^8^ + ct.table(3,j)*2^16^ + 0*2^24^ = label given to structure j. (4) ct.table = ct.numEntries x 5 matrix. Row i describes the color and label of the ith structure. ct.table(1,j) specifies the red color value of structure j (0 to 255). ct.table(2,j) specifies the green color value of structure j (0 to 255). ct.table(3, j) specifies the blue color value of structure j (0 to 255). ct.table(4,j) is all zeros (and is currently not used for anything). Finally ct.table(5,j) = ct.table(1,j) + ct.table(2,j)*2^8^ + ct.table(3,j)*2^16^ + 0*2^24^ = label given to structure j.
Line 46: Line 50:

= Reading Annotation Files into Freesurfer =
(1) #include "mrisurf.h"

(2) use function: int MRISreadAnnotation (MRI_SURFACE *mris, char *sname).

(3) Returns NO_ERROR if successful.

(4) *mris is the freesurfer surface structure

(5) sname is the filename of the annotation file. sname can be the full path or just the filename. If it's not a full path, then function will use the directory where the surface mris was read from.

(6) The read annotation is stored in the field mris->vertices[vertex number].annotation (look at mrisurf.h for more details). Note that mris->vertices[vertex number].annotation takes on values defined by the colortable. This is explained in the previous section on "What is a colortable".

(7) If a colortable exists in the annotation file (which in general it should), then the colortable is stored in mris->ct. Note that the colortable in freesurfer is structured differently from that in matlab, but they basically contain the same information. See below:

==== Colortable (Freesurfer version) ====
The colortable matches the label with the structure name. It also gives color to each structure type for visualization in tksurfer.

mris->ct is the pointer to the colortable struct that freesurfer uses. It's different from the matlab version of colortable. The structure can be found in colortab.h, but it can be summarized as follows:

(1) mris->ct->nentries = # entries in colortable (i.e. the number of structures defined by colortable)

(2) mris->ct->CTE[entry number] = pointer to a colortable entry (CTE).

(3) mris->ct->CTE[n]->name = structure name of the nth structure in the colortable

(4) mris->ct->CTE[n]->ri = red color [0-255] of the nth structure, mris->ct->CTE[n]->gi = green color [0-255] of the nth structure, mris->ct->CTE[n]->bi = blue color [0-255] of the nth structure, mris->ct->CTE[n]->ai = 0 (and this number is currently not used for anything).

(5) mris->ct->CTE[n]->rf, mris->ct->CTE[n]->gf, mris->ct->CTE[n]->bf, mris->ct->CTE[n]->af are the corresponding values but from 0 to 1.

= Document Author(s) =
Not known

An annotation file contains labels of a surface, for example the sulci and gyri labels of a cortical surface. It is usally found in the subject_identifier/label/ folder. There is a separate annotation for left and right hemisphere, e.g. ?h.aparc.annot

This page tells you how to display an annotation on tksurfer, read an annotation file into matlab or freesurfer.

(Readers stumbling across this page might also like LabelsClutsAnnotationFiles --GW)

Overlay Annotation on Surface in Tksurfer

(1) Start tksurfer as usual: e.g. tksurfer subject lh inflated

(2) Click on pull down menu: File -> Select Label -> Import Annotation

(3) Browse and find the annotation file (they are usually found in the label folder)

(4) Select and click ok. This will show the labels on the brain.

(5) To change view, click on pull-down menu: view->label style->outline.

Faster way

(1) ctrl-right click on "Show Labels" Button

(2) Browse and find the annotation file (they are usually found in the label folder)

(3) Select and click ok. This will show the labels on the brain.

(4) To change view, click on "Draw Outlined Labels" button

Reading Into Matlab

[v, L, ct] = read_annotation(annotation_filename);

Suppose N is the number of vertices. Then,

(1) v = N x 1 vector, v(i) = i-1 (you can usually ignore v)

(2) L = N x 1 vector, L(i) = label of ith vertex of mesh

(3) ct = colortable structure

What is a colortable (matlab version, see freesurfer version below)

The colortable matches the label with the structure name. It also gives color to each structure type for visualization in tksurfer. In matlab, the colortable structure can be dissected as follows.

(1) ct.numEntries = # structures that are specified (scalar)

(2) ct.orig_tab = location of riginal colortable (string). It's mainly for book-keeping

(3) ct.struct_names = list of structure names (cell). The number of strings should be equal to the number of entries. For example, ct.struct_names{1} could be 'central sulcus'

(4) ct.table = ct.numEntries x 5 matrix. Row i describes the color and label of the ith structure. ct.table(1,j) specifies the red color value of structure j (0 to 255). ct.table(2,j) specifies the green color value of structure j (0 to 255). ct.table(3, j) specifies the blue color value of structure j (0 to 255). ct.table(4,j) is all zeros (and is currently not used for anything). Finally ct.table(5,j) = ct.table(1,j) + ct.table(2,j)*28 + ct.table(3,j)*216 + 0*224 = label given to structure j.

Therefore if vertex i is labeled structure j. Then L(i) = ct.table(5, j).

Reading Annotation Files into Freesurfer

(1) #include "mrisurf.h"

(2) use function: int MRISreadAnnotation (MRI_SURFACE *mris, char *sname).

(3) Returns NO_ERROR if successful.

(4) *mris is the freesurfer surface structure

(5) sname is the filename of the annotation file. sname can be the full path or just the filename. If it's not a full path, then function will use the directory where the surface mris was read from.

(6) The read annotation is stored in the field mris->vertices[vertex number].annotation (look at mrisurf.h for more details). Note that mris->vertices[vertex number].annotation takes on values defined by the colortable. This is explained in the previous section on "What is a colortable".

(7) If a colortable exists in the annotation file (which in general it should), then the colortable is stored in mris->ct. Note that the colortable in freesurfer is structured differently from that in matlab, but they basically contain the same information. See below:

Colortable (Freesurfer version)

The colortable matches the label with the structure name. It also gives color to each structure type for visualization in tksurfer.

mris->ct is the pointer to the colortable struct that freesurfer uses. It's different from the matlab version of colortable. The structure can be found in colortab.h, but it can be summarized as follows:

(1) mris->ct->nentries = # entries in colortable (i.e. the number of structures defined by colortable)

(2) mris->ct->CTE[entry number] = pointer to a colortable entry (CTE).

(3) mris->ct->CTE[n]->name = structure name of the nth structure in the colortable

(4) mris->ct->CTE[n]->ri = red color [0-255] of the nth structure, mris->ct->CTE[n]->gi = green color [0-255] of the nth structure, mris->ct->CTE[n]->bi = blue color [0-255] of the nth structure, mris->ct->CTE[n]->ai = 0 (and this number is currently not used for anything).

(5) mris->ct->CTE[n]->rf, mris->ct->CTE[n]->gf, mris->ct->CTE[n]->bf, mris->ct->CTE[n]->af are the corresponding values but from 0 to 1.

Document Author(s)

Not known

AnnotFiles (last edited 2008-04-29 11:45:15 by localhost)