00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNeighborhoodOperatorImageFilter_h
00018 #define __itkNeighborhoodOperatorImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkNeighborhoodOperator.h"
00022 #include "itkImage.h"
00023 #include "itkImageBoundaryCondition.h"
00024 #include "itkZeroFluxNeumannBoundaryCondition.h"
00025
00026 namespace itk
00027 {
00045 template <class TInputImage, class TOutputImage, class TOperatorValueType=ITK_TYPENAME TOutputImage::PixelType>
00046 class ITK_EXPORT NeighborhoodOperatorImageFilter :
00047 public ImageToImageFilter< TInputImage, TOutputImage >
00048 {
00049 public:
00051 typedef NeighborhoodOperatorImageFilter Self;
00052 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00053 typedef SmartPointer<Self> Pointer;
00054 typedef SmartPointer<const Self> ConstPointer;
00055
00057 itkNewMacro(Self);
00058
00060 itkTypeMacro(NeighborhoodOperatorImageFilter, ImageToImageFilter);
00061
00064 typedef typename TOutputImage::PixelType OutputPixelType;
00065 typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00066 typedef typename TInputImage::PixelType InputPixelType;
00067 typedef typename TInputImage::InternalPixelType InputInternalPixelType;
00068 typedef TOperatorValueType OperatorValueType;
00069
00072 itkStaticConstMacro(ImageDimension, unsigned int,
00073 TOutputImage::ImageDimension);
00074 itkStaticConstMacro(InputImageDimension, unsigned int,
00075 TInputImage::ImageDimension);
00077
00079 typedef TInputImage InputImageType;
00080 typedef TOutputImage OutputImageType;
00081 typedef typename InputImageType::Pointer InputImagePointer;
00082
00084 typedef ImageBoundaryCondition<InputImageType> *
00085 ImageBoundaryConditionPointerType;
00086
00088 typedef ZeroFluxNeumannBoundaryCondition<InputImageType> DefaultBoundaryCondition;
00089
00091 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00092
00094 typedef Neighborhood<OperatorValueType,
00095 itkGetStaticConstMacro(ImageDimension)> OutputNeighborhoodType;
00096
00100 void SetOperator(const OutputNeighborhoodType &p)
00101 {
00102 m_Operator = p;
00103 this->Modified();
00104 }
00106
00108 const OutputNeighborhoodType& GetOperator() const
00109 { return m_Operator; }
00110
00116 void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00117 { m_BoundsCondition = i; }
00118
00120 ImageBoundaryConditionPointerType GetBoundaryCondition()
00121 { return m_BoundsCondition; }
00122
00130 virtual void GenerateInputRequestedRegion() throw (InvalidRequestedRegionError);
00131
00132 #ifdef ITK_USE_CONCEPT_CHECKING
00133
00134 itkConceptMacro(SameDimensionCheck,
00135 (Concept::SameDimension<InputImageDimension, ImageDimension>));
00136 itkConceptMacro(OperatorConvertibleToOutputCheck,
00137 (Concept::Convertible<OperatorValueType, OutputPixelType>));
00138 itkConceptMacro(InputConvertibleToOperatorCheck,
00139 (Concept::Convertible<InputPixelType, OperatorValueType>));
00140 itkConceptMacro(OperatorMultiplyOperatorCheck,
00141 (Concept::MultiplyOperator<OperatorValueType>));
00142 itkConceptMacro(OperatorAdditiveOperatorsCheck,
00143 (Concept::AdditiveOperators<OperatorValueType>));
00144
00146 #endif
00147
00148 protected:
00149 NeighborhoodOperatorImageFilter()
00150 { m_BoundsCondition = static_cast<ImageBoundaryConditionPointerType>(&m_DefaultBoundaryCondition); }
00151 virtual ~NeighborhoodOperatorImageFilter() {}
00152
00164 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00165 int threadId );
00166
00167
00168 void PrintSelf(std::ostream& os, Indent indent) const
00169 { Superclass::PrintSelf(os, indent); }
00170 private:
00171 NeighborhoodOperatorImageFilter(const Self&);
00172 void operator=(const Self&);
00173
00175 OutputNeighborhoodType m_Operator;
00176
00179 ImageBoundaryConditionPointerType m_BoundsCondition;
00180
00182 DefaultBoundaryCondition m_DefaultBoundaryCondition;
00183
00184 };
00185
00186 }
00187
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkNeighborhoodOperatorImageFilter.txx"
00190 #endif
00191
00192 #endif
00193