00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBinaryFunctorImageFilter_h
00018 #define __itkBinaryFunctorImageFilter_h
00019
00020 #include "itkInPlaceImageFilter.h"
00021 #include "itkImageRegionIteratorWithIndex.h"
00022
00023 namespace itk
00024 {
00025
00037 template <class TInputImage1, class TInputImage2,
00038 class TOutputImage, class TFunction >
00039 class ITK_EXPORT BinaryFunctorImageFilter :
00040 public InPlaceImageFilter<TInputImage1,TOutputImage>
00041 {
00042 public:
00044 typedef BinaryFunctorImageFilter Self;
00045 typedef InPlaceImageFilter<TInputImage1,TOutputImage> Superclass;
00046 typedef SmartPointer<Self> Pointer;
00047 typedef SmartPointer<const Self> ConstPointer;
00048
00050 itkNewMacro(Self);
00051
00053 itkTypeMacro(BinaryFunctorImageFilter, InPlaceImageFilter);
00054
00056 typedef TFunction FunctorType;
00057 typedef TInputImage1 Input1ImageType;
00058 typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
00059 typedef typename Input1ImageType::RegionType Input1ImageRegionType;
00060 typedef typename Input1ImageType::PixelType Input1ImagePixelType;
00061 typedef TInputImage2 Input2ImageType;
00062 typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
00063 typedef typename Input2ImageType::RegionType Input2ImageRegionType;
00064 typedef typename Input2ImageType::PixelType Input2ImagePixelType;
00065 typedef TOutputImage OutputImageType;
00066 typedef typename OutputImageType::Pointer OutputImagePointer;
00067 typedef typename OutputImageType::RegionType OutputImageRegionType;
00068 typedef typename OutputImageType::PixelType OutputImagePixelType;
00069
00071 void SetInput1( const TInputImage1 * image1);
00072
00074 void SetInput2( const TInputImage2 * image2);
00075
00080 FunctorType& GetFunctor() { return m_Functor; }
00081
00086 const FunctorType& GetFunctor() const
00087 {
00088 return m_Functor;
00089 }
00090
00097 void SetFunctor(const FunctorType& functor)
00098 {
00099 if (m_Functor != functor)
00100 {
00101 m_Functor = functor;
00102 this->Modified();
00103 }
00104 }
00106
00108 itkStaticConstMacro(
00109 InputImage1Dimension, unsigned int, TInputImage1::ImageDimension);
00110 itkStaticConstMacro(
00111 InputImage2Dimension, unsigned int, TInputImage2::ImageDimension);
00112 itkStaticConstMacro(
00113 OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
00115
00116 #ifdef ITK_USE_CONCEPT_CHECKING
00117
00118 itkConceptMacro(SameDimensionCheck1,
00119 (Concept::SameDimension<itkGetStaticConstMacro(InputImage1Dimension),
00120 itkGetStaticConstMacro(InputImage2Dimension)>));
00121 itkConceptMacro(SameDimensionCheck2,
00122 (Concept::SameDimension<itkGetStaticConstMacro(InputImage1Dimension),
00123 itkGetStaticConstMacro(OutputImageDimension)>));
00124
00126 #endif
00127
00128 protected:
00129 BinaryFunctorImageFilter();
00130 virtual ~BinaryFunctorImageFilter() {}
00131
00142 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00143 int threadId );
00144
00145 private:
00146 BinaryFunctorImageFilter(const Self&);
00147 void operator=(const Self&);
00148
00149 FunctorType m_Functor;
00150 };
00151
00152 }
00153
00154 #ifndef ITK_MANUAL_INSTANTIATION
00155 #include "itkBinaryFunctorImageFilter.txx"
00156 #endif
00157
00158 #endif
00159