Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::ImageToSurfaceFilter Class Reference

Converts pixel data to surface data by using a threshold. More...

#include <mitkImageToSurfaceFilter.h>

Inheritance diagram for mitk::ImageToSurfaceFilter:
Collaboration diagram for mitk::ImageToSurfaceFilter:

Public Types

enum  DecimationType { NoDecimation , DecimatePro , QuadricDecimation }
 Enumeration of available polygon decimation strategies. More...
 
- Public Types inherited from mitk::SurfaceSource
typedef Surface OutputType
 
- Public Types inherited from mitk::BaseDataSource
typedef BaseData OutputType
 Output data type. More...
 
typedef itk::DataObject::DataObjectIdentifierType DataObjectIdentifierType
 Identifier type for named data objects. More...
 

Public Member Functions

 mitkClassMacro (ImageToSurfaceFilter, SurfaceSource)
 
Pointer Clone () const
 
void GenerateData () override
 
void GenerateOutputInformation () override
 
const mitk::Image * GetInput (void)
 
virtual void SetInput (const mitk::Image *image)
 
void SetSmoothIteration (int smoothIteration)
 Set the number of iterations used to smooth the surface. More...
 
void SetSmoothRelaxation (float smoothRelaxation)
 Set the relaxation factor for Laplacian smoothing. More...
 
virtual void SetThreshold (ScalarType _arg)
 Set the threshold used for surface extraction via vtkMarchingCubes. More...
 
virtual ScalarType GetThreshold () const
 Get the threshold used for vtkMarchingCubes surface extraction. More...
 
virtual void SetSmooth (bool _arg)
 Enable vtkSmoothPolyDataFilter for Laplacian smoothing. More...
 
virtual void SmoothOn ()
 Toggle surface smoothing on/off. More...
 
virtual void SmoothOff ()
 
virtual bool GetSmooth () const
 Get whether surface smoothing is enabled. More...
 
virtual DecimationType GetDecimate () const
 Get the current decimation mode. More...
 
virtual void SetDecimate (DecimationType _arg)
 Set the decimation mode to reduce the number of triangles in the mesh. More...
 
virtual void SetTargetReduction (float _arg)
 Set the desired target reduction of triangles in the range [0.0, 1.0]. More...
 
virtual float GetTargetReduction () const
 Get the target reduction factor for the decimation filter. More...
 
template<class T1 , class T2 , class T3 >
void mitkVtkLinearTransformPoint (T1 matrix[4][4], T2 in[3], T3 out[3])
 Transform a 3D point by a 4x4 matrix (affine transformation). More...
 
- Public Member Functions inherited from mitk::SurfaceSource
 mitkClassMacro (SurfaceSource, BaseDataSource)
 
Pointer Clone () const
 
mitkBaseDataSourceGetOutputDeclarations itk::DataObject::Pointer MakeOutput (DataObjectPointerArraySizeType idx) override
 Allocate a new output object and return it. More...
 
itk::DataObject::Pointer MakeOutput (const DataObjectIdentifierType &name) override
 Allocate a new output object by name. More...
 
- Public Member Functions inherited from mitk::BaseDataSource
 mitkClassMacroItkParent (BaseDataSource, itk::ProcessObject)
 
OutputType * GetOutput ()
 
const OutputType * GetOutput () const
 
OutputType * GetOutput (DataObjectPointerArraySizeType idx)
 
const OutputType * GetOutput (DataObjectPointerArraySizeType idx) const
 
virtual void GraftOutput (OutputType *output)
 Graft the specified BaseData onto this BaseDataSource's output. More...
 
virtual void GraftOutput (const DataObjectIdentifierType &key, OutputType *output)
 Graft the specified base data object onto a named output. More...
 
virtual void GraftNthOutput (unsigned int idx, OutputType *output)
 Graft the specified base data object onto this BaseDataSource's idx'th output. More...
 
bool Updating () const
 Check whether the pipeline is currently executing. More...
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from mitk::SurfaceSource
static Pointer New ()
 

Protected Member Functions

 ImageToSurfaceFilter ()
 
 ~ImageToSurfaceFilter () override
 Destructor. More...
 
void CreateSurface (int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold)
 Create the surface for a single time step using vtkMarchingCubes. More...
 
- Protected Member Functions inherited from mitk::SurfaceSource
 SurfaceSource ()
 
 ~SurfaceSource () override
 
- Protected Member Functions inherited from mitk::BaseDataSource
 BaseDataSource ()
 Constructor. More...
 
 ~BaseDataSource () override
 Destructor. More...
 

Protected Attributes

bool m_Smooth
 Flag whether the created surface shall be smoothed (default is false). More...
 
DecimationType m_Decimate
 Decimation mode. Default is NoDecimation. More...
 
ScalarType m_Threshold
 Threshold for surface extraction. Default value is 1. More...
 
float m_TargetReduction
 The reduction factor for the decimation filter. Range [0.0, 1.0]. More...
 
int m_SmoothIteration
 The number of iterations for the smoothing filter. Default is 50. More...
 
float m_SmoothRelaxation
 The relaxation factor for the smoothing filter. Default is 0.1. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from mitk::BaseDataSource
static Pointer New ()
 

Detailed Description

Converts pixel data to surface data by using a threshold.

The mitkImageToSurfaceFilter is used to create a new surface out of an MITK image. The filter uses a threshold to define the surface. It is based on the vtkMarchingCubes algorithm. By default a vtkPolyData surface based on an input threshold for the input image will be created. Optionally it is possible to reduce the number of triangles/polygons [SetDecimate(mitk::ImageToSurfaceFilter::DecimatePro) and SetTargetReduction(float)] or smooth the surface data [SetSmooth(true), SetSmoothIteration(int) and SetSmoothRelaxation(float)].

The resulting VTK surface has the same size as the input image. The surface can be generally smoothed by vtkDecimatePro to reduce complexity of triangles and vtkSmoothPolyDataFilter to relax the mesh. It is also possible to create time-sliced surfaces.

See also
SurfaceSource
Surface

Definition at line 50 of file mitkImageToSurfaceFilter.h.

Member Enumeration Documentation

◆ DecimationType

Enumeration of available polygon decimation strategies.

Determines whether and how polygon reduction is applied to the created surface.

Enumerator
NoDecimation 
DecimatePro 
QuadricDecimation 

Definition at line 58 of file mitkImageToSurfaceFilter.h.

Constructor & Destructor Documentation

◆ ImageToSurfaceFilter()

mitk::ImageToSurfaceFilter::ImageToSurfaceFilter ( )
protected

◆ ~ImageToSurfaceFilter()

mitk::ImageToSurfaceFilter::~ImageToSurfaceFilter ( )
overrideprotected

Destructor.

Member Function Documentation

◆ Clone()

Pointer mitk::ImageToSurfaceFilter::Clone ( ) const

◆ CreateSurface()

void mitk::ImageToSurfaceFilter::CreateSurface ( int  time,
vtkImageData *  vtkimage,
mitk::Surface *  surface,
const ScalarType  threshold 
)
protected

Create the surface for a single time step using vtkMarchingCubes.

Optionally applies smoothing and decimation based on the current filter settings.

Parameters
timeThe time step to process (0 for single time step images).
vtkimageThe VTK image data input.
surfaceThe output surface to populate.
thresholdThe iso-surface threshold (can differ from the member threshold).

◆ GenerateData()

void mitk::ImageToSurfaceFilter::GenerateData ( )
override

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

◆ GenerateOutputInformation()

void mitk::ImageToSurfaceFilter::GenerateOutputInformation ( )
override

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

◆ GetDecimate()

virtual DecimationType mitk::ImageToSurfaceFilter::GetDecimate ( ) const
virtual

Get the current decimation mode.

Possible values are NoDecimation, DecimatePro, or QuadricDecimation.

◆ GetInput()

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

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

◆ GetSmooth()

virtual bool mitk::ImageToSurfaceFilter::GetSmooth ( ) const
virtual

Get whether surface smoothing is enabled.

◆ GetTargetReduction()

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

Get the target reduction factor for the decimation filter.

◆ GetThreshold()

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

Get the threshold used for vtkMarchingCubes surface extraction.

◆ mitkClassMacro()

mitk::ImageToSurfaceFilter::mitkClassMacro ( ImageToSurfaceFilter  ,
SurfaceSource   
)

◆ mitkVtkLinearTransformPoint()

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

Transform a 3D point by a 4x4 matrix (affine transformation).

Template Parameters
T1The matrix element type.
T2The input point element type.
T3The output point element type.

Definition at line 178 of file mitkImageToSurfaceFilter.h.

◆ New()

static Pointer mitk::ImageToSurfaceFilter::New ( )
static

◆ SetDecimate()

virtual void mitk::ImageToSurfaceFilter::SetDecimate ( DecimationType  _arg)
virtual

Set the decimation mode to reduce the number of triangles in the mesh.

For more detailed information see vtkDecimatePro and vtkQuadricDecimation.

◆ SetInput()

virtual void mitk::ImageToSurfaceFilter::SetInput ( const mitk::Image *  image)
virtual

◆ SetSmooth()

virtual void mitk::ImageToSurfaceFilter::SetSmooth ( bool  _arg)
virtual

Enable vtkSmoothPolyDataFilter for Laplacian smoothing.

This filter will relax the surface. You can control the filter by manipulating the number of iterations and the relaxation factor.

◆ SetSmoothIteration()

void mitk::ImageToSurfaceFilter::SetSmoothIteration ( int  smoothIteration)

Set the number of iterations used to smooth the surface.

Uses the vtkSmoothPolyDataFilter with a Laplacian filter. The higher the number of iterations, the stronger the smoothing result.

Parameters
smoothIterationThe number of smoothing iterations. Default is 50. The VTK documentation recommends small relaxation factors and large numbers of iterations.

◆ SetSmoothRelaxation()

void mitk::ImageToSurfaceFilter::SetSmoothRelaxation ( float  smoothRelaxation)

Set the relaxation factor for Laplacian smoothing.

The VTK documentation recommends small relaxation factors and large numbers of iterations.

Parameters
smoothRelaxationThe relaxation factor. Default is 0.1.

◆ SetTargetReduction()

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

Set the desired target reduction of triangles in the range [0.0, 1.0].

The destroyed triangles are relative to the total number of triangles. For example, 0.9 will reduce the data set to 10% of its original size.

◆ SetThreshold()

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

Set the threshold used for surface extraction via vtkMarchingCubes.

All pixels in the input image with values higher than this threshold will be considered in the surface. Default value is 1.

◆ SmoothOff()

virtual void mitk::ImageToSurfaceFilter::SmoothOff ( )
virtual

◆ SmoothOn()

virtual void mitk::ImageToSurfaceFilter::SmoothOn ( )
virtual

Toggle surface smoothing on/off.

Member Data Documentation

◆ m_Decimate

DecimationType mitk::ImageToSurfaceFilter::m_Decimate
protected

Decimation mode. Default is NoDecimation.

Definition at line 210 of file mitkImageToSurfaceFilter.h.

◆ m_Smooth

bool mitk::ImageToSurfaceFilter::m_Smooth
protected

Flag whether the created surface shall be smoothed (default is false).

Definition at line 207 of file mitkImageToSurfaceFilter.h.

◆ m_SmoothIteration

int mitk::ImageToSurfaceFilter::m_SmoothIteration
protected

The number of iterations for the smoothing filter. Default is 50.

Definition at line 219 of file mitkImageToSurfaceFilter.h.

◆ m_SmoothRelaxation

float mitk::ImageToSurfaceFilter::m_SmoothRelaxation
protected

The relaxation factor for the smoothing filter. Default is 0.1.

Definition at line 222 of file mitkImageToSurfaceFilter.h.

◆ m_TargetReduction

float mitk::ImageToSurfaceFilter::m_TargetReduction
protected

The reduction factor for the decimation filter. Range [0.0, 1.0].

Definition at line 216 of file mitkImageToSurfaceFilter.h.

◆ m_Threshold

ScalarType mitk::ImageToSurfaceFilter::m_Threshold
protected

Threshold for surface extraction. Default value is 1.

Definition at line 213 of file mitkImageToSurfaceFilter.h.


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