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

itkDivideImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDivideImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/01/15 19:36:00 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkDivideImageFilter_h
00018 #define __itkDivideImageFilter_h
00019 
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022 
00023 namespace itk
00024 {
00025   
00037 namespace Function {  
00038   
00039   template< class TInput1, class TInput2, class TOutput>
00040   class Div
00041   {
00042   public:
00043     Div() {};
00044     ~Div() {};
00045     inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00046     {
00047       if(B != (TInput2) 0)
00048         return (TOutput)(A / B);
00049       else
00050         return NumericTraits<TOutput>::max();
00051     }
00052   }; 
00053 }
00054 
00055 template <class TInputImage1, class TInputImage2, class TOutputImage>
00056 class ITK_EXPORT DivideImageFilter :
00057     public
00058     BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00059     Function::Div< 
00060               typename TInputImage1::PixelType, 
00061               typename TInputImage2::PixelType,
00062               typename TOutputImage::PixelType>   >
00063 {
00064 public:
00068   typedef DivideImageFilter  Self;
00069 
00073   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00074               Function::Div< 
00075               typename TInputImage1::PixelType, 
00076               typename TInputImage2::PixelType,
00077               typename TOutputImage::PixelType>   
00078                 > Superclass;
00079 
00083   typedef SmartPointer<Self>   Pointer;
00084   typedef SmartPointer<const Self>  ConstPointer;
00085 
00089   itkNewMacro(Self);
00090   
00091 protected:
00092   DivideImageFilter() {}
00093   virtual ~DivideImageFilter() {}
00094   DivideImageFilter(const Self&) {}
00095   void operator=(const Self&) {}
00096 
00097 };
00098 
00099 } // end namespace itk
00100 
00101 
00102 #endif

Generated at Wed Mar 12 01:12:53 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000