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:
Loads a vtk legacy file containing a |
|
If the given |
|
Given a |
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(*args, **kwargs)[source]
Bases:
Mesh
The
VTKMesh
class represents a triangle mesh loaded from a VTK file. Typically only one set of vertices will be associated with aVTKMesh
.- __init__(infile, fixWinding=False)[source]
Create a
VTKMesh
.- Parameters:
infile – VTK file to load mesh from.
fixWinding – See the
Mesh.addVertices()
method.
- __annotations__ = {}
- __module__ = 'fsl.data.vtk'
- fsl.data.vtk.loadVTKPolydataFile(infile)[source]
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.