00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkSubtractImageFilter_h
00012 #define __mitkSubtractImageFilter_h
00013
00014 #include "mitkVolumeToVolumeFilter.h"
00015 #include "mitkInterpolateFilter.h"
00016
00017 #define MITK_SUBSTRACT_MODE_USERDEFINED 0
00018 #define MITK_SUBSTRACT_MODE_SUB 1
00019 #define MITK_SUBSTRACT_MODE_ADD 2
00020 #define MITK_SUBSTRACT_MODE_SUBCOLOR 3
00021 #define MITK_SUBSTRACT_MODE_ADDCOLOR 4
00022 #define MITK_SUBSTRACT_MODE_CHECKERBOARD 5
00023 #define MITK_SUBSTRACT_MODE_MIN 6
00024 #define MITK_SUBSTRACT_MODE_MAX 7
00025 #define MITK_SUBSTRACT_MODE_AVERAGE 8
00026 #define MITK_SUBSTRACT_MODE_MULTIPLY 9
00027 #define MITK_SUBSTRACT_MODE_EXPLOGMULTI 10
00028 #define MITK_SUBSTRACT_MODE_DIVIDE 11
00029 #define MITK_SUBSTRACT_MODE_AND 12
00030 #define MITK_SUBSTRACT_MODE_OR 13
00031 #define MITK_SUBSTRACT_MODE_XOR 14
00032
00033
00034 #define MITK_SUBSTRACT_MODE_LOG_10 101
00035 #define MITK_SUBSTRACT_MODE_LOG_E 102
00036 #define MITK_SUBSTRACT_MODE_SQUAREROOT 103
00037 #define MITK_SUBSTRACT_MODE_SQUARED 104
00038 #define MITK_SUBSTRACT_MODE_ABS 105
00039 #define MITK_SUBSTRACT_MODE_COMPLEMENT 106
00040 #define MITK_SUBSTRACT_MODE_NOT 107
00041
00071
00072 class MITK_REGISTRATION_API mitkSubtractImageFilter : public mitkVolumeToVolumeFilter
00073 {
00074 public:
00075 MITK_TYPE(mitkSubtractImageFilter, mitkVolumeToVolumeFilter)
00076 virtual void PrintSelf(ostream &os);
00077
00082 mitkSubtractImageFilter(int mode);
00083
00087 mitkSubtractImageFilter();
00088
00093 void SetInput1(mitkVolume *inData) { m_InData = inData; }
00094
00099 void SetInput2(mitkVolume *inData) { m_InData2 = inData; }
00100
00101 void SetInterpolator(mitkInterpolateFilter* filter) { m_Interpolator = filter; }
00102
00103 mitkInterpolateFilter* GetInterpolator();
00104
00109 void SetSubtractMode(int mode) { m_SubtractMode = mode; }
00110
00111 void SetChannelMixMode(int mode) { m_ChannelMixMode = mode; }
00112
00113 void SetAdjustOutputFlag(bool f) { m_FlagAdjustOutput = f; }
00114
00119 void SetOutputDatatype(int dataType) {m_OutputDataType = dataType;}
00120
00121 void SetCheckImageDim(int row, int col, int dep=1);
00122
00123 void SetMaxOutputValue(ScalarPixelType max) { m_MaxOutputValue = max; }
00124
00125 void SetMinOutputValue(ScalarPixelType min) { m_MinOutputValue = min; }
00126
00127 void SetSubtractKernel(void (*kernel)(VectorPixelType& ip,VectorPixelType& op))
00128 {
00129 SubtractKernel1 = kernel;
00130 }
00131
00132 void SetSubtractKernel(void (*kernel)(VectorPixelType& ip1,VectorPixelType& ip2,VectorPixelType& op))
00133 {
00134 SubtractKernel2 = kernel;
00135 }
00136
00137 protected:
00138 virtual ~mitkSubtractImageFilter();
00139 virtual bool Execute();
00140 bool Update();
00141 void GenerateCheckImage();
00142 bool BindSubtractKernel();
00143 void AdjustOutput();
00144 void _init();
00145
00146 void (*SubtractKernel1)(VectorPixelType&,VectorPixelType&);
00147 void (*SubtractKernel2)(VectorPixelType&,VectorPixelType&,VectorPixelType&);
00148
00149 mitkRCPtr<mitkVolume> m_MaskImage;
00150 mitkRCPtr<mitkVolume> m_InData2;
00151 mitkRCPtr<mitkInterpolateFilter> m_Interpolator;
00152
00153 int m_SubtractMode;
00154
00155
00156 int m_ChannelMixMode;
00157 int m_OutputDataType;
00158
00159 float m_Spacings[3];
00160 int m_Dimensions[3];
00161 unsigned int m_CheckImageDim[3];
00162 unsigned int m_NumberOfChannels;
00163 unsigned int m_ImageDimension;
00164
00165 ScalarPixelType m_MinOutputValue;
00166 ScalarPixelType m_MaxOutputValue;
00167
00168 bool m_FlagNeedInterpolation;
00169 bool m_FlagAdjustOutput;
00170
00171 private:
00172 mitkSubtractImageFilter(const mitkSubtractImageFilter&);
00173 void operator = (const mitkSubtractImageFilter&);
00174
00175 };
00176
00177
00178
00179
00180
00181
00182 #endif
00183