|
Size: 3270
Comment:
|
Size: 5354
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 4: | Line 4: |
| = Overview= This page relates to the "template" file type used in the !FreeSurfer pipeline as part of the process of coregistering the surfaces of individual subjects. Several concepts are needed to understand this area. (In the following "?h." refers to either of "lh." or "rh.".) |
= Context: The surface registration process = |
| Line 7: | Line 6: |
| * '''Inflated Spherical "version" of a subject's surface mesh:''' As the pipeline progresses, the initial white surface mesh is "inflated" (with constraints to minimize distortion) to several other states, one of which is a sphere, typically '''?h.sphere'''. The inflation process is constrainted to minimize the total distortion. | This page describes technical aspects of the "template" file type used in the !FreeSurfer pipeline as part of the process of coregistering the surfaces of individual subjects. If you are unfamiliar with this process and the programs involved, please see this overview: SurfaceRegAndTemplates. |
| Line 9: | Line 8: |
| * '''Vertex-wise data is applicable to all versions of the surface:''' The inflation process does not add or remove any vertices, so any data associated with the white vertices (such as curvature or convexity) is still associated with the same-numbered vertices of the sphere mesh. This is the basis of displays such as the following where a per-vertex variable "convexity" (of the white surface) is plotted in color on the sphere: | = Template data = == Template data grid == A template contains curvature-related data as an array of data items that pertain to a grid of points on the sphere -- but which grid? Is it a specific surface mesh supplied with FreeSurfer? A standard "icosahedron" such as ic7.tri with an even distribution of 327680 triangles? |
| Line 11: | Line 12: |
| { Sulc on sphere } | As it turns out, it's a grid defined in spherical coordinates:[[BR]] * theta (0..2*pi in 512 steps) * phi (0..pi in 256 steps)[[BR]] ... the two parameters of the so-called "surface parameterization" (elsewhere known as u and v). |
| Line 13: | Line 17: |
| * '''Registration of a subject's surface''' to a reference consists of a 2-D warp of the subject's sphere surface so that the individual's curvature data pattern aligns with a reference '''template''' pattern. The template was previously prepared as the "average" (loosely speaking) pattern from a group of representative subjects. The standard template supplied with !FreeSurfer is in the files '''{fshome}/average/?h.average.curvature.filled.buckner40.tif'''. | So, for any single data item, we can expect an array(256 * 512) numbers. |
| Line 15: | Line 19: |
| * '''The result of registation''' is yet another version of the subject's surface mesh, typically named '''?h.sphere.reg''', this time with the x,y,z vertex positions still on a sphere, but warped so that the subject's curvature pattern best aligns with the template data. | == Template data items == The various programs involved have some flexibility in what size and shape of template to work with, but here I will describe the standard ?h.average.curvature.filled.buckner40.tif. |
| Line 17: | Line 22: |
| What is to be discussed below relates to the content and format of the template file just mentioned. | The registration process does not simply attempt to match a subject and template based on a single variable. Instead it works with several variables, and statistics about those variables. |
| Line 19: | Line 24: |
| Here's what I think is in the standard template: | |
| Line 20: | Line 26: |
| = Synopsis = command argA argB -flag1 arg1 -flag2 arg2 [-flag3 arg3] [-flag4 arg4] |
||<#D0D0D0>'''Surface'''||<#D0D0D0>'''Measure'''||<#D0D0D0>'''Variable/Statistics'''|| ||<^>inflated ("football")||<^>inflated.H ||-- mean[[BR]]-- variance[[BR]]-- Degrees-of-freedom || ||<^>smoothwm ||<^>sulc (ie: convexity)||-- mean[[BR]]-- variance[[BR]]-- Degrees-of-freedom|| ||<^>smoothwm ||<^>curv? ||-- mean[[BR]]-- variance[[BR]]-- Degrees-of-freedom|| |
| Line 23: | Line 31: |
| = Arguments = == Positional Arguments == || argA || brief description || detailed description (eg, help file information) || || argB || brief description || detailed description (eg, help file information) || |
Notes: [[BR]] 1. "inflated.H" is likely "mean curvature" of the inflated surface, that is the per-vertex value (kmin+kmax)/2.[[BR]] 2. I'm not certain on the measure in the 3rd row because in the mris_register source code it's calculated on the fly, and hard to tell which options cause it to do what.[[BR]] 3. Inspecting the actual data in the standard template, the Degrees-of-freedom data seems to be zero. |
| Line 28: | Line 36: |
| == Required Flagged Arguments == || -flag1 arg1 || brief description || detailed description (eg, help file information) || || -flag2 arg2 || brief description || detailed description (eg, help file information) || |
So, we expect that the standard template contains nine arrays of (256 * 512) numbers. |
| Line 32: | Line 38: |
| == Optional Flagged Arguments == || -flag3 arg3 || brief description ||detailed description (eg, help file information) || || -flag4 arg4 || brief description ||detailed description (eg, help file information) || = Outputs = || volume1 || description || || volume2 || description || |
== Template data storage format; What's with this tif business anyway? == |
| Line 40: | Line 40: |
| = Description = description |
In several areas throughout !FreeSurfer, non-obvious choices have been made regarding persisting (saving to disk for later use) various kinds of data, and this is the case for templates. |
| Line 43: | Line 42: |
| = Examples = == Example 1 == command foo -i f -o out |
The !FreeSurfer code includes a library that is suitable for handling 2-D images (ie: pictures), which already knows how to work with 2-D arrays of pixels, including keeping track of the type of data at each pixel, rows and columns and so on. In addition, it is able to save and load various image formats. As it happens, the TIFF format is able to do two useful things in this regard: save multiple images, and apply compression. |
| Line 47: | Line 44: |
| description | So, the template's (256 * 512) arrays are handled in memory data structures as though they are picture images, and loaded and saved using TIFF functions. |
| Line 49: | Line 46: |
| == Example 2 == command foo -i f -o out -f fvalue |
By way of closure, here is lh.average.curvature.filled.buckner40.tif as seen in an image viewer: |
| Line 52: | Line 48: |
| description | attachment:lh_buckner40_im3.jpg |
| Line 54: | Line 50: |
| = Bugs = None |
Several points to note: |
| Line 57: | Line 52: |
| = See Also = ["othercommand1"], ["othercommand2"] |
* Dimensions are 256 x 512, so theta 0..2*pi in 512 steps vertically, and phi 0..pi in 256 steps horizontally. * The image viewer is set to 32 bits per pixel floating point. * This is image 3, counting from zero, of a total of 9 images. This is the second row in the table above, first statistic, so the variable shown is: [[BR]]surface: smoothwm;[[BR]]variable: convexity (ie: sulc);[[BR]]statistic: mean value across the reference subjects (ie: mean of sulc value at this location across subject). * Values for this image vary from about -2.8 to +3.3. |
| Line 60: | Line 57: |
| = Links = FreeSurfer, FsFast |
=== Relationship of template to subject pattern === Given that this is the template to which sample subject bert's data is registered, we should be able to see some resemblance between the two. Here is bert's sulc (convexity) pattern: |
| Line 63: | Line 60: |
| = Methods Description = {{{ description description }}} |
attachment:fsbert_sulc_spherereg.jpg |
| Line 69: | Line 62: |
| = References = ["References/Lastname###"] |
... snd here is the template sulc pattern, the same data as shown above but now rotated, flipped and colored green-to-red: |
| Line 72: | Line 64: |
| = Reporting Bugs = Report bugs to <analysis-bugs@nmr.mgh.harvard.edu> |
attachment:lh_buckner40_im3_color.jpg |
| Line 75: | Line 66: |
| = Author/s = JaneSmith |
You can probably see the resemblance, especially in the "equatorial regions". The resemblance won't be exact, because the bert image shows ''bert's'' sulc intensity, whereas the template image shows the aggregation of sulc data from the reference subjects. The template is distorted relative to the spherical version, in the manner of a "Mercator projection", as described here [http://en.wikipedia.org/wiki/Map_projection Map projection]: attachment:gw_mercator.gif = Creating a template = Templates are created using mris_make_template, in a process described here SurfaceRegAndTemplates. = Extracting template data = Supposing one wanted to extract data from a template, for example to inspect the pattern, and perhaps display it in color on a sphere. The extraction is possible using ["mrisp_paint"] which samples the template to a target surface and produces a "curv" format file which can be displayed in tksurfer. = Author(s) = GrahamWideman |
Index TableOfContents
Context: The surface registration process
This page describes technical aspects of the "template" file type used in the FreeSurfer pipeline as part of the process of coregistering the surfaces of individual subjects. If you are unfamiliar with this process and the programs involved, please see this overview: SurfaceRegAndTemplates.
Template data
Template data grid
A template contains curvature-related data as an array of data items that pertain to a grid of points on the sphere -- but which grid? Is it a specific surface mesh supplied with FreeSurfer? A standard "icosahedron" such as ic7.tri with an even distribution of 327680 triangles?
As it turns out, it's a grid defined in spherical coordinates:BR
- theta (0..2*pi in 512 steps)
phi (0..pi in 256 steps)BR
... the two parameters of the so-called "surface parameterization" (elsewhere known as u and v).
So, for any single data item, we can expect an array(256 * 512) numbers.
Template data items
The various programs involved have some flexibility in what size and shape of template to work with, but here I will describe the standard ?h.average.curvature.filled.buckner40.tif.
The registration process does not simply attempt to match a subject and template based on a single variable. Instead it works with several variables, and statistics about those variables.
Here's what I think is in the standard template:
Surface |
Measure |
Variable/Statistics |
inflated ("football") |
inflated.H |
|
smoothwm |
sulc (ie: convexity) |
|
smoothwm |
curv? |
Notes: BR 1. "inflated.H" is likely "mean curvature" of the inflated surface, that is the per-vertex value (kmin+kmax)/2.BR 2. I'm not certain on the measure in the 3rd row because in the mris_register source code it's calculated on the fly, and hard to tell which options cause it to do what.BR 3. Inspecting the actual data in the standard template, the Degrees-of-freedom data seems to be zero.
So, we expect that the standard template contains nine arrays of (256 * 512) numbers.
Template data storage format; What's with this tif business anyway?
In several areas throughout FreeSurfer, non-obvious choices have been made regarding persisting (saving to disk for later use) various kinds of data, and this is the case for templates.
The FreeSurfer code includes a library that is suitable for handling 2-D images (ie: pictures), which already knows how to work with 2-D arrays of pixels, including keeping track of the type of data at each pixel, rows and columns and so on. In addition, it is able to save and load various image formats. As it happens, the TIFF format is able to do two useful things in this regard: save multiple images, and apply compression.
So, the template's (256 * 512) arrays are handled in memory data structures as though they are picture images, and loaded and saved using TIFF functions.
By way of closure, here is lh.average.curvature.filled.buckner40.tif as seen in an image viewer:
attachment:lh_buckner40_im3.jpg
Several points to note:
- Dimensions are 256 x 512, so theta 0..2*pi in 512 steps vertically, and phi 0..pi in 256 steps horizontally.
- The image viewer is set to 32 bits per pixel floating point.
This is image 3, counting from zero, of a total of 9 images. This is the second row in the table above, first statistic, so the variable shown is: BRsurface: smoothwm;BRvariable: convexity (ie: sulc);BRstatistic: mean value across the reference subjects (ie: mean of sulc value at this location across subject).
- Values for this image vary from about -2.8 to +3.3.
Relationship of template to subject pattern
Given that this is the template to which sample subject bert's data is registered, we should be able to see some resemblance between the two. Here is bert's sulc (convexity) pattern:
attachment:fsbert_sulc_spherereg.jpg
... snd here is the template sulc pattern, the same data as shown above but now rotated, flipped and colored green-to-red:
attachment:lh_buckner40_im3_color.jpg
You can probably see the resemblance, especially in the "equatorial regions". The resemblance won't be exact, because the bert image shows bert's sulc intensity, whereas the template image shows the aggregation of sulc data from the reference subjects.
The template is distorted relative to the spherical version, in the manner of a "Mercator projection", as described here [http://en.wikipedia.org/wiki/Map_projection Map projection]:
attachment:gw_mercator.gif
Creating a template
Templates are created using mris_make_template, in a process described here SurfaceRegAndTemplates.
Extracting template data
Supposing one wanted to extract data from a template, for example to inspect the pattern, and perhaps display it in color on a sphere. The extraction is possible using ["mrisp_paint"] which samples the template to a target surface and produces a "curv" format file which can be displayed in tksurfer.
