Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _MITKIMAGETOSURFACEFILTER_h__
18 #define _MITKIMAGETOSURFACEFILTER_h__
19 
20 #include "MitkCoreExports.h"
21 #include <mitkCommon.h>
22 #include <mitkSurface.h>
23 #include <mitkSurfaceSource.h>
24 #include <vtkPolyData.h>
25 
26 #include <mitkImage.h>
27 #include <vtkImageData.h>
28 
29 #include <vtkMarchingCubes.h>
30 #include <vtkSmoothPolyDataFilter.h>
31 
32 namespace mitk
33 {
55  {
56  public:
57  /*
58  * To decide whether a reduction of polygons in the created surface shall be
59  * done or not by using the vtkDecimatePro Filter. Till vtk 4.x an vtkDecimateFilter existed,
60  * but was patented. So since vtk 5.x it was replaced by the (worser?) vtkDecimateProFilter
61  * Maybe another Filter will come soon.
62  */
64  {
67  QuadricDecimation
68  };
69 
71  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
72 
78  virtual void GenerateData() override;
79 
84  virtual void GenerateOutputInformation() override;
85 
89  const mitk::Image *GetInput(void);
90 
95  using itk::ProcessObject::SetInput;
96  virtual void SetInput(const mitk::Image *image);
97 
106  void SetSmoothIteration(int smoothIteration);
107 
117  void SetSmoothRelaxation(float smoothRelaxation);
118 
124  itkSetMacro(Threshold, ScalarType);
125 
130  itkGetConstMacro(Threshold, ScalarType);
131 
137  itkSetMacro(Smooth, bool);
138 
139  /*
140  * Enable/Disable surface smoothing.
141  */
142  itkBooleanMacro(Smooth);
143 
144  /*
145  * Returns if surface smoothing is enabled
146  */
147  itkGetConstMacro(Smooth, bool);
148 
154  itkGetConstMacro(Decimate, DecimationType);
155 
162  itkSetMacro(Decimate, DecimationType);
163 
171  itkSetMacro(TargetReduction, float);
172 
176  itkGetConstMacro(TargetReduction, float);
177 
181  template <class T1, class T2, class T3>
182  inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
183  {
184  T3 x = matrix[0][0] * in[0] + matrix[0][1] * in[1] + matrix[0][2] * in[2] + matrix[0][3];
185  T3 y = matrix[1][0] * in[0] + matrix[1][1] * in[1] + matrix[1][2] * in[2] + matrix[1][3];
186  T3 z = matrix[2][0] * in[0] + matrix[2][1] * in[1] + matrix[2][2] * in[2] + matrix[2][3];
187  out[0] = x;
188  out[1] = y;
189  out[2] = z;
190  }
191 
192  protected:
194 
198  virtual ~ImageToSurfaceFilter();
199 
214  void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold);
215 
219  bool m_Smooth;
220 
225 
231 
236 
242 
248  };
249 
250 } // namespace mitk
251 
252 #endif //_MITKIMAGETOSURFACEFILTER_h__
Superclass of all classes generating surfaces (instances of class Surface) as output.
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
#define MITKCORE_EXPORT
double ScalarType
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Image class for storing images.
Definition: mitkImage.h:76
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...