fsl.data.vtk
¶
This module provides the VTKMesh
class, for loading triangle
meshes from VTK files.
A handful of convenience functions are also in this module:
loadVTKPolydataFile |
Loads a vtk legacy file containing a POLYDATA data set. |
getFIRSTPrefix |
If the given vtk file was generated by FIRST, this function will return the file prefix.Otherwise a ValueError will be raised.. |
findReferenceImage |
Given a vtk file, attempts to find a corresponding NIFTI image file. |
Note
I/O support is very limited - currently, the only supported file
type is the VTK legacy file format, containing the POLYDATA
dataset. the TriangleMesh
class assumes that every polygon
defined in an input file is a triangle (i.e. refers to three
vertices).
See http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf for an overview of the VTK legacy file format.
In the future, I may or may not add support for more complex meshes.
-
fsl.data.vtk.
ALLOWED_EXTENSIONS
= ['.vtk']¶ A list of file extensions which could contain
VTKMesh
data.
-
fsl.data.vtk.
EXTENSION_DESCRIPTIONS
= ['VTK polygon model file']¶ A description for each of the extensions in
ALLOWED_EXTENSIONS
.
-
class
fsl.data.vtk.
VTKMesh
(infile, fixWinding=False)¶ Bases:
fsl.data.mesh.Mesh
The
VTKMesh
class represents a triangle mesh loaded from a VTK file. Typically only one set of vertices will be associated with aVTKMesh
.
-
fsl.data.vtk.
loadVTKPolydataFile
(infile)¶ Loads a vtk legacy file containing a
POLYDATA
data set.Parameters: infile – Name of a file to load from. Returns: a tuple containing three values: - A \(N\times 3\)
numpy
array containing \(N\) vertices. - A 1D
numpy
array containing the lengths of each polygon. - A 1D
numpy
array containing the vertex indices for all polygons.
- A \(N\times 3\)