Given a family of shapes, the diffeomorphic principal geodesic analysis model allows to estimate principal directions of shape variations, much like Principal Component Analysis. For details, here is the reference article on principal geodesic analysis and here is the reference article on diffeomorphic principal geodesic analysis. A complete description of the mathematics of our implementation of the principal geodesic analysis is given on the LDDMM page, including its loss function.
A toy example
We need to configure the two different xml files: model.xml, data_set.xml, and optionally a optimization_parameters.xml file if we want to add some optimization options. We follow here the examples/principal_geodesic_analysis/landmark/2d/starmen.
The model.xml file
This file requires:
The name of the model. Here for atlas it must be set to 'PrincipalGeodesicAnalysis': <model-type>PrincipalGeodesicAnalysis</model-type>.
The dimension: 2 for 2D images or 2D meshes (which is the case here) and 3 for 3D images of 3D meshes
The latent space dimension which indicates the number of principal components that will be estimated. Here we set it to two: <latent-space-dimension>2</latent-space-dimension>.
The template section: this section defines the list of objects considered in the computation. In our case, a single landmark object is considered, so that there is a unique section in the template section. This object section contains the filename of the template, the type of object and the noise-variance, which controls the importance of the reconstruction of this object with respect to the regularity and with respect to the other objects;
The deformation-parameters section. In our case we only need:
the kernel-width: controls the typical width of the deformation as explained in the LDDMM page.
the kernel-type: can be set to keops or torch. For a large number of control points, keops is advised.
Details about how to construct a general model xml file are available here.
The data_set.xml file
Standard file, like for the deterministic atlas model.
The optimization_parameters.xml file
Contains additional optimization parameters. Default parameters should be fine in most cases.
See the user manual part of the wiki for more details on these xml files.
Running the model
As for the other models, the estimation can be launched using the command deformetrica estimate model.xml data_set.xml -p optimization_parameters.xml. This will start by performing a few iterations of a deterministic atlas on the data to initialize the template, the control points the principal directions and the latent positions of the subjects. Then, the estimation is run on the PGA cost function.
The output folder contains:
The estimated control points
The estimated principal directions
The estimated Template
The reconstruction residuals
Each subject's reconstruction
The principal directions.
Below are animations of the two principal components estimated in this example: