Medical Imaging Interaction Toolkit  2018.4.99-08619e4f
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 
168  itkSetMacro(TargetReduction, float);
169 
173  itkGetConstMacro(TargetReduction, float);
174 
178  template <class T1, class T2, class T3>
179  inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
180  {
181  T3 x = matrix[0][0] * in[0] + matrix[0][1] * in[1] + matrix[0][2] * in[2] + matrix[0][3];
182  T3 y = matrix[1][0] * in[0] + matrix[1][1] * in[1] + matrix[1][2] * in[2] + matrix[1][3];
183  T3 z = matrix[2][0] * in[0] + matrix[2][1] * in[1] + matrix[2][2] * in[2] + matrix[2][3];
184  out[0] = x;
185  out[1] = y;
186  out[2] = z;
187  }
188 
189  protected:
191 
195  ~ImageToSurfaceFilter() override;
196 
211  void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold);
212 
216  bool m_Smooth;
217 
222 
228 
233 
239 
245  };
246 
247 } // namespace mitk
248 
249 #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.
void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Image class for storing images.
Definition: mitkImage.h:72
mitk::Image::Pointer image
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:244
Converts pixel data to surface data by using a threshold The mitkImageToSurfaceFilter is used to crea...