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
00019
00020
00021
00022 #ifndef _vtkKWEITKFilterModuleBase_h
00023 #define _vtkKWEITKFilterModuleBase_h
00024
00025 #include "VTKEdgeConfigure.h"
00026 #include "itkCommand.h"
00027 #include "itkProcessObject.h"
00028 #include "itkImageRegion.h"
00029 #include "itkSize.h"
00030 #include "itkIndex.h"
00031 #include "vtkSetGet.h"
00032
00033 #include <string.h>
00034 #include <stdlib.h>
00035 #include <stdio.h>
00036 #include <fstream>
00037
00038 class vtkImageData;
00039 class vtkImageStencilData;
00040
00041 #if defined(VTK_TYPE_USE___INT64)
00042 #define vtkitkTemplateMacro___INT64 \
00043 vtkTemplateMacroCase_si64(VTK___INT64, __int64, call);
00044 #else
00045 #define vtkitkTemplateMacro___INT64
00046 #endif
00047
00048 #if defined(VTK_TYPE_USE___INT64) && defined(VTK_TYPE_CONVERT_UI64_TO_DOUBLE)
00049 #define vtkitkTemplateMacro___UINT64 \
00050 vtkTemplateMacroCase_ui64(VTK_UNSIGNED___INT64, unsigned __int64, call);
00051 #else
00052 #define vtkitkTemplateMacro___UINT64
00053 #endif
00054
00055
00056
00057
00058 #define vtkitkTemplateMacro(call) \
00059 vtkTemplateMacroCase(VTK_DOUBLE, double, call); \
00060 vtkTemplateMacroCase(VTK_FLOAT, float, call); \
00061 vtkitkTemplateMacro___INT64 \
00062 vtkitkTemplateMacro___UINT64 \
00063 vtkTemplateMacroCase(VTK_LONG, long, call); \
00064 vtkTemplateMacroCase(VTK_UNSIGNED_LONG, unsigned long, call); \
00065 vtkTemplateMacroCase(VTK_INT, int, call); \
00066 vtkTemplateMacroCase(VTK_UNSIGNED_INT, unsigned int, call); \
00067 vtkTemplateMacroCase(VTK_SHORT, short, call); \
00068 vtkTemplateMacroCase(VTK_UNSIGNED_SHORT, unsigned short, call); \
00069 vtkTemplateMacroCase(VTK_CHAR, char, call); \
00070 vtkTemplateMacroCase(VTK_SIGNED_CHAR, signed char, call); \
00071 vtkTemplateMacroCase(VTK_UNSIGNED_CHAR, unsigned char, call)
00072
00073
00074 namespace vtkitk
00075 {
00076
00077 class FilterModuleBase
00078 {
00079
00080 public:
00081
00082 typedef itk::MemberCommand< FilterModuleBase > CommandType;
00083
00084
00085 typedef itk::ImageRegion<3> RegionType;
00086 typedef itk::Index<3> IndexType;
00087 typedef itk::Size<3> SizeType;
00088
00090 FilterModuleBase()
00091 {
00092 this->m_CommandObserver = CommandType::New();
00093 this->m_UpdateMessage = "Processing the filter...";
00094 this->m_CommandObserver->SetCallbackFunction( this, &FilterModuleBase::ProgressUpdate );
00095 this->m_CumulatedProgress = 0.0;
00096 this->m_CurrentFilterProgressWeight = 1.0;
00097 this->m_ProcessComponentsIndependetly = true;
00098 this->m_InternalIterationCounter = 0;
00099 }
00100
00101
00103 virtual ~FilterModuleBase()
00104 {
00105 }
00106
00107 void SetUpdateMessage( const char * message )
00108 {
00109 m_UpdateMessage = message;
00110 }
00111
00112 void InitializeProgressValue()
00113 {
00114 this->m_CumulatedProgress = 0.0;
00115 }
00116
00117
00118 void SetCumulatedProgress( float progress )
00119 {
00120 this->m_CumulatedProgress = progress;
00121 }
00122
00123
00124 void SetCurrentFilterProgressWeight( float weight )
00125 {
00126 this->m_CurrentFilterProgressWeight = weight;
00127 }
00128
00129 float GetCurrentFilterProgressWeight() const
00130 {
00131 return this->m_CurrentFilterProgressWeight;
00132 }
00133
00134
00135 void SetProcessComponentsIndependetly( bool independentProcessing )
00136 {
00137 this->m_ProcessComponentsIndependetly = independentProcessing;
00138 }
00139
00140 CommandType * GetCommandObserver()
00141 {
00142 return this->m_CommandObserver;
00143 }
00144
00145 void
00146 ProgressUpdate( itk::Object * itkNotUsed(caller),
00147 const itk::EventObject & itkNotUsed(event) )
00148 {
00149
00150 }
00151
00152 virtual void SetInput( vtkImageData * itkNotUsed(data) ) = 0;
00153 virtual vtkImageData * GetInput() = 0;
00154
00155
00156 virtual int GetOutputAsStencil( vtkImageStencilData * itkNotUsed(data) )
00157 { return 0; };
00158 virtual int GetSphereBoundedOutputAsStencil( vtkImageStencilData *
00159 itkNotUsed(data),
00160 int itkNotUsed(center)[3],
00161 double itkNotUsed(radius)[3] )
00162 { return 0; };
00163
00164
00165 virtual void SetRequestedExtent( int itkNotUsed(extent)[6] ) {};
00166
00167 private:
00168 CommandType::Pointer m_CommandObserver;
00169 std::string m_UpdateMessage;
00170 float m_CumulatedProgress;
00171 float m_CurrentFilterProgressWeight;
00172 bool m_ProcessComponentsIndependetly;
00173 unsigned int m_InternalIterationCounter;
00174 };
00175
00176 }
00177
00178 #endif
00179