NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
niftk::ImageToSurfaceFilter Class Reference

Converts pixel data to surface data by using a threshold The mitkNifTKImageToSurfaceFilter is used to create a new surface out of an mitk image. The filter uses a threshold to define the surface. It can use two algorithms for the extraction: the vtkMarchingCube algorithm (default) and the Corrected Marching Cubes 33 method: Custodio, Lis, et al. "Practical considerations on Marching Cubes 33 topological correctness." Computers & Graphics 37.7 (2013): 840-850. More...

Inheritance diagram for niftk::ImageToSurfaceFilter:
Inheritance graph
[legend]
Collaboration diagram for niftk::ImageToSurfaceFilter:
Collaboration graph
[legend]

Public Types

enum  SurfaceExtractionMethod { StandardExtractor, EnhancedCPUExtractor, GPUExtractor }
 
enum  SurfaceDecimationMethod {
  NoDecimation, DecimatePro, QuadricVTK, Quadric,
  QuadricTri, Melax, ShortestEdge
}
 
enum  SurfaceSmoothingMethod {
  NoSurfaceSmoothing, TaubinSmoothing, CurvatureNormalSmooth, InverseEdgeLengthSmooth,
  WindowedSincSmoothing, StandardVTKSmoothing
}
 
enum  InputSmoothingMethod { NoInputSmoothing, GaussianSmoothing, MedianSmoothing }
 

Public Member Functions

 mitkClassMacro (ImageToSurfaceFilter, SurfaceSource) static Pointer New()
 
virtual void GenerateData () override
 For each image time slice a surface will be created. This method is called by Update(). More...
 
virtual void GenerateOutputInformation () override
 Initializes the output information ( i.e. the geometry information ) of the output of the filter. More...
 
const mitk::Image * GetInput (void)
 Returns a const reference to the input image (e.g. the original input image that ist used to create the surface) More...
 
virtual void SetInput (const mitk::Image *image)
 
virtual void SetThreshold (mitk::ScalarType _arg)
 Set the Marching Cubes threshold value. Threshold can be manipulated by inherited classes. More...
 
virtual mitk::ScalarType GetThreshold () const
 Get the Marching Cubes threshold value. Threshold can be manipulated by inherited classes. More...
 
virtual SurfaceExtractionMethod GetSurfaceExtractionType () const
 Get the state of the input image smoothing mode. More...
 
virtual void SetSurfaceExtractionType (SurfaceExtractionMethod _arg)
 Sets the input image smoothing mode (Gaussian / Median) More...
 
virtual InputSmoothingMethod GetInputSmoothingType () const
 Get the state of the input image smoothing mode. More...
 
virtual void SetInputSmoothingType (InputSmoothingMethod _arg)
 Sets the input image smoothing mode (Gaussian / Median) More...
 
virtual void SetPerformInputSmoothing (bool _arg)
 Enables input image smoothing. The preferred method can be specified, along with the radius. More...
 
virtual void PerformInputSmoothingOn ()
 Enable/Disable input image smoothing. More...
 
virtual void PerformInputSmoothingOff ()
 
virtual bool GetPerformInputSmoothing () const
 Returns if input image smoothing is enabled. More...
 
virtual void SetInputSmoothingRadius (float _arg)
 Sets the smoothing radius of the input image smoothing method. More...
 
virtual float GetInputSmoothingRadius () const
 Returns the smoothing radius of the input image smoothing method. More...
 
virtual void SetInputSmoothingIterations (int _arg)
 Sets the number of iterations for the surface smoothing method. More...
 
virtual int GetInputSmoothingIterations () const
 Returns the number of iterations for the surface smoothing method. More...
 
virtual SurfaceSmoothingMethod GetSurfaceSmoothingType () const
 Get the state of the surface smoothing mode. More...
 
virtual void SetSurfaceSmoothingType (SurfaceSmoothingMethod _arg)
 Sets the surface smoothing mode (Laplacian / Taubin) More...
 
virtual void SetPerformSurfaceSmoothing (bool _arg)
 Enables surface smoothing. The preferred method can be specified, along with the parameters. More...
 
virtual void PerformSurfaceSmoothingOn ()
 Enable/Disable surface smoothing. More...
 
virtual void PerformSurfaceSmoothingOff ()
 
virtual bool GetPerformSurfaceSmoothing () const
 Returns if surface smoothing is enabled. More...
 
virtual void SetSurfaceSmoothingRadius (float _arg)
 Sets the smoothing radius of the surface smoothing method. More...
 
virtual float GetSurfaceSmoothingRadius () const
 Returns the smoothing radius of the surface smoothing method. More...
 
virtual void SetSurfaceSmoothingIterations (int _arg)
 Sets the number of iterations for the input image smoothing method. More...
 
virtual int GetSurfaceSmoothingIterations () const
 Returns the number of iterations for the input image smoothing method. More...
 
virtual SurfaceDecimationMethod GetSurfaceDecimationType () const
 Get the state of decimation mode to reduce the number of triangles in the surface represantation. More...
 
virtual void SetSurfaceDecimationType (SurfaceDecimationMethod _arg)
 Sets the surface decimation method to reduce the number of triangles in the mesh and produce a good approximation to the original image. More...
 
virtual void SetPerformSurfaceDecimation (bool _arg)
 Enables surface decimation. The preferred method can be specified, along with the radius. More...
 
virtual void PerformSurfaceDecimationOn ()
 Enable/Disable surface decimation. More...
 
virtual void PerformSurfaceDecimationOff ()
 
virtual bool GetPerformSurfaceDecimation () const
 Returns if surface decimation is enabled. More...
 
virtual void SetTargetReduction (float _arg)
 Set desired amount of reduction of triangles in the range from 0.0 to 1.0. For example 0.9 will reduce the data set to 10%. More...
 
virtual float GetTargetReduction () const
 Returns the reduction factor as a float value. More...
 
virtual void SetSamplingRatio (double _arg)
 Set desired downsampling ratio that is applied to the image before surface extraction. More...
 
virtual double GetSamplingRatio () const
 Returns the downsampling ratio. More...
 
virtual void SetPerformSurfaceCleaning (bool _arg)
 Enable/Disable surface cleaning and small object removal. More...
 
virtual bool GetPerformSurfaceCleaning () const
 Returns true if surface cleaning is enabled. More...
 
virtual void SetSurfaceCleaningThreshold (int _arg)
 Sets the number threshold for small object removal. More...
 
virtual int GetSurfaceCleaningThreshold () const
 Returns the threshold for small object removal. More...
 
template<class T1 , class T2 , class T3 >
void mitkVtkLinearTransformPoint (T1 matrix[4][4], T2 in[3], T3 out[3])
 Transforms a point by a 4x4 matrix. More...
 

Protected Member Functions

 ImageToSurfaceFilter ()
 Default Constructor. More...
 
virtual ~ImageToSurfaceFilter ()
 Destructor. More...
 
void CreateSurface (mitk::Image *image, mitk::Surface *surface)
 
void VTKSurfaceExtraction (mitk::Image *image, vtkSmartPointer< vtkPolyData > vtkSurface)
 Creates a surface using the VTK Marching Cubes method. More...
 
void CMC33SurfaceExtraction (mitk::Image *inputImage, MeshData *meshData)
 Creates a surface using the Corrected Marching Cubes 33 method (C-MC33) More...
 
void MeshSmoothing (MeshData *meshData)
 Performs smoothing of the triangle mesh with the previously selected method (SurfaceSmoothingType) More...
 
void SurfaceSmoothingVTK (vtkSmartPointer< vtkPolyData > vtkSurface)
 Performs smoothing of the triangle mesh with the VTK smoothing method. More...
 
void ComputeSmoothNormals (MeshData *meshData)
 Computes smooth (interpolated) normals for the surface. More...
 
void EditSurface (MeshData *meshData, bool recomputeNormals, bool flipNormals, bool reorientFaces, bool fixCracks)
 Utility function for a. Flipping Normals b. Reorienting Faces c. Fixing Cracks. More...
 
vtkSmartPointer< vtkPolyData > BuildVTKPolyData (MeshData *meshData)
 Creates a VTK Polydata structure from the set of provided vertices and triangles. More...
 

Protected Attributes

mitk::ScalarType m_Threshold
 
SurfaceExtractionMethod m_SurfaceExtractionType
 
InputSmoothingMethod m_InputSmoothingType
 
bool m_PerformInputSmoothing
 
int m_InputSmoothingIterations
 
float m_InputSmoothingRadius
 
SurfaceSmoothingMethod m_SurfaceSmoothingType
 
bool m_PerformSurfaceSmoothing
 
int m_SurfaceSmoothingIterations
 
float m_SurfaceSmoothingRadius
 
SurfaceDecimationMethod m_SurfaceDecimationType
 
bool m_PerformSurfaceDecimation
 
double m_TargetReduction
 
bool m_PerformSurfaceCleaning
 
int m_SurfaceCleaningThreshold
 
bool m_VTKNormalCompute
 
bool m_FlipNormals
 
double m_SamplingRatio
 

Detailed Description

Converts pixel data to surface data by using a threshold The mitkNifTKImageToSurfaceFilter is used to create a new surface out of an mitk image. The filter uses a threshold to define the surface. It can use two algorithms for the extraction: the vtkMarchingCube algorithm (default) and the Corrected Marching Cubes 33 method: Custodio, Lis, et al. "Practical considerations on Marching Cubes 33 topological correctness." Computers & Graphics 37.7 (2013): 840-850.

By default a vtkPolyData surface based on an input threshold for the input image will be created. Optionally it is possible to:

The resulting vtk-surface has the same size as the input image.

Member Enumeration Documentation

Enumerator
NoInputSmoothing 
GaussianSmoothing 
MedianSmoothing 
Enumerator
NoDecimation 
DecimatePro 
QuadricVTK 
Quadric 
QuadricTri 
Melax 
ShortestEdge 
Enumerator
StandardExtractor 
EnhancedCPUExtractor 
GPUExtractor 
Enumerator
NoSurfaceSmoothing 
TaubinSmoothing 
CurvatureNormalSmooth 
InverseEdgeLengthSmooth 
WindowedSincSmoothing 
StandardVTKSmoothing 

Constructor & Destructor Documentation

niftk::ImageToSurfaceFilter::ImageToSurfaceFilter ( )
protected

Default Constructor.

niftk::ImageToSurfaceFilter::~ImageToSurfaceFilter ( )
protectedvirtual

Destructor.

Member Function Documentation

vtkSmartPointer< vtkPolyData > niftk::ImageToSurfaceFilter::BuildVTKPolyData ( MeshData meshData)
protected

Creates a VTK Polydata structure from the set of provided vertices and triangles.

void niftk::ImageToSurfaceFilter::CMC33SurfaceExtraction ( mitk::Image *  inputImage,
MeshData meshData 
)
protected

Creates a surface using the Corrected Marching Cubes 33 method (C-MC33)

void niftk::ImageToSurfaceFilter::ComputeSmoothNormals ( MeshData meshData)
protected

Computes smooth (interpolated) normals for the surface.

void niftk::ImageToSurfaceFilter::CreateSurface ( mitk::Image *  image,
mitk::Surface *  surface 
)
protected

With the given threshold vtkMarchingCube creates the surface. By default a vtkPolyData surface based on a threshold of the input image will be created. Optionally it is possible to reduce the number of triangles/polygones [SetDecimate(mitk::NifTKImageToSurfaceFilter::DecimatePro) and SetTargetReduction (float _arg)] or smooth the data [SetSmooth(true), SetSmoothingIteration(int smoothIteration) and SetSmoothRelaxation(float smoothRelaxation)].

Parameters
timeselected slice or "0" for single
*mitk::Imageinput image
*mitk::Surfaceoutput
thresholdcan be different from SetThreshold()
void niftk::ImageToSurfaceFilter::EditSurface ( MeshData meshData,
bool  recomputeNormals,
bool  flipNormals,
bool  reorientFaces,
bool  fixCracks 
)
protected

Utility function for a. Flipping Normals b. Reorienting Faces c. Fixing Cracks.

void niftk::ImageToSurfaceFilter::GenerateData ( void  )
overridevirtual

For each image time slice a surface will be created. This method is called by Update().

void niftk::ImageToSurfaceFilter::GenerateOutputInformation ( void  )
overridevirtual

Initializes the output information ( i.e. the geometry information ) of the output of the filter.

const mitk::Image * niftk::ImageToSurfaceFilter::GetInput ( void  )

Returns a const reference to the input image (e.g. the original input image that ist used to create the surface)

virtual int niftk::ImageToSurfaceFilter::GetInputSmoothingIterations ( ) const
virtual

Returns the number of iterations for the surface smoothing method.

virtual float niftk::ImageToSurfaceFilter::GetInputSmoothingRadius ( ) const
virtual

Returns the smoothing radius of the input image smoothing method.

virtual InputSmoothingMethod niftk::ImageToSurfaceFilter::GetInputSmoothingType ( ) const
virtual

Get the state of the input image smoothing mode.

virtual bool niftk::ImageToSurfaceFilter::GetPerformInputSmoothing ( ) const
virtual

Returns if input image smoothing is enabled.

virtual bool niftk::ImageToSurfaceFilter::GetPerformSurfaceCleaning ( ) const
virtual

Returns true if surface cleaning is enabled.

virtual bool niftk::ImageToSurfaceFilter::GetPerformSurfaceDecimation ( ) const
virtual

Returns if surface decimation is enabled.

virtual bool niftk::ImageToSurfaceFilter::GetPerformSurfaceSmoothing ( ) const
virtual

Returns if surface smoothing is enabled.

virtual double niftk::ImageToSurfaceFilter::GetSamplingRatio ( ) const
virtual

Returns the downsampling ratio.

virtual int niftk::ImageToSurfaceFilter::GetSurfaceCleaningThreshold ( ) const
virtual

Returns the threshold for small object removal.

virtual SurfaceDecimationMethod niftk::ImageToSurfaceFilter::GetSurfaceDecimationType ( ) const
virtual

Get the state of decimation mode to reduce the number of triangles in the surface represantation.

virtual SurfaceExtractionMethod niftk::ImageToSurfaceFilter::GetSurfaceExtractionType ( ) const
virtual

Get the state of the input image smoothing mode.

virtual int niftk::ImageToSurfaceFilter::GetSurfaceSmoothingIterations ( ) const
virtual

Returns the number of iterations for the input image smoothing method.

virtual float niftk::ImageToSurfaceFilter::GetSurfaceSmoothingRadius ( ) const
virtual

Returns the smoothing radius of the surface smoothing method.

virtual SurfaceSmoothingMethod niftk::ImageToSurfaceFilter::GetSurfaceSmoothingType ( ) const
virtual

Get the state of the surface smoothing mode.

virtual float niftk::ImageToSurfaceFilter::GetTargetReduction ( ) const
virtual

Returns the reduction factor as a float value.

virtual mitk::ScalarType niftk::ImageToSurfaceFilter::GetThreshold ( ) const
virtual

Get the Marching Cubes threshold value. Threshold can be manipulated by inherited classes.

void niftk::ImageToSurfaceFilter::MeshSmoothing ( MeshData meshData)
protected

Performs smoothing of the triangle mesh with the previously selected method (SurfaceSmoothingType)

niftk::ImageToSurfaceFilter::mitkClassMacro ( ImageToSurfaceFilter  ,
SurfaceSource   
)
template<class T1 , class T2 , class T3 >
void niftk::ImageToSurfaceFilter::mitkVtkLinearTransformPoint ( T1  matrix[4][4],
T2  in[3],
T3  out[3] 
)
inline

Transforms a point by a 4x4 matrix.

virtual void niftk::ImageToSurfaceFilter::PerformInputSmoothingOff ( )
virtual
virtual void niftk::ImageToSurfaceFilter::PerformInputSmoothingOn ( )
virtual

Enable/Disable input image smoothing.

virtual void niftk::ImageToSurfaceFilter::PerformSurfaceDecimationOff ( )
virtual
virtual void niftk::ImageToSurfaceFilter::PerformSurfaceDecimationOn ( )
virtual

Enable/Disable surface decimation.

virtual void niftk::ImageToSurfaceFilter::PerformSurfaceSmoothingOff ( )
virtual
virtual void niftk::ImageToSurfaceFilter::PerformSurfaceSmoothingOn ( )
virtual

Enable/Disable surface smoothing.

void niftk::ImageToSurfaceFilter::SetInput ( const mitk::Image *  image)
virtual
virtual void niftk::ImageToSurfaceFilter::SetInputSmoothingIterations ( int  _arg)
virtual

Sets the number of iterations for the surface smoothing method.

virtual void niftk::ImageToSurfaceFilter::SetInputSmoothingRadius ( float  _arg)
virtual

Sets the smoothing radius of the input image smoothing method.

virtual void niftk::ImageToSurfaceFilter::SetInputSmoothingType ( InputSmoothingMethod  _arg)
virtual

Sets the input image smoothing mode (Gaussian / Median)

virtual void niftk::ImageToSurfaceFilter::SetPerformInputSmoothing ( bool  _arg)
virtual

Enables input image smoothing. The preferred method can be specified, along with the radius.

virtual void niftk::ImageToSurfaceFilter::SetPerformSurfaceCleaning ( bool  _arg)
virtual

Enable/Disable surface cleaning and small object removal.

virtual void niftk::ImageToSurfaceFilter::SetPerformSurfaceDecimation ( bool  _arg)
virtual

Enables surface decimation. The preferred method can be specified, along with the radius.

virtual void niftk::ImageToSurfaceFilter::SetPerformSurfaceSmoothing ( bool  _arg)
virtual

Enables surface smoothing. The preferred method can be specified, along with the parameters.

virtual void niftk::ImageToSurfaceFilter::SetSamplingRatio ( double  _arg)
virtual

Set desired downsampling ratio that is applied to the image before surface extraction.

virtual void niftk::ImageToSurfaceFilter::SetSurfaceCleaningThreshold ( int  _arg)
virtual

Sets the number threshold for small object removal.

virtual void niftk::ImageToSurfaceFilter::SetSurfaceDecimationType ( SurfaceDecimationMethod  _arg)
virtual

Sets the surface decimation method to reduce the number of triangles in the mesh and produce a good approximation to the original image.

virtual void niftk::ImageToSurfaceFilter::SetSurfaceExtractionType ( SurfaceExtractionMethod  _arg)
virtual

Sets the input image smoothing mode (Gaussian / Median)

virtual void niftk::ImageToSurfaceFilter::SetSurfaceSmoothingIterations ( int  _arg)
virtual

Sets the number of iterations for the input image smoothing method.

virtual void niftk::ImageToSurfaceFilter::SetSurfaceSmoothingRadius ( float  _arg)
virtual

Sets the smoothing radius of the surface smoothing method.

virtual void niftk::ImageToSurfaceFilter::SetSurfaceSmoothingType ( SurfaceSmoothingMethod  _arg)
virtual

Sets the surface smoothing mode (Laplacian / Taubin)

virtual void niftk::ImageToSurfaceFilter::SetTargetReduction ( float  _arg)
virtual

Set desired amount of reduction of triangles in the range from 0.0 to 1.0. For example 0.9 will reduce the data set to 10%.

virtual void niftk::ImageToSurfaceFilter::SetThreshold ( mitk::ScalarType  _arg)
virtual

Set the Marching Cubes threshold value. Threshold can be manipulated by inherited classes.

Threshold that is used to create the surface. All pixel in the input image that are higher than that value will be considered in the surface. The threshold referees to vtkMarchingCube. Default value is 1. See also SetThreshold (ScalarType _arg)

void niftk::ImageToSurfaceFilter::SurfaceSmoothingVTK ( vtkSmartPointer< vtkPolyData >  vtkSurface)
protected

Performs smoothing of the triangle mesh with the VTK smoothing method.

void niftk::ImageToSurfaceFilter::VTKSurfaceExtraction ( mitk::Image *  image,
vtkSmartPointer< vtkPolyData >  vtkSurface 
)
protected

Creates a surface using the VTK Marching Cubes method.

Member Data Documentation

bool niftk::ImageToSurfaceFilter::m_FlipNormals
protected
int niftk::ImageToSurfaceFilter::m_InputSmoothingIterations
protected
float niftk::ImageToSurfaceFilter::m_InputSmoothingRadius
protected
InputSmoothingMethod niftk::ImageToSurfaceFilter::m_InputSmoothingType
protected
bool niftk::ImageToSurfaceFilter::m_PerformInputSmoothing
protected
bool niftk::ImageToSurfaceFilter::m_PerformSurfaceCleaning
protected
bool niftk::ImageToSurfaceFilter::m_PerformSurfaceDecimation
protected
bool niftk::ImageToSurfaceFilter::m_PerformSurfaceSmoothing
protected
double niftk::ImageToSurfaceFilter::m_SamplingRatio
protected
int niftk::ImageToSurfaceFilter::m_SurfaceCleaningThreshold
protected
SurfaceDecimationMethod niftk::ImageToSurfaceFilter::m_SurfaceDecimationType
protected
SurfaceExtractionMethod niftk::ImageToSurfaceFilter::m_SurfaceExtractionType
protected
int niftk::ImageToSurfaceFilter::m_SurfaceSmoothingIterations
protected
float niftk::ImageToSurfaceFilter::m_SurfaceSmoothingRadius
protected
SurfaceSmoothingMethod niftk::ImageToSurfaceFilter::m_SurfaceSmoothingType
protected
double niftk::ImageToSurfaceFilter::m_TargetReduction
protected
mitk::ScalarType niftk::ImageToSurfaceFilter::m_Threshold
protected

Threshold that is used to create the surface. All pixel in the input image that are higher than that value will be considered in the surface. Default value is 1. See also SetThreshold (ScalarType _arg)

bool niftk::ImageToSurfaceFilter::m_VTKNormalCompute
protected

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