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
00035 template <class TInputImage, class TOutputImage>
00036 class ITK_EXPORT DifferenceImageFilter :
00037 public ImageToImageFilter<TInputImage, TOutputImage>
00038 {
00039 public:
00041 typedef DifferenceImageFilter Self;
00042 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00043 typedef SmartPointer<Self> Pointer;
00044 typedef SmartPointer<const Self> ConstPointer;
00045
00047 itkNewMacro(Self);
00048
00050 itkTypeMacro(DifferenceImageFilter, ImageToImageFilter);
00051
00053 typedef TInputImage InputImageType;
00054 typedef TOutputImage OutputImageType;
00055 typedef typename OutputImageType::PixelType OutputPixelType;
00056 typedef typename OutputImageType::RegionType OutputImageRegionType;
00057 typedef typename NumericTraits<OutputPixelType>::RealType RealType;
00058 typedef typename NumericTraits<RealType>::AccumulateType AccumulateType;
00059
00061 virtual void SetValidInput(const InputImageType* validImage);
00062
00064 virtual void SetTestInput(const InputImageType* testImage);
00065
00068 itkSetMacro(ToleranceRadius, int);
00069 itkGetMacro(ToleranceRadius, int);
00070
00073 itkSetMacro(DifferenceThreshold, OutputPixelType);
00074 itkGetMacro(DifferenceThreshold, OutputPixelType);
00075
00077 itkGetMacro(MeanDifference, RealType);
00078 itkGetMacro(TotalDifference, AccumulateType);
00079
00080 protected:
00081 DifferenceImageFilter();
00082 virtual ~DifferenceImageFilter() {}
00083
00084 void PrintSelf(std::ostream& os, Indent indent) const;
00085
00097 void ThreadedGenerateData(const OutputImageRegionType& threadRegion,
00098 int threadId);
00099
00100 void BeforeThreadedGenerateData();
00101 void AfterThreadedGenerateData();
00102
00103 OutputPixelType m_DifferenceThreshold;
00104 RealType m_MeanDifference;
00105 AccumulateType m_TotalDifference;
00106 int m_ToleranceRadius;
00107
00108 Array<AccumulateType> m_ThreadDifferenceSum;
00109
00110 private:
00111 DifferenceImageFilter(const Self&);
00112 void operator=(const Self&);
00113 };
00114
00115 }
00116
00117 #ifndef ITK_MANUAL_INSTANTIATION
00118 #include "itkDifferenceImageFilter.txx"
00119 #endif
00120
00121 #endif