Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
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 (worser?) 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 //_MITKIMAGETOSURFACEFILTER_h__
Superclass of all classes generating surfaces (instances of class Surface) as output.
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
#define MITKCORE_EXPORT
double ScalarType
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
MITKREMESHING_EXPORT Surface::Pointer Decimate(const Surface *input, double percent, bool calculateNormals=true, bool flipNormals=false)
Reduce the number of vertices of an mitk::Surface.
void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
Image class for storing images.
Definition: mitkImage.h:69
Converts pixel data to surface data by using a threshold The mitkImageToSurfaceFilter is used to crea...