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.
 

Comments are closed.