Index TableOfContents

Context: The surface registration process

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.".)

What is to be discussed below relates to the content and format of the template file just mentioned.

Disambiguation: template vs atlas

In many places, especially within the FreeSurfer source code, the word "atlas" is often used interchangeably with "template". I am reserving the term atlas for the GCA files used in labeling regions.

Template data

Template data grid

As might be guessed, a template contains curvature-related data as an array of data items that correspond to a grid of points on the sphere -- but which grid? Is it a specific surface mesh supplied with FreeSurfer? A standard "icosahedron"? As it turns out, it's a grid defined in spherical coordinates: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) of 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:




inflated ("football")




sulc (ie: convexity)





Notes:[[BR]] 1. "inflated.H" is likely "mean curvature", that is the per-vertex value (kmin+kmax)/2.BR 2. I'm not sure 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.

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 called 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 as though they are 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 (irfanview):BR attachment:bucknertif4.gifBR Doubtless you can immediately see the resemblance to the second bert image above :-).

Several points to note:

Creating a template

That's done using mris_make_template. Separate article in the works.

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.