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

itkMaskImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMaskImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/06/07 23:00:50 $
00007   Version:   $Revision: 1.8 $
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 __itkMaskImageFilter_h
00018 #define __itkMaskImageFilter_h
00019 
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022 
00023 
00024 namespace itk
00025 {
00026   
00053 namespace Functor {  
00054   
00055 template< class TInput, class TMask, class TOutput >
00056 class MaskInput
00057 {
00058 public:
00059   typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
00060 
00061   MaskInput(): m_OutsideValue(NumericTraits< TOutput >::ZeroValue()) {};
00062   ~MaskInput() {};
00063   inline TOutput operator()( const TInput & A, const TMask & B)
00064   {
00065     if (B != NumericTraits< TMask >::ZeroValue() ) 
00066       {
00067       return static_cast<TOutput>( A );
00068       }
00069     else
00070       {
00071       return m_OutsideValue;
00072       }
00073   }
00074 
00076   void SetOutsideValue( const TOutput &outsideValue )
00077     {
00078     m_OutsideValue = outsideValue;
00079     }
00080   
00082   const TOutput &GetOutsideValue() const
00083     {
00084     return m_OutsideValue;
00085     }
00086      
00087 private:
00088   TOutput m_OutsideValue;
00089 }; 
00090 
00091 }
00092 template <class TInputImage, class TMaskImage, class TOutputImage>
00093 class ITK_EXPORT MaskImageFilter :
00094     public
00095 BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage, 
00096                          Functor::MaskInput< 
00097   typename TInputImage::PixelType, 
00098   typename TMaskImage::PixelType,
00099   typename TOutputImage::PixelType>   >
00100 
00101 
00102 {
00103 public:
00105   typedef MaskImageFilter  Self;
00106   typedef BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage, 
00107                                    Functor::MaskInput< 
00108     typename TInputImage::PixelType, 
00109     typename TMaskImage::PixelType,
00110     typename TOutputImage::PixelType>   
00111   >  Superclass;
00112   typedef SmartPointer<Self>   Pointer;
00113   typedef SmartPointer<const Self>  ConstPointer;
00114 
00116   itkNewMacro(Self);
00117  
00119   void SetOutsideValue( const typename TOutputImage::PixelType & outsudeValue ) 
00120     {
00121     this->GetFunctor().SetOutsideValue( outsudeValue );
00122     }
00123     
00124 protected:
00125   MaskImageFilter() {}
00126   virtual ~MaskImageFilter() {}
00127 
00128 private:
00129   MaskImageFilter(const Self&); //purposely not implemented
00130   void operator=(const Self&); //purposely not implemented
00131 
00132 };
00133 
00134 } // end namespace itk
00135 
00136 
00137 #endif

Generated at Wed May 24 23:37:27 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000