Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MITKIMAGETOSURFACEFILTER_h__
00019 #define _MITKIMAGETOSURFACEFILTER_h__
00020
00021 #include <vtkPolyData.h>
00022 #include "MitkExtExports.h"
00023 #include <mitkCommon.h>
00024 #include <mitkSurfaceSource.h>
00025 #include <mitkSurface.h>
00026
00027 #include <mitkImage.h>
00028 #include <vtkImageData.h>
00029
00030 #include <vtkSmoothPolyDataFilter.h>
00031 #include <vtkMarchingCubes.h>
00032
00033
00034 namespace mitk {
00053 class MitkExt_EXPORT ImageToSurfaceFilter : public SurfaceSource
00054 {
00055 public:
00056
00057
00058
00059
00060
00061
00062
00063 enum DecimationType {NoDecimation,DecimatePro};
00064
00065 mitkClassMacro(ImageToSurfaceFilter, SurfaceSource);
00066 itkNewMacro(Self);
00067
00073 virtual void GenerateData();
00074
00079 virtual void GenerateOutputInformation();
00080
00084 const mitk::Image *GetInput(void);
00085
00090 virtual void SetInput(const mitk::Image *image);
00091
00097 void SetSmoothIteration(int smoothIteration);
00098
00106 void SetSmoothRelaxation(float smoothRelaxation);
00107
00108
00114 itkSetMacro(Threshold, ScalarType);
00115
00120 itkGetConstMacro(Threshold, ScalarType);
00121
00127 itkSetMacro(Smooth,bool);
00128
00129
00130
00131
00132 itkBooleanMacro(Smooth);
00133
00134
00135
00136
00137 itkGetConstMacro(Smooth,bool);
00138
00144 itkGetConstMacro(Decimate,DecimationType);
00145
00152 itkSetMacro(Decimate,DecimationType);
00153
00161 itkSetMacro(TargetReduction, float);
00162
00166 itkGetConstMacro(TargetReduction, float);
00167
00171 template <class T1, class T2, class T3>
00172 inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
00173 {
00174 T3 x = matrix[0][0]*in[0]+matrix[0][1]*in[1]+matrix[0][2]*in[2]+matrix[0][3];
00175 T3 y = matrix[1][0]*in[0]+matrix[1][1]*in[1]+matrix[1][2]*in[2]+matrix[1][3];
00176 T3 z = matrix[2][0]*in[0]+matrix[2][1]*in[1]+matrix[2][2]*in[2]+matrix[2][3];
00177 out[0] = x;
00178 out[1] = y;
00179 out[2] = z;
00180 }
00181
00182 protected:
00183
00184
00185 ImageToSurfaceFilter();
00186
00190 virtual ~ImageToSurfaceFilter();
00191
00203 void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface * surface, const ScalarType threshold);
00204
00208 bool m_Smooth;
00209
00213 DecimationType m_Decimate;
00214
00219 ScalarType m_Threshold;
00220
00224 float m_TargetReduction;
00225
00229 int m_SmoothIteration;
00230
00234 float m_SmoothRelaxation;
00235
00236 };
00237
00238 }
00239
00240 #endif //_MITKIMAGETOSURFACEFILTER_h__
00241
00242