Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkImageToSurfaceFilter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkImageToSurfaceFilter_h
14 #define mitkImageToSurfaceFilter_h
15 
16 #include <MitkCoreExports.h>
17 #include <mitkCommon.h>
18 #include <mitkSurface.h>
19 #include <mitkSurfaceSource.h>
20 #include <vtkPolyData.h>
21 
22 #include <mitkImage.h>
23 #include <vtkImageData.h>
24 
25 #include <vtkMarchingCubes.h>
26 #include <vtkSmoothPolyDataFilter.h>
27 
28 namespace mitk
29 {
51  {
52  public:
59  {
62  QuadricDecimation
63  };
64 
66  itkFactorylessNewMacro(Self);
67  itkCloneMacro(Self);
68 
74  void GenerateData() override;
75 
80  void GenerateOutputInformation() override;
81 
85  const mitk::Image *GetInput(void);
86 
91  using itk::ProcessObject::SetInput;
92  virtual void SetInput(const mitk::Image *image);
93 
104  void SetSmoothIteration(int smoothIteration);
105 
114  void SetSmoothRelaxation(float smoothRelaxation);
115 
122  itkSetMacro(Threshold, ScalarType);
123 
127  itkGetConstMacro(Threshold, ScalarType);
128 
135  itkSetMacro(Smooth, bool);
136 
138  itkBooleanMacro(Smooth);
139 
141  itkGetConstMacro(Smooth, bool);
142 
148  itkGetConstMacro(Decimate, DecimationType);
149 
155  itkSetMacro(Decimate, DecimationType);
156 
163  itkSetMacro(TargetReduction, float);
164 
168  itkGetConstMacro(TargetReduction, float);
169 
177  template <class T1, class T2, class T3>
178  inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
179  {
180  T3 x = matrix[0][0] * in[0] + matrix[0][1] * in[1] + matrix[0][2] * in[2] + matrix[0][3];
181  T3 y = matrix[1][0] * in[0] + matrix[1][1] * in[1] + matrix[1][2] * in[2] + matrix[1][3];
182  T3 z = matrix[2][0] * in[0] + matrix[2][1] * in[1] + matrix[2][2] * in[2] + matrix[2][3];
183  out[0] = x;
184  out[1] = y;
185  out[2] = z;
186  }
187 
188  protected:
190 
193 
204  void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold);
205 
207  bool m_Smooth;
208 
211 
214 
217 
220 
223  };
224 
225 } // namespace mitk
226 
227 #endif
#define MITKCORE_EXPORT
Converts pixel data to surface data by using a threshold.
int m_SmoothIteration
The number of iterations for the smoothing filter. Default is 50.
mitkClassMacro(ImageToSurfaceFilter, SurfaceSource)
float m_SmoothRelaxation
The relaxation factor for the smoothing filter. Default is 0.1.
const mitk::Image * GetInput(void)
bool m_Smooth
Flag whether the created surface shall be smoothed (default is false).
DecimationType m_Decimate
Decimation mode. Default is NoDecimation.
void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold)
Create the surface for a single time step using vtkMarchingCubes.
virtual void SetInput(const mitk::Image *image)
void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
Transform a 3D point by a 4x4 matrix (affine transformation).
~ImageToSurfaceFilter() override
Destructor.
float m_TargetReduction
The reduction factor for the decimation filter. Range [0.0, 1.0].
void SetSmoothRelaxation(float smoothRelaxation)
Set the relaxation factor for Laplacian smoothing.
void GenerateOutputInformation() override
void SetSmoothIteration(int smoothIteration)
Set the number of iterations used to smooth the surface.
DecimationType
Enumeration of available polygon decimation strategies.
ScalarType m_Threshold
Threshold for surface extraction. Default value is 1.
void GenerateData() override
Image class for storing multi-dimensional medical image data.
Definition: mitkImage.h:76
Superclass of all classes generating surfaces (instances of class Surface) as output.
Data class for storing polygonal surfaces (vtkPolyData).
Definition: mitkSurface.h:37
Find image slices visible on a given plane.
double ScalarType
Scalar type used throughout MITK for geometric computations.