Atlas Construction (2)
In this tutorial, we will see how to build an atlas from a set of 3 anatomical configurations made of 2 brain structures each: the hippocampus and the amygdala..What you need is a terminal to run Deformetrica. We will use Paraview to visualize data and results.
Data and scripts are in the folder
1. The data:
- Data are in files
- You can open the files in Paraview.
2. Pre-processing and design choices
- Here again, the anatomical configurations have been co-registered, using affine transforms.
- As we deal with surface mesh, we choose the data representation as NonOrientedSurfaceMesh.
- To build an atlas, we need a prototype shape for the hippocampus and the amygdala. We will use an ellipsoid mesh. To this goal, we will deform a sphere, so that its center will be at the center of mass of the data and the main axis of the ellipsoid will be in the direction of the principal component of the data set. This is done using the command-line MapsEllipsoidWithSource in the folder utilities and the spherical meshes provided in the same folder. To do it, simply execute the script
./initializeTemplate.shin the Terminal. The script produces the vtk files
amyg_prototype.vtkwhich you can open in Paraview.
3. Run Deformetrica
- Parameters can be found in
paramDiffeos.xmlfor the deformation parameter settings and in
paramAmyg.xmlfor the object parameter settings for both objects.
- Run in terminal the script
- We notice that the regularity term during the execution increases and then decreases, thus suggesting good convergence of the template. If it is not the case, consider increasing the data-sigma of the objects.
4. Output and results
- The algorithm generates a number of output files:
amyg_prototype_template.vtkare the files of the updated template shapes,
CP_final.txtcontains the optimal positions of the control points in space,
MOM_final.txtis a multi-momenta file, which contains 3 sets of momentum vectors, each set parameterizing a deformation, which warps the template to each anatomical configuration. You can run the script
generateVTKmomenta.min Matlab to generate a vtk file named
Momenta.vtk, which will display the momenta once opened in Paraview.
- Several .vtk files showing the deformation of the template to each anatomical configuration (they can be loaded as movies in Paraview)
- Of course, you can use spherical mesh with more faces to have template estimated at finer resolution.
The following figure has been obtained by opening in Paraview:
- to this latter we applied the Glyph filter (Filters->Alphabetical->Glyph) and set the scale factor to 7.
- To see the movie of the deformation of the template to the anatomical configuration of the first subject, open
amyg_prototype_to_subject_0__t_*.vtkand then click on “Play” (top panel on the middle).
5. About how to use the atlas
Once the atlas built, we would like to assess if a new subject falls in the typical variability range of the population used to built the atlas. In the current folder, there are two more files that we have left out so far:
amygdala4.vtk, which will play the role of the data of a test subject.
To compare this new data with the atlas, the only thing we need to do is to register the atlas to the new subject’s data. Be careful, that you need to keep the same set of control points as the one in the atlas. The momentum vectors that parameterize the registration should be attached to the same control points as the momentum vectors that parameterize the atlas-to-subjects deformations in the atlas.
To do this, we use the same
paramDiffeos.xml file, except that we set:
- <initial-cp-position>Results_atlas/CP_final.txt</initial-cp-position>, so that the same positions of control points we be given as initialization of the optimization method, and
- <freeze-cp>On</freeze-cp>, so that the positions of control point will not be updated during the optimization.
We name this new file:
paramDiffeosRegistration.xml. To run the registration, simply execute the script
./test_new_subject.sh. It will:
- move the output of the atlas construction in a sub-folder named
sparseMatching3for atlas-to-new-subject registration
CP_final.txt, which should be exactly the same as the one in
Mom_final.txt, which contain the value of the momentum vectors, which could be compared to the mean and covariance matrix of the momentum vectors in
- the files
amyg_prototype_template__t_*.vtk, which can be opened in Paraview to see the movie of the deformation of the atlas to the data of this new subject:
- Get Help
- Code documentation
- User’s Manual
Keep in touch
Thanks for dropping by!
Feel free to subscribe to the RSS feed to stay updated with the latest news of the Deformetrica project.
If you have any questions or comments, feel free to leave a post in the forum, or to us!
Don't hesitate to send us the references of your papers and your best pictures and movies for our gallery!