Atlas Construction (1)


In this tutorial, we will see how to build an atlas from a set of 5 skull profiles. What you need is a terminal to run Deformetrica and Matlab to visualize data and results.

Data and scripts are in the folder deformetrica-[version]/tutorials/AtlasConstruction1.


1. The data:

  • Run in Matlab the script viewData.m to look at the 5 skulls profiles.
  • To build an atlas, we need to give the algorithm a prototype template, which gives the topology (number of vertices and connectivity) of the template that will be estimated. The prototype we build is displayed on middle-bottom of the generated figure. It is saved in the file skull.vtk.

2. Pre-processing and design choices

  • The pre-processing steps and design choices are the same as for the registration (see Registration (1/2)). Here, we assume also that shapes are already pre-aligned, and we keep the shape representation as 1D varifolds: NonOrientedPolyLine.

3. Run Deformetrica

  • Before running Deformetrica, we need to set up at the parameters in the same .xml files as for registration (see Registration (1/2)). We keep the same parameters as for the registration case. It is a good idea to find good parameter range by registering a pair of shapes, before trying atlas construction.
  • We made the following adjustments:
    • The atlas construction method is multi-threaded. Each subject (here skull) can be treated in parallel. Therefore, we put “5” in the optional parameter number-of-thread in paramDiffeos.xml. If the number of available cores in your machine is smaller, the number of threads will be automatically adjusted.
    • data-sigma in paramCurves.xml. For registration (see Registration (1/2)), we set a small data-sigma to increase the importance of the data term compared to the regularity term, and therefore enforce a good matching accuracy. For atlas construction, it is important to set data-sigma so that both terms have similar order of magnitude. Otherwise, the template shape will not converge properly. Given the values in the registration case, a value of data-sigma = 1 seems to be good. As you will see during the optimization, both terms will be of the same order of magnitude. Furthermore, the regularity will increase and then decrease along the iterations, which is usually the sign of a good convergence of the template shape.
    • If the initialization of our template is very coarse, we can expect a rather slow convergence of the algorithm. Therefore, you might consider to decrease the adaptive-tolerance and increase the maximum-number-of-iterations to further optimize the criterion. These values are in the optional parameters in the paramDiffeos.xml file.
  • Now, we’re all set. Run in terminal the script ./

4. Output and results

  •  The algorithm generated a number of output files:
    • skull_template.vtk is the file of the optimal template estimated by the algorithm (it derives from skull.vtk)
    • CP_final.txt contains the optimal positions of the control points in space
    • Mom_final.txt is a multi-momenta file that can be read by the script readMomentaFile.m in Matlab. It contains 5 sets of momentum vectors, each set parameterizing a deformation, which warps the template to each skull
    • Several .vtk files showing the deformation of the template to each skull (called “subjects” by analogy with a clinical study).
    • Run the script viewResults.m to see the template and the deformations! Again, you can re-run Deformetrica with other parameters to see their impact on both the template shape and the deformations.

5. To go further

  •  There is another example of atlas construction with surfaces in 3D in Atlas Construction (2).
  • Try to build an atlas with several objects using the decomposition of the skulls in 6 homologous parts as in Registration (2/2).


Comments are closed.