Skip to content

general questions about how to build a template

stnava edited this page Jan 2, 2017 · 1 revision

Q: I am working on some data and need to build a common template from some images, e.g. fractional anisotropy derived from DWI. There are 1000 images (2.0mm isotropic). How long do you think it may take to build the template (on a desktop or on our cluster)?

A: You should not try this on a single machine. On a cluster, this would take perhaps one day, depending on the size of the cluster. if you restrict the processing to N images where N is an integer multiple of the number of nodes you can access in parallel, the processing will be faster. Using all 1000 is over kill. Try maybe 100. Alternatively, you can get a good initial template from just 20 or so. Then build from that start point via the -z option. For example, build a good initial template from 20 randomly selected images. The extend this template with all 1000 but running for just 2 iterations. The time this would take would be roughly equivalent to the time to register 2000 images. You can also run only low resolution registrations for the first couple of template building iterations. So, a general procedure might be:

* step 1: select a small subset of images e.g. 20 randomly from the input data
* step 2: run 3 iterations of template building at low-resolution e.g. by using iterations 100x100x0x0 per pairwise registration
* step 3: run high resolution template building with the result from step 2
* step 4: run one or two iterations with much more data

Q: But the template does not have the same value range as the inputs (0-1). Values are between 0-17. Is this an expected behavior of this pipeline?

A: Yes. Images are normalized by their mean value. So the script sees I_i^transformed = I_i^input / mean( I_i^input ). The template building script tries to build an "average" template, given the more general assumptions of intensity similarity which is independent of the input intensity range.

Q: How do i get the images back in the original intensity?

A: I would suggest building a template from roughly 10 to 25 percent of your data. Then register 100 percent of the data to the derived template, transform those images into the template space via antsApplyTransforms, then average the result. This result will not be the template but will the average intensity of the population. Note that these are distinctive concepts in that the template building script tries to estimate an image and correct for the blurring induced by averaging by (a) using shape adjustment and (b) a small amount of intensity sharpening (after averaging the {I_i^transformed} set of images).