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

itkNaryFunctorImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNaryFunctorImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-16 19:33:44 $
00007   Version:   $Revision: 1.17 $
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 __itkNaryFunctorImageFilter_h
00018 #define __itkNaryFunctorImageFilter_h
00019 
00020 #include "itkInPlaceImageFilter.h"
00021 #include "itkImageIterator.h"
00022 #include "itkArray.h"
00023 
00024 namespace itk
00025 {
00026   
00040 template <class TInputImage, class TOutputImage, class TFunction >
00041 class ITK_EXPORT NaryFunctorImageFilter :
00042     public InPlaceImageFilter<TInputImage,TOutputImage> 
00043 
00044 {
00045 public:
00047   typedef NaryFunctorImageFilter                        Self;
00048   typedef InPlaceImageFilter<TInputImage,TOutputImage>  Superclass;
00049   typedef SmartPointer<Self>                            Pointer;
00050   typedef SmartPointer<const Self>                      ConstPointer;
00051 
00053   itkNewMacro(Self);
00054 
00056   itkTypeMacro(NaryFunctorImageFilter, InPlaceImageFilter);
00057 
00059   typedef TFunction                             FunctorType;
00060   typedef TInputImage                           InputImageType;
00061   typedef typename InputImageType::Pointer      InputImagePointer;
00062   typedef typename InputImageType::RegionType   InputImageRegionType; 
00063   typedef typename InputImageType::PixelType    InputImagePixelType; 
00064   typedef TOutputImage                          OutputImageType;
00065   typedef typename OutputImageType::Pointer     OutputImagePointer;
00066   typedef typename OutputImageType::RegionType  OutputImageRegionType;
00067   typedef typename OutputImageType::PixelType   OutputImagePixelType;
00068   typedef std::vector< InputImagePixelType >    NaryArrayType; 
00069 
00074   FunctorType& GetFunctor() { return m_Functor; };
00075 
00082   void SetFunctor(FunctorType& functor)
00083     {
00084     if ( m_Functor != functor )
00085       {
00086       m_Functor = functor;
00087       this->Modified();
00088       }
00089     }
00091 
00093   itkStaticConstMacro(
00094     InputImageDimension, unsigned int, TInputImage::ImageDimension);
00095   itkStaticConstMacro(
00096     OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
00098 
00099 #ifdef ITK_USE_CONCEPT_CHECKING
00100 
00101   itkConceptMacro(SameDimensionCheck,
00102     (Concept::SameDimension<InputImageDimension, OutputImageDimension>));
00103   itkConceptMacro(OutputHasZeroCheck,
00104     (Concept::HasZero<OutputImagePixelType>));
00105 
00107 #endif
00108 
00109 protected:
00110   NaryFunctorImageFilter();
00111   virtual ~NaryFunctorImageFilter() {};
00112 
00123   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00124                             int threadId );
00125 
00126 private:
00127   NaryFunctorImageFilter(const Self&); //purposely not implemented
00128   void operator=(const Self&); //purposely not implemented
00129 
00130   FunctorType m_Functor;
00131 };
00132 
00133 } // end namespace itk
00134 
00135 #ifndef ITK_MANUAL_INSTANTIATION
00136 #include "itkNaryFunctorImageFilter.txx"
00137 #endif
00138 
00139 #endif
00140 

Generated at Fri Apr 16 19:08:52 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000