itkDifferenceImageFilter.h
Go to the documentation of this file.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 itkGetConstMacro(ToleranceRadius, int);
00074
00077 itkSetMacro(DifferenceThreshold, OutputPixelType);
00078 itkGetConstMacro(DifferenceThreshold, OutputPixelType);
00080
00084 itkSetMacro(IgnoreBoundaryPixels, bool);
00085 itkGetConstMacro(IgnoreBoundaryPixels, bool);
00087
00089 itkGetConstMacro(MeanDifference, RealType);
00090 itkGetConstMacro(TotalDifference, AccumulateType);
00091 itkGetConstMacro(NumberOfPixelsWithDifferences, unsigned long);
00093
00094 protected:
00095 DifferenceImageFilter();
00096 virtual ~DifferenceImageFilter() {}
00097
00098 void PrintSelf(std::ostream& os, Indent indent) const;
00099
00111 void ThreadedGenerateData(const OutputImageRegionType& threadRegion,
00112 int threadId);
00113
00114 void BeforeThreadedGenerateData();
00115 void AfterThreadedGenerateData();
00116
00117 OutputPixelType m_DifferenceThreshold;
00118 RealType m_MeanDifference;
00119 AccumulateType m_TotalDifference;
00120 unsigned long m_NumberOfPixelsWithDifferences;
00121 int m_ToleranceRadius;
00122
00123 Array<AccumulateType> m_ThreadDifferenceSum;
00124 Array<unsigned long> m_ThreadNumberOfPixels;
00125
00126 private:
00127 DifferenceImageFilter(const Self&);
00128 void operator=(const Self&);
00129
00130 bool m_IgnoreBoundaryPixels;
00131 };
00132
00133 }
00134
00135
00136 #define ITK_TEMPLATE_DifferenceImageFilter(_, EXPORT, x, y) namespace itk { \
00137 _(2(class EXPORT DifferenceImageFilter< ITK_TEMPLATE_2 x >)) \
00138 namespace Templates { typedef DifferenceImageFilter< ITK_TEMPLATE_2 x > \
00139 DifferenceImageFilter##y; } \
00140 }
00141
00142 #if ITK_TEMPLATE_EXPLICIT
00143 # include "Templates/itkDifferenceImageFilter+-.h"
00144 #endif
00145
00146 #if ITK_TEMPLATE_TXX
00147 # include "itkDifferenceImageFilter.txx"
00148 #endif
00149
00150 #endif
00151