## Utilities

Deformetrica comes with a folder called “utilities” with 3 sub-folders:

### Matlab

This folder contains Matlab functions to read/write from/to Matlab:

**VTKPolyDataReader:**

- Read PolyData in Legacy VTK files
- Syntax:
`[Points, Poly, Scalars, Colors, TextureCoordinates] = VTKPolyDataReader(filename)`

- Points contains the coordinates of the vertices, Poly is the connectivity matrix defining the polygonal faces of the mesh, Scalars, Color and TextureCoordinates correspond to the same fields in VTK PolyData,
- Works only for segments or triangles as polygons

**VTKPolyDataWriter:**

- Write PolyData in Legacy VTK files
- Syntax:
`VTKPolyDataWriter(Pts, Poly, Scalars, Colors, TextureCoordinates, filename)`

- Points contains the coordinates of the vertices, Poly is the connectivity matrix defining the polygonal faces of the mesh, Scalars, Color and TextureCoordinates correspond to the same fields in VTK PolyData
- Works only for segments or triangles as polygons

**readMomentaFile:**

- reads in Matlab the multiple momenta file that come as output of sparseAtlas
- Syntax:
`MOM = readMomentaFile(filename)`

- MOM is of size Dimension x NumberOfControlPoints x NumberOfSubjects
*Note*that simple momenta file (for a single subject as in sparseMatching for instance) can be loaded in Matlab using the command load(‘Mom_final.txt’).

**MomentaWriter:**

- writes a set of momenta attached to control points in a VTK file (to be used typically with the momenta and control points generated by sparseMatching)
- Syntax:
`MomentaWriter(PtsFilename, MomFilename, outFilename)`

- PtsFilename is a txt file of control points position, MomFilename is a txt file of values of momentum vectors, outFilename the file name of the output.

**MultipleMomentaWriter:**

- writes several sets of momenta attached to the same set of control points in a VTK file (to be used typically with the momenta and control points generated by sparseAtlas)
- Syntax:
`MultipleMomentaWriter(PtsFilename, MomFilename, outFilename)`

- PtsFilename is a txt file of control points position, MomFilename is a txt file of multiple momentum vectors, outFilename the file name of the output.

### Meshes

This folder contains meshes of spheres with isotropic sampling. They may be used for building prototype ellipsoidal shapes as input template shape in sparseAtlas.

### vtk

This file contains a C++ source code, which needs to be compiled (see this page). The executable file is:

**MapsEllipsoidWithSource**:

- Deforms a spherical mesh, which is given as input, to an ellipsoidal mesh, so that its center is at the center of mass of the data given as input, and its principal axes are aligned with the principal components of the input data. The length of the axes equal three times the square root of the eigenvalue of the principal component.
- Syntax:
`MapsEllipsoidWithSource outfilename sourceFileName PointSet1 PointSet2 etc..`

- sourceFileName is the vtk file of the spherical mesh, PointsSet1, PointSet2, etc.. are PolyData vtk files of the data, which are used to define the center and principal axes of the ellipsoid.

### Latest news

- Deformetrica is back on line! February 11, 2015
- Deformetrica 2.1 is outÂ ! December 19, 2014
- CADDementia results out! September 23, 2014
- Deformetrica@MICCAI 2014! June 24, 2014
- Deformetrica is released! March 13, 2014

### 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!