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: 2006/03/31 14:31:04 $
00007   Version:   $Revision: 1.11 $
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 __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   bool operator!=( const Div & ) const
00046   {
00047     return false;
00048   }
00049   bool operator==( const Div & other ) const
00050   {
00051     return !(*this != other);
00052   }
00053   inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00054   {
00055     if(B != (TInput2) 0)
00056       return (TOutput)(A / B);
00057     else
00058       return NumericTraits<TOutput>::max();
00059   }
00060 }; 
00061 }
00062 
00063 template <class TInputImage1, class TInputImage2, class TOutputImage>
00064 class ITK_EXPORT DivideImageFilter :
00065     public
00066 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00067                          Function::Div< 
00068   typename TInputImage1::PixelType, 
00069   typename TInputImage2::PixelType,
00070   typename TOutputImage::PixelType>   >
00071 {
00072 public:
00076   typedef DivideImageFilter  Self;
00077 
00081   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00082                                    Function::Div< 
00083     typename TInputImage1::PixelType, 
00084     typename TInputImage2::PixelType,
00085     typename TOutputImage::PixelType>   
00086   > Superclass;
00087 
00091   typedef SmartPointer<Self>   Pointer;
00092   typedef SmartPointer<const Self>  ConstPointer;
00093 
00097   itkNewMacro(Self);
00098 
00099 #ifdef ITK_USE_CONCEPT_CHECKING
00100 
00101   itkConceptMacro(IntConvertibleToInput2Check,
00102     (Concept::Convertible<int, typename TInputImage2::PixelType>));
00103   itkConceptMacro(Input1Input2OutputDivisionOperatorsCheck,
00104     (Concept::DivisionOperators<typename TInputImage1::PixelType,
00105                                 typename TInputImage2::PixelType,
00106                                 typename TOutputImage::PixelType>));
00107 
00109 #endif
00110 
00111 protected:
00112   DivideImageFilter() {}
00113   virtual ~DivideImageFilter() {}
00114   DivideImageFilter(const Self&) {}
00115   void operator=(const Self&) {}
00116 
00117 };
00118 
00119 } // end namespace itk
00120 
00121 
00122 #endif
00123 

Generated at Sun Sep 23 12:24:20 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000