Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkNeighborhoodOperatorImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNeighborhoodOperatorImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-16 19:33:45 $
00007   Version:   $Revision: 1.34 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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&); //purposely not implemented
00172   void operator=(const Self&); //purposely not implemented
00173 
00175   OutputNeighborhoodType m_Operator;
00176 
00179   ImageBoundaryConditionPointerType m_BoundsCondition;
00180 
00182   DefaultBoundaryCondition m_DefaultBoundaryCondition;
00183 
00184 };
00185   
00186 } // end namespace itk
00187 
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkNeighborhoodOperatorImageFilter.txx"
00190 #endif
00191 
00192 #endif
00193 

Generated at Mon Jul 12 2010 19:18:44 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000