Computer Assisted Medical Intervention Tool Kit  version 5.2
VtkMeshUtil Class Reference

This class helps to transform, export and import vtk point sets. More...

#include <VtkMeshUtil.h>

+ Collaboration diagram for VtkMeshUtil:

Public Types

enum  VtkPointSetType { UNKNOWN , UNSTRUCTURED_GRID , STRUCTURED_GRID , POLY_DATA }
 constant for the vtk point set type More...
 

Static Public Member Functions

static vtkSmartPointer< vtkPointSet > buildVtkPointSet (std::string vtkFileName, VtkPointSetType whatIsIt=UNKNOWN)
 Static method that could be used from anywhere to build a vtkPointSet from a vtk file. More...
 
static std::string getVtkPointSetHeaderString (std::string vtkFileName, VtkPointSetType whatIsIt=UNKNOWN)
 static method to get the vtk header string from a vtk file More...
 
static bool saveGeometryToFile (camitk::Geometry *g, std::string vtkFileName)
 Static method that could be use to store any Geometry instance in a vtk file. More...
 
static bool savePointSetToFile (vtkSmartPointer< vtkPointSet > ps, std::string fname, std::string oname="")
 save a vtkDataset into a given file. More...
 
static void savePolyDataToFile (vtkSmartPointer< vtkPolyData > pData, std::string fname, std::string oname="")
 save a given vtkPolyData into a given file More...
 
static void saveStructuredGridToFile (vtkSmartPointer< vtkStructuredGrid > sGrid, std::string fname, std::string oname="")
 save a given vtkStructuredGrid into a given file More...
 
static void saveUnstructuredGridToFile (vtkSmartPointer< vtkUnstructuredGrid > uGrid, std::string fname, std::string oname="")
 save a given vtkUnstructuredGrid into a given file More...
 
static VtkPointSetType typeOf (std::string vtkFileName)
 static method that tells you what kind of vtk file it is. More...
 
static VtkMeshUtil::VtkPointSetType typeOf (vtkSmartPointer< vtkPointSet > aPointSet)
 static method that tells you what kind of vtkPointSet it is. More...
 
static vtkSmartPointer< vtkPolyData > vtkPointSetToVtkPolyData (vtkSmartPointer< vtkPointSet > aPointSet)
 static method that transform any vtkPointSet to a vtkPolyData. More...
 
static camitk::GeometryvtkToGeometry (std::string vtkFileName)
 Static method that could be used from anywhere to translate a vtk file to a Geometry instance. More...
 

Detailed Description

This class helps to transform, export and import vtk point sets.

Note
As it is a pure transformer, all the methods are static.

Member Enumeration Documentation

◆ VtkPointSetType

constant for the vtk point set type

Enumerator
UNKNOWN 
UNSTRUCTURED_GRID 
STRUCTURED_GRID 
POLY_DATA 

Member Function Documentation

◆ buildVtkPointSet()

vtkSmartPointer< vtkPointSet > VtkMeshUtil::buildVtkPointSet ( std::string  vtkFileName,
VtkPointSetType  whatIsIt = UNKNOWN 
)
static

Static method that could be used from anywhere to build a vtkPointSet from a vtk file.

Currently only vtkUnstructuredGrid, vtkPolyData and vtkStructuredGrid are supported. To support more file format build a specific component extension!

Parameters
vtkFileNamethe name of the vtk file to use as input
whatIsIt(optional) if you already know the file type, it is quicker to give it here
Returns
the new vtkPointSet

References POLY_DATA, STRUCTURED_GRID, typeOf(), UNKNOWN, and UNSTRUCTURED_GRID.

Referenced by VtkMeshComponent::VtkMeshComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVtkPointSetHeaderString()

std::string VtkMeshUtil::getVtkPointSetHeaderString ( std::string  vtkFileName,
VtkPointSetType  whatIsIt = UNKNOWN 
)
static

static method to get the vtk header string from a vtk file

Parameters
vtkFileNamethe name of the vtk file to get the header from
whatIsIt(optional) if you already know the file type, it is quicker to give it here
Returns
the header string

References POLY_DATA, STRUCTURED_GRID, typeOf(), UNKNOWN, and UNSTRUCTURED_GRID.

Referenced by VtkMeshComponent::VtkMeshComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveGeometryToFile()

bool VtkMeshUtil::saveGeometryToFile ( camitk::Geometry g,
std::string  vtkFileName 
)
static

Static method that could be use to store any Geometry instance in a vtk file.

Parameters
gthe Geometry instance to save
vtkFileNamethe name of the vtk file to use as output
Returns
true if everything was saved ok.

References camitk::Geometry::getLabel(), and camitk::Geometry::getPointSet().

+ Here is the call graph for this function:

◆ savePointSetToFile()

bool VtkMeshUtil::savePointSetToFile ( vtkSmartPointer< vtkPointSet >  ps,
std::string  fname,
std::string  oname = "" 
)
static

save a vtkDataset into a given file.

Parameters
psthe vtkPointSet to save
fnamethe file name to save to
onamethe name of the object to save (wrote in the header)

References POLY_DATA, STRUCTURED_GRID, and UNSTRUCTURED_GRID.

Referenced by VtkMeshComponentExtension::save().

+ Here is the caller graph for this function:

◆ savePolyDataToFile()

void VtkMeshUtil::savePolyDataToFile ( vtkSmartPointer< vtkPolyData >  pData,
std::string  fname,
std::string  oname = "" 
)
static

save a given vtkPolyData into a given file

Parameters
pDatathe vtkPolyData to save
fnamethe file name to save to
onamethe name of the object to save (wrote in the header)

◆ saveStructuredGridToFile()

void VtkMeshUtil::saveStructuredGridToFile ( vtkSmartPointer< vtkStructuredGrid >  sGrid,
std::string  fname,
std::string  oname = "" 
)
static

save a given vtkStructuredGrid into a given file

Parameters
sGridthe vtkStructuredGrid to save
fnamethe file name to save to
onamethe name of the object to save (wrote in the header)

◆ saveUnstructuredGridToFile()

void VtkMeshUtil::saveUnstructuredGridToFile ( vtkSmartPointer< vtkUnstructuredGrid >  uGrid,
std::string  fname,
std::string  oname = "" 
)
static

save a given vtkUnstructuredGrid into a given file

Parameters
uGridthe vtkUnstructuredGrid to save
fnamethe file name to save to
onamethe name of the object to save (wrote in the header)

◆ typeOf() [1/2]

VtkMeshUtil::VtkPointSetType VtkMeshUtil::typeOf ( std::string  vtkFileName)
static

static method that tells you what kind of vtk file it is.

If it returns VtkManager::UNKNOWN, it means the vtk data are not supported.

Parameters
vtkFileNamethe name of the vtk file to check
Returns
the VtkPointSetType of the file given in parameter

References POLY_DATA, STRUCTURED_GRID, UNKNOWN, and UNSTRUCTURED_GRID.

Referenced by buildVtkPointSet(), getVtkPointSetHeaderString(), VtkMeshComponent::VtkMeshComponent(), and vtkToGeometry().

+ Here is the caller graph for this function:

◆ typeOf() [2/2]

VtkMeshUtil::VtkPointSetType VtkMeshUtil::typeOf ( vtkSmartPointer< vtkPointSet >  aPointSet)
static

static method that tells you what kind of vtkPointSet it is.

If it returns VtkManager::UNKNOWN, this is an unsupported type of vtkPointSet.

Parameters
aPointSetthe pointset data to analyze
Returns
the VtkPointSetType of the file given in parameter

References POLY_DATA, STRUCTURED_GRID, UNKNOWN, and UNSTRUCTURED_GRID.

◆ vtkPointSetToVtkPolyData()

vtkSmartPointer< vtkPolyData > VtkMeshUtil::vtkPointSetToVtkPolyData ( vtkSmartPointer< vtkPointSet >  aPointSet)
static

static method that transform any vtkPointSet to a vtkPolyData.

  • If the vtkPointSet is already a vtkPolyData, nothing is done.
  • If the vtkPointSet is a vtkUnstructuredGrid or vtkStructuredGrid, then it uses a vtkDataSetSurfaceFilter to extract the surface
    Parameters
    aPointSetthe vtkPointSet to transform
    Returns
    the vtkPolyData corresponding

References POLY_DATA.

Referenced by CleanPolyData::apply(), and FillWithPoints::apply().

+ Here is the caller graph for this function:

◆ vtkToGeometry()

Geometry * VtkMeshUtil::vtkToGeometry ( std::string  vtkFileName)
static

Static method that could be used from anywhere to translate a vtk file to a Geometry instance.

convenient method (it is based on buildVtkPointSet).

Parameters
vtkFileNamethe name of the vtk file to use as input
Returns
the new Geometry instance

References camitk::InterfaceGeometry::Surface, typeOf(), and UNKNOWN.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: