This page describes how to generate deformation fields that can be applied to MINC files. These simulated deformation fields were used to assess registration algorithms.. Specifically, we look at how accurate we are at finding neuroanatomical differences between groups of mice using image registration (minctracc, mincANTS). Also, we look at whether the sensitivity for detecting shape differences vary across the brain. A paper published on this work can be found here: http://www.sciencedirect.com/science/article/pii/S105381191300640X
The software that supports this project is under version control and located here:
The MINC libraries need to be installed as well. These can be found on GitHub:
Recommended MINC tools (this will install the library mentioned above as well):
General way of installation (automake and libtool should be installed):
The cython part of the code is not installed automatically at the moment. To compile the cython code make sure the cython library is installed and that the path to the library is in the $PYTHONPATH environment variable. Then run:
in the scripts directory.
Testing the installed software
For more information about how the software works, and what is expected from the input files, see the sections below
The git repository contains a folder called test_files. These are two files that are used to create a test deformation field:
This is what they look like and what they indicate (shown using the program "register", which is part of the minc-toolkit. The left and middle image show the tolerance space and target determinant file respectively, on the right is the overlay between the two images):
These can be used to test the code as follows:
What is needed in order to make a deformation field?
The desired deformation field is created using a Jacobian determinant map. The Jacobian determinant of a deformation field specifies whether the change in each voxel is due to atrophy or expansion. Voxels with a value less than 1 shrink (atrophy), voxels with a value greater than 1 grow (expansion). A determinant of 1 means no change. So first we need a region of interest (ROI) in which we want to create a change. This can be any shape (e.g., labels of neuroanatomical regions, squares, spheres...). Furthermore we need a map that indicate areas that are allowed to grow or shrink to account for the intended change. So we need the two following files:
- target determinant map (ROI has values either smaller than 1 (atrophy) or larger than 1 (expansion), other voxels have the value 1 (no change))
- tolerance map (map that indicate voxels which are allowed to either grow or shrink with the value 1)
In this example we will shrink the striatum of the brain by 20%. We have the following files: on the left a slice through the MR image that we want to deform. In the middle a segmentation of the striatum that we use to create a target determinant map from, and on the right a ring of voxels outside of the brain that will be used as tolerance space.
Here is the same image, but with the outline of the striatum segmentation in red shown on all images, and the outline of the tolerance space in yellow shown on all images:
How to work with the software
A target determinant can be created from a mask or structure label. In the following example the file striatum.mnc is a binary file where voxels with the value 1 belong to the striatum and voxels with the value 0 are non-striatum voxels. The output determinant file will shrink the striatum by 20%:
The method above would be the most used (and probably most useful) way to create a determinant, because in general you will have fairly specific ROI that you want to change. Alternatively, you can use a program that will create a target determinant in the form of an octahedron. At the moment, this program is very limited in the kinds of determinants it can create, because only octahedrons can be created. The parameters are given in voxel space. The output determinant will shrink the octahedron area by 40%:
(optional) If you created several areas that require change, merge these into one file. Example for two input files:
(optional) Blur the final determinant file, example:
- Create a tolerance map; a map indicating voxels that are allowed to grow and shrink semi-freely (e.g., CSF, background). The jacobian determinant for a voxel indicates the amount of growth or shrinkage at that voxel. If the value is 1, that means no change, if it is 2 the voxel is doubled in volume/size, and if it is 0.5, the voxel is half the size of its original size. Given that the range of Jacobian runs from (0,infinity), the meaning of a value in the tolerance map is as follows
- Tolerance map value 0: voxel is only allowed to change within the limits of the overall tolerance (set by -t)
- Tolerance map value 1: voxel's determinant can range from 0.5-2, i.e., twice the size or half the size
- Tolerance map value 2: voxel's determinant can range from 0.333-3, i.e., three times the size or one third of the size
Create a deformation field that will produce the growth and shrinkage indicated in the determinant file, example:
If we now look at the Jacobian determinant of the deformation field we just produced, it will become clear why we need the tolerance space:
This is what that file looks like:
There are a couple of things to note here. The black region (striatum area) has the value 0.8001 (i.e., when you apply this transformation to your input file, it will indeed shrink the striatum by 20%). The gray areas have a Jacobian determinant of 1 meaning no change, and the light gray / white areas have Jacobian determinants ranging from 1-2. This area will grow in size when the transformation is applied. The reason this is necessary, is because the algorithm initializes a zero vector field, and iteratively updates all vectors to approximate the desired determinant. In order to shrink one area, some other area needs to grow to accommodate that change. This also means that it is important to use tolerance space in areas that either naturally change in volume, or as in this case, use areas outside of the brain altogether.
Applying the transformation to the input file
To view the other available options:
(Note: important to use blur_determinant for blurring)
(Note 2: creating deformation fields for areas that grow seems to be broken at the moment for large amounts of growth, e.g. jacobian determinant of 2, but works well for values like 1.2)
Work published using this code can be found here: http://www.sciencedirect.com/science/article/pii/S105381191300640X
ISMRM 2010 poster
Preliminary data for this project was presented at ISMRM 2010. The poster presented at ISMRM 2010 can be found here.
Movie showing the deformation creation process
In the following video. the process of creating the deformation field is visualized. The deformation field starts off as a zero vector field, and the vectors are being updated along the way to create the desired jacobian determinant. To create the video, intermediate deformation fields were written out to disk and the input file was resampled using these deformation fields. On the left side in the movie you see the brain being deformed throughout this process. Overlaid in green is the deformation grid at that slice, showing how voxels are being deformed. In blue are areas of that brain that are shrinking and in red are areas of the brain (or outside of the brain) that are growing. On the right side of the image is a plot which represents the volume changes in the striatum, the lateral ventricle and the cortex during the process. The striatum is intended to reduce its size by 50%, and the ventricle is allowed to double or half its size to accommodate for this change. In addition to that there is a ring outside of the brain where deformations can also freely occur. As you can see, the cortex initially grows in size. This happens when the striatum is getting smaller, and the deformations to allow for this are moving to the outside of the brain. When these deformations reach the outside of the brain, the cortex is reduced to its initial size at the end of the process.