00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkDifferenceImageFilter_h
00018 #define __itkDifferenceImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkNumericTraits.h"
00022 #include "itkArray.h"
00023
00024 namespace itk
00025 {
00026
00038 template <class TInputImage, class TOutputImage>
00039 class ITK_EXPORT DifferenceImageFilter :
00040 public ImageToImageFilter<TInputImage, TOutputImage>
00041 {
00042 public:
00044 typedef DifferenceImageFilter Self;
00045 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00046 typedef SmartPointer<Self> Pointer;
00047 typedef SmartPointer<const Self> ConstPointer;
00048
00050 itkNewMacro(Self);
00051
00053 itkTypeMacro(DifferenceImageFilter, ImageToImageFilter);
00054
00056 typedef TInputImage InputImageType;
00057 typedef TOutputImage OutputImageType;
00058 typedef typename OutputImageType::PixelType OutputPixelType;
00059 typedef typename OutputImageType::RegionType OutputImageRegionType;
00060 typedef typename NumericTraits<OutputPixelType>::RealType RealType;
00061 typedef typename NumericTraits<RealType>::AccumulateType AccumulateType;
00062
00064 virtual void SetValidInput(const InputImageType* validImage);
00065
00067 virtual void SetTestInput(const InputImageType* testImage);
00068
00071 itkSetMacro(ToleranceRadius, int);
00072 itkGetMacro(ToleranceRadius, int);
00074
00077 itkSetMacro(DifferenceThreshold, OutputPixelType);
00078 itkGetMacro(DifferenceThreshold, OutputPixelType);
00080
00082 itkGetMacro(MeanDifference, RealType);
00083 itkGetMacro(TotalDifference, AccumulateType);
00084 itkGetMacro(NumberOfPixelsWithDifferences, unsigned long);
00086
00087 protected:
00088 DifferenceImageFilter();
00089 virtual ~DifferenceImageFilter() {}
00090
00091 void PrintSelf(std::ostream& os, Indent indent) const;
00092
00104 void ThreadedGenerateData(const OutputImageRegionType& threadRegion,
00105 int threadId);
00106
00107 void BeforeThreadedGenerateData();
00108 void AfterThreadedGenerateData();
00109
00110 OutputPixelType m_DifferenceThreshold;
00111 RealType m_MeanDifference;
00112 AccumulateType m_TotalDifference;
00113 unsigned long m_NumberOfPixelsWithDifferences;
00114 int m_ToleranceRadius;
00115
00116 Array<AccumulateType> m_ThreadDifferenceSum;
00117 Array<unsigned long> m_ThreadNumberOfPixels;
00118
00119 private:
00120 DifferenceImageFilter(const Self&);
00121 void operator=(const Self&);
00122 };
00123
00124 }
00125
00126
00127 #define ITK_TEMPLATE_DifferenceImageFilter(_, EXPORT, x, y) namespace itk { \
00128 _(2(class EXPORT DifferenceImageFilter< ITK_TEMPLATE_2 x >)) \
00129 namespace Templates { typedef DifferenceImageFilter< ITK_TEMPLATE_2 x > \
00130 DifferenceImageFilter##y; } \
00131 }
00132
00133 #if ITK_TEMPLATE_EXPLICIT
00134 # include "Templates/itkDifferenceImageFilter+-.h"
00135 #endif
00136
00137 #if ITK_TEMPLATE_TXX
00138 # include "itkDifferenceImageFilter.txx"
00139 #endif
00140
00141 #endif
00142