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: 2003/09/10 14:28:51 $
00007   Version:   $Revision: 1.3 $
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   
00049 namespace Functor {  
00050   
00051 template< class TInput, class TMask, class TOutput >
00052 class MaskInput
00053 {
00054 public:
00055   typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
00056 
00057   MaskInput() {};
00058   ~MaskInput() {};
00059   inline TOutput operator()( const TInput & A, const TMask & B)
00060   {
00061     if (B != 0) 
00062       {
00063       return static_cast<TOutput>( A );
00064       }
00065     else
00066       return NumericTraits< TOutput >::Zero;
00067         
00068   }
00069 }; 
00070 
00071 }
00072 template <class TInputImage, class TMaskImage, class TOutputImage>
00073 class ITK_EXPORT MaskImageFilter :
00074     public
00075 BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage, 
00076                          Functor::MaskInput< 
00077   typename TInputImage::PixelType, 
00078   typename TMaskImage::PixelType,
00079   typename TOutputImage::PixelType>   >
00080 
00081 
00082 {
00083 public:
00085   typedef MaskImageFilter  Self;
00086   typedef BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage, 
00087                                    Functor::MaskInput< 
00088     typename TInputImage::PixelType, 
00089     typename TMaskImage::PixelType,
00090     typename TOutputImage::PixelType>   
00091   >  Superclass;
00092   typedef SmartPointer<Self>   Pointer;
00093   typedef SmartPointer<const Self>  ConstPointer;
00094 
00096   itkNewMacro(Self);
00097   
00098 protected:
00099   MaskImageFilter() {}
00100   virtual ~MaskImageFilter() {}
00101 
00102 private:
00103   MaskImageFilter(const Self&); //purposely not implemented
00104   void operator=(const Self&); //purposely not implemented
00105 
00106 };
00107 
00108 } // end namespace itk
00109 
00110 
00111 #endif

Generated at Sun Jan 25 13:19:39 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000