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);
00085
00086 protected:
00087 DifferenceImageFilter();
00088 virtual ~DifferenceImageFilter() {}
00089
00090 void PrintSelf(std::ostream& os, Indent indent) const;
00091
00103 void ThreadedGenerateData(const OutputImageRegionType& threadRegion,
00104 int threadId);
00105
00106 void BeforeThreadedGenerateData();
00107 void AfterThreadedGenerateData();
00108
00109 OutputPixelType m_DifferenceThreshold;
00110 RealType m_MeanDifference;
00111 AccumulateType m_TotalDifference;
00112 int m_ToleranceRadius;
00113
00114 Array<AccumulateType> m_ThreadDifferenceSum;
00115
00116 private:
00117 DifferenceImageFilter(const Self&);
00118 void operator=(const Self&);
00119 };
00120
00121 }
00122
00123 #ifndef ITK_MANUAL_INSTANTIATION
00124 #include "itkDifferenceImageFilter.txx"
00125 #endif
00126
00127 #endif
00128