iMSTK
Interactive Medical Simulation Toolkit
imstkVTKMeshIO.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkMeshIO.h"
10 
11 namespace imstk
12 {
13 class AbstractCellMesh;
14 class HexahedralMesh;
15 class ImageData;
16 class LineMesh;
17 class SurfaceMesh;
18 class TetrahedralMesh;
19 
25 class VTKMeshIO
26 {
27 public:
28  VTKMeshIO() = default;
29  virtual ~VTKMeshIO() = default;
30 
34  static std::shared_ptr<PointSet> read(const std::string& filePath, MeshFileType meshType);
35 
39  static bool write(const std::shared_ptr<PointSet> imstkMesh, const std::string& filePath, const MeshFileType meshType);
40 
41 protected:
42 
46  template<typename ReaderType>
47  static std::shared_ptr<PointSet> readVtkGenericFormatData(const std::string& filePath);
48 
52  template<typename ReaderType>
53  static std::shared_ptr<SurfaceMesh> readVtkPolyData(const std::string& filePath);
54 
58  template<typename WriterType>
59  static bool writeVtkImageData(const std::shared_ptr<ImageData> imstkMesh, const std::string& filePath);
60 
64  template<typename WriterType>
65  static bool writeVtkPolyData(const std::shared_ptr<SurfaceMesh> imstkMesh, const std::string& filePath);
66 
70  template<typename WriterType>
71  static bool writeVtkPolyData(const std::shared_ptr<LineMesh> imstkMesh, const std::string& filePath);
72 
76  template<typename WriterType>
77  static bool writeVtkPointSet(const std::shared_ptr<PointSet> imstkMesh, const std::string& filePath);
78 
82  template<typename WriterType>
83  static bool writeVtkUnstructuredGrid(const std::shared_ptr<TetrahedralMesh> tetMesh, const std::string& filePath);
84  template<typename WriterType>
85  static bool writeVtkUnstructuredGrid(const std::shared_ptr<HexahedralMesh> hMesh, const std::string& filePath);
86 
91  template<typename ReaderType>
92  static std::shared_ptr<AbstractCellMesh> readVtkUnstructuredGrid(const std::string& filePath);
93 
97  template<typename ReaderType>
98  static std::shared_ptr<ImageData> readVtkImageData(const std::string& filePath);
99 
103  static std::shared_ptr<ImageData> readVtkImageDataDICOM(const std::string& filePath);
104 
108  static std::shared_ptr<ImageData> readVtkImageDataNIFTI(const std::string& filePath);
109 
113  static bool writeVtkImageDataNIFTI(std::shared_ptr<ImageData> imageData, const std::string& filePath);
114 
118  static bool writeMetaImageData(std::shared_ptr<ImageData> imageData, const std::string& filePath);
119 };
120 } // namespace imstk
Implements VTK read and write functions.
static std::shared_ptr< AbstractCellMesh > readVtkUnstructuredGrid(const std::string &filePath)
Reads vtk unstructured grid. Drops cells that aren&#39;t of the last cell type.
static std::shared_ptr< ImageData > readVtkImageDataNIFTI(const std::string &filePath)
Reads nifti/nii format image data.
MeshFileType
Enumeration the mesh file type.
Definition: imstkMeshIO.h:19
static bool writeVtkPolyData(const std::shared_ptr< SurfaceMesh > imstkMesh, const std::string &filePath)
Writes the given surface mesh to given file path using the provided writer type.
Compound Geometry.
static bool writeVtkImageData(const std::shared_ptr< ImageData > imstkMesh, const std::string &filePath)
Writes the given image data to given file path using the provided writer type.
static bool writeVtkImageDataNIFTI(std::shared_ptr< ImageData > imageData, const std::string &filePath)
Write nifti/nii format image data.
static bool write(const std::shared_ptr< PointSet > imstkMesh, const std::string &filePath, const MeshFileType meshType)
Writes the given mesh to the specified file path.
static std::shared_ptr< ImageData > readVtkImageDataDICOM(const std::string &filePath)
TODO.
static bool writeVtkUnstructuredGrid(const std::shared_ptr< TetrahedralMesh > tetMesh, const std::string &filePath)
Writes the given volumetric mesh to given file path.
static bool writeMetaImageData(std::shared_ptr< ImageData > imageData, const std::string &filePath)
Write meta/mhd format image data.
static bool writeVtkPointSet(const std::shared_ptr< PointSet > imstkMesh, const std::string &filePath)
Writes the given point set to given file path using the provided writer type.
static std::shared_ptr< ImageData > readVtkImageData(const std::string &filePath)
Reads vtk image data.