iMSTK
Interactive Medical Simulation Toolkit
Enumerations | Functions
imstk::GeometryUtils Namespace Reference

Contains a set of free functions for processing geometry also contains a set of conversion and coupling functions for VTK. More...

Enumerations

enum  MeshNodeRenumberingStrategy { ReverseCuthillMckee }
 Enumeration for reordering method.
 

Functions

std::shared_ptr< PointSetcopyToPointSet (vtkSmartPointer< vtkPointSet > vtkMesh)
 Converts vtk polydata into a imstk point set.
 
std::shared_ptr< SurfaceMeshcopyToSurfaceMesh (vtkSmartPointer< vtkPolyData > vtkMesh)
 Converts vtk polydata into a imstk surface mesh.
 
std::shared_ptr< LineMeshcopyToLineMesh (vtkSmartPointer< vtkPolyData > vtkMesh)
 Converts vtk polydata into a imstk surface mesh.
 
std::shared_ptr< AbstractCellMeshcopyToCellMesh (vtkSmartPointer< vtkUnstructuredGrid > vtkMesh)
 Get imstk cell mesh given vtkUnstructuredGrid as input iMSTK only supports homogenous cells, not unstructured. Uses the last cell type in array. Drops others.
 
vtkSmartPointer< vtkPointSet > copyToVtkPointSet (std::shared_ptr< PointSet > imstkMesh)
 Converts imstk point set into a vtk polydata.
 
vtkSmartPointer< vtkPolyData > copyToVtkPolyData (std::shared_ptr< LineMesh > imstkMesh)
 Converts imstk line mesh into a vtk polydata.
 
vtkSmartPointer< vtkPolyData > copyToVtkPolyData (std::shared_ptr< SurfaceMesh > imstkMesh)
 Converts imstk surface mesh into a vtk polydata.
 
vtkSmartPointer< vtkUnstructuredGrid > copyToVtkUnstructuredGrid (std::shared_ptr< TetrahedralMesh > imstkMesh)
 Converts imstk tetrahedral mesh into a vtk unstructured grid.
 
vtkSmartPointer< vtkUnstructuredGrid > copyToVtkUnstructuredGrid (std::shared_ptr< HexahedralMesh > imstkMesh)
 Converts imstk hexahedral mesh into a vtk unstructured grid.
 
std::shared_ptr< VecDataArray< double, 3 > > copyToVecDataArray (vtkSmartPointer< vtkPoints > points)
 Copy from vtk points to a imstk vertices array.
 
vtkSmartPointer< vtkPoints > copyToVtkPoints (std::shared_ptr< VecDataArray< double, 3 >> vertices)
 Copies vertices from imstk structure to VTK one.
 
template<size_t dim>
vtkSmartPointer< vtkCellArray > copyToVtkCellArray (std::shared_ptr< VecDataArray< int, dim >> cells)
 Copies cells of the given dimension from imstk structure to VTK one.
 
template<size_t dim>
std::shared_ptr< VecDataArray< int, dim > > copyToVecDataArray (vtkCellArray *vtkCells)
 Copy from vtk cells to an imstk index array.
 
void copyToDataMap (vtkDataSetAttributes *pointData, std::unordered_map< std::string, std::shared_ptr< AbstractDataArray >> &dataMap)
 Copy vtkPointData to a data map.
 
void copyToVtkDataAttributes (vtkDataSetAttributes *pointData, const std::unordered_map< std::string, std::shared_ptr< AbstractDataArray >> &dataMap)
 Copy from a data map to vtkDataAttributes (used for vtkCellData and vtkPointData) warning: Components are lost and DataArray's presented as single component.
 
std::shared_ptr< SurfaceMeshtoUVSphereSurfaceMesh (std::shared_ptr< Sphere > sphere, const unsigned int phiDivisions, const unsigned int thetaDivisions)
 UV sphere from imstkSphere.
 
std::shared_ptr< SurfaceMeshtoSurfaceMesh (std::shared_ptr< AnalyticalGeometry > geom)
 Produces SurfaceMesh from an analytical geometry.
 
std::shared_ptr< TetrahedralMeshtoTetGrid (const Vec3d &center, const Vec3d &size, const Vec3i &divisions, const Quatd orientation=Quatd::Identity())
 Produces a tetrahedral grid given the OrientedBox with the given divisions. More...
 
std::shared_ptr< SurfaceMeshtoTriangleGrid (const Vec3d &center, const Vec2d &size, const Vec2i &dim, const Quatd orientation=Quatd::Identity(), const double uvScale=1.0)
 Produces a triangle grid on a plane given the imstkPlane. More...
 
std::shared_ptr< LineMeshtoLineGrid (const Vec3d &start, const Vec3d &dir, const double length, const int dim)
 Creates a set of connected lines. More...
 
int getOpenEdgeCount (std::shared_ptr< SurfaceMesh > surfMesh)
 Returns the number of open edges, use to tell if manifold (==0)
 
bool isClosed (std::shared_ptr< SurfaceMesh > surfMesh)
 Returns if the surface is closed or not.
 
double getVolume (std::shared_ptr< SurfaceMesh > surfMesh)
 Returns volume estimate of closed SurfaceMesh.
 
std::shared_ptr< TetrahedralMeshcreateUniformMesh (const Vec3d &aabbMin, const Vec3d &aabbMax, const int nx, const int ny, const int nz)
 Create a tetrahedral mesh based on a uniform Cartesian mesh. More...
 
std::shared_ptr< TetrahedralMeshcreateTetrahedralMeshCover (std::shared_ptr< SurfaceMesh > surfMesh, const int nx, const int ny, int nz)
 Create a tetrahedral mesh cover. More...
 
template<typename NeighborContainer >
std::vector< size_t > reorderConnectivity (const std::vector< NeighborContainer > &neighbors, const MeshNodeRenumberingStrategy &method=MeshNodeRenumberingStrategy::ReverseCuthillMckee)
 Reorder indices in a connectivity to reduce bandwidth. More...
 
template<typename ElemConn >
std::vector< size_t > reorderConnectivity (const std::vector< ElemConn > &conn, const size_t numVerts, const MeshNodeRenumberingStrategy &method=MeshNodeRenumberingStrategy::ReverseCuthillMckee)
 Reorder using Reverse Cuthill-Mckee. More...
 
vtkSmartPointer< vtkDataArray > coupleVtkDataArray (std::shared_ptr< AbstractDataArray > imstkArray)
 Coupling functions, these create vtk data objects that point to our data objects thus no copying is done here.
 
vtkSmartPointer< vtkImageData > coupleVtkImageData (std::shared_ptr< ImageData > imstkImageData)
 
vtkSmartPointer< vtkDataArray > copyToVtkDataArray (std::shared_ptr< AbstractDataArray > imstkArray)
 Copy functions, these copy to/from vtk data objects.
 
std::shared_ptr< AbstractDataArraycopyToDataArray (vtkSmartPointer< vtkDataArray > vtkArray)
 
std::shared_ptr< ImageDatacopyToImageData (vtkSmartPointer< vtkImageData > imageDataVtk)
 
vtkSmartPointer< vtkImageData > copyToVtkImageData (std::shared_ptr< ImageData > imageData)
 

Detailed Description

Contains a set of free functions for processing geometry also contains a set of conversion and coupling functions for VTK.

Function Documentation

◆ createTetrahedralMeshCover()

std::shared_ptr< TetrahedralMesh > imstk::GeometryUtils::createTetrahedralMeshCover ( std::shared_ptr< SurfaceMesh surfMesh,
const int  nx,
const int  ny,
int  nz 
)

Create a tetrahedral mesh cover.

Todo:
can be parallelized by make NUM_THREADS copies of validTet, or use atomic op on validTet

Definition at line 1776 of file imstkGeometryUtilities.cpp.

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

◆ createUniformMesh()

std::shared_ptr< TetrahedralMesh > imstk::GeometryUtils::createUniformMesh ( const Vec3d &  aabbMin,
const Vec3d &  aabbMax,
const int  nx,
const int  ny,
const int  nz 
)

Create a tetrahedral mesh based on a uniform Cartesian mesh.

Parameters
aabbMinthe small corner of a box
aabbMaxthe large corner of a box
nxnumber of elements in the x-direction
nynumber of elements in the y-direction
nznumber of elements in the z-direction
Note
Refer: Dompierre, Julien & Labbé, Paul & Vallet, Marie-Gabrielle & Camarero, Ricardo. (1999). How to Subdivide Pyramids, Prisms, and Hexahedra into Tetrahedra.. 195-204.

Definition at line 1701 of file imstkGeometryUtilities.cpp.

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

◆ reorderConnectivity() [1/2]

template<typename NeighborContainer >
std::vector< size_t > imstk::GeometryUtils::reorderConnectivity ( const std::vector< NeighborContainer > &  neighbors,
const MeshNodeRenumberingStrategy method = MeshNodeRenumberingStrategy::ReverseCuthillMckee 
)

Reorder indices in a connectivity to reduce bandwidth.

Parameters
[in]neighborsarray of neighbors of each vertex; eg, neighbors[i] is an object containing all neighbors of vertex-i

Definition at line 1960 of file imstkGeometryUtilities.cpp.

◆ reorderConnectivity() [2/2]

template<typename ElemConn >
std::vector< size_t > imstk::GeometryUtils::reorderConnectivity ( const std::vector< ElemConn > &  conn,
const size_t  numVerts,
const MeshNodeRenumberingStrategy method = MeshNodeRenumberingStrategy::ReverseCuthillMckee 
)

Reorder using Reverse Cuthill-Mckee.

Parameters
[in]connelement-to-vertex connectivity
[in]numVertsnumber of vertices
[in]methodreordering method; see ReorderMethod
Returns
the permutation vector that maps from new indices to old indices

Definition at line 1974 of file imstkGeometryUtilities.cpp.

◆ toLineGrid()

std::shared_ptr< LineMesh > imstk::GeometryUtils::toLineGrid ( const Vec3d &  start,
const Vec3d &  dir,
const double  length,
const int  dim 
)

Creates a set of connected lines.

Parameters
startof the line mesh
directionto build the lines
Totallength of the line mesh
divisions

Definition at line 493 of file imstkGeometryUtilities.cpp.

Here is the call graph for this function:

◆ toTetGrid()

std::shared_ptr< TetrahedralMesh > imstk::GeometryUtils::toTetGrid ( const Vec3d &  center,
const Vec3d &  size,
const Vec3i &  divisions,
const Quatd  orientation = Quatd::Identity() 
)

Produces a tetrahedral grid given the OrientedBox with the given divisions.

Parameters
Centerof the grid
Sizeof the grid
x,y,zdivisions of the grid
orientationof the grid

Definition at line 348 of file imstkGeometryUtilities.cpp.

Here is the call graph for this function:

◆ toTriangleGrid()

std::shared_ptr< SurfaceMesh > imstk::GeometryUtils::toTriangleGrid ( const Vec3d &  center,
const Vec2d &  size,
const Vec2i &  dim,
const Quatd  orientation = Quatd::Identity(),
const double  uvScale = 1.0 
)

Produces a triangle grid on a plane given the imstkPlane.

Parameters
Centerof the grid plane
Sizeof the grid
x,ydivisions of the grid
orientationof the grid

Definition at line 425 of file imstkGeometryUtilities.cpp.

Here is the call graph for this function: