Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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:
53  /*
54  * To decide whether a reduction of polygons in the created surface shall be
55  * done or not by using the vtkDecimatePro Filter. Till vtk 4.x an vtkDecimateFilter existed,
56  * but was patented. So since vtk 5.x it was replaced by the (much worse?) vtkDecimateProFilter
57  * Maybe another Filter will come soon.
58  */
60  {
63  QuadricDecimation
64  };
65 
67  itkFactorylessNewMacro(Self);
68  itkCloneMacro(Self);
69 
75  void GenerateData() override;
76 
81  void GenerateOutputInformation() override;
82 
86  const mitk::Image *GetInput(void);
87 
92  using itk::ProcessObject::SetInput;
93  virtual void SetInput(const mitk::Image *image);
94 
103  void SetSmoothIteration(int smoothIteration);
104 
114  void SetSmoothRelaxation(float smoothRelaxation);
115 
121  itkSetMacro(Threshold, ScalarType);
122 
127  itkGetConstMacro(Threshold, ScalarType);
128 
134  itkSetMacro(Smooth, bool);
135 
136  /*
137  * Enable/Disable surface smoothing.
138  */
139  itkBooleanMacro(Smooth);
140 
141  /*
142  * Returns if surface smoothing is enabled
143  */
144  itkGetConstMacro(Smooth, bool);
145 
151  itkGetConstMacro(Decimate, DecimationType);
152 
159  itkSetMacro(Decimate, DecimationType);
160 
166  itkSetMacro(TargetReduction, float);
167 
171  itkGetConstMacro(TargetReduction, float);
172 
176  template <class T1, class T2, class T3>
177  inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
178  {
179  T3 x = matrix[0][0] * in[0] + matrix[0][1] * in[1] + matrix[0][2] * in[2] + matrix[0][3];
180  T3 y = matrix[1][0] * in[0] + matrix[1][1] * in[1] + matrix[1][2] * in[2] + matrix[1][3];
181  T3 z = matrix[2][0] * in[0] + matrix[2][1] * in[1] + matrix[2][2] * in[2] + matrix[2][3];
182  out[0] = x;
183  out[1] = y;
184  out[2] = z;
185  }
186 
187  protected:
189 
193  ~ImageToSurfaceFilter() override;
194 
209  void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold);
210 
214  bool m_Smooth;
215 
220 
226 
231 
237 
243  };
244 
245 } // namespace mitk
246 
247 #endif
mitk::ImageToSurfaceFilter::DecimatePro
@ DecimatePro
Definition: mitkImageToSurfaceFilter.h:62
mitk::ImageToSurfaceFilter::m_Decimate
DecimationType m_Decimate
Definition: mitkImageToSurfaceFilter.h:219
mitkSurfaceSource.h
mitk::ImageToSurfaceFilter::mitkVtkLinearTransformPoint
void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
Definition: mitkImageToSurfaceFilter.h:177
mitkImage.h
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
mitk::Surface
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkSurface.h
mitk::ImageToSurfaceFilter::m_Smooth
bool m_Smooth
Definition: mitkImageToSurfaceFilter.h:214
mitk::ImageToSurfaceFilter::m_SmoothIteration
int m_SmoothIteration
Definition: mitkImageToSurfaceFilter.h:236
mitk::BaseDataSource
Superclass of all classes generating some kind of mitk::BaseData.
Definition: mitkBaseDataSource.h:71
mitk::ImageToSurfaceFilter::DecimationType
DecimationType
Definition: mitkImageToSurfaceFilter.h:59
MitkCoreExports.h
mitkCommon.h
mitk::ImageToSurfaceFilter::m_SmoothRelaxation
float m_SmoothRelaxation
Definition: mitkImageToSurfaceFilter.h:242
mitk::ImageToSurfaceFilter
Converts pixel data to surface data by using a threshold The mitkImageToSurfaceFilter is used to crea...
Definition: mitkImageToSurfaceFilter.h:50
mitk::SurfaceSource
Superclass of all classes generating surfaces (instances of class Surface) as output.
Definition: mitkSurfaceSource.h:33
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::ImageToSurfaceFilter::m_Threshold
ScalarType m_Threshold
Definition: mitkImageToSurfaceFilter.h:225
mitk::ImageToSurfaceFilter::NoDecimation
@ NoDecimation
Definition: mitkImageToSurfaceFilter.h:61
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::ImageToSurfaceFilter::m_TargetReduction
float m_TargetReduction
Definition: mitkImageToSurfaceFilter.h:230
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20