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: 2007/12/08 17:18:04 $
00007   Version:   $Revision: 1.13 $
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       {
00057       return (TOutput)(A / B);
00058       }
00059     else
00060       {
00061       return NumericTraits<TOutput>::max(A);
00062       }
00063   }
00064 }; 
00065 }
00066 
00067 template <class TInputImage1, class TInputImage2, class TOutputImage>
00068 class ITK_EXPORT DivideImageFilter :
00069     public
00070 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00071                          Function::Div< 
00072   typename TInputImage1::PixelType, 
00073   typename TInputImage2::PixelType,
00074   typename TOutputImage::PixelType>   >
00075 {
00076 public:
00080   typedef DivideImageFilter  Self;
00081 
00085   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00086                                    Function::Div< 
00087     typename TInputImage1::PixelType, 
00088     typename TInputImage2::PixelType,
00089     typename TOutputImage::PixelType>   
00090   > Superclass;
00091 
00095   typedef SmartPointer<Self>   Pointer;
00096   typedef SmartPointer<const Self>  ConstPointer;
00097 
00101   itkNewMacro(Self);
00102 
00104   itkTypeMacro(DivideImageFilter, 
00105                BinaryFunctorImageFilter);
00106 
00107 #ifdef ITK_USE_CONCEPT_CHECKING
00108 
00109   itkConceptMacro(IntConvertibleToInput2Check,
00110     (Concept::Convertible<int, typename TInputImage2::PixelType>));
00111   itkConceptMacro(Input1Input2OutputDivisionOperatorsCheck,
00112     (Concept::DivisionOperators<typename TInputImage1::PixelType,
00113                                 typename TInputImage2::PixelType,
00114                                 typename TOutputImage::PixelType>));
00115 
00117 #endif
00118 
00119 protected:
00120   DivideImageFilter() {}
00121   virtual ~DivideImageFilter() {}
00122   DivideImageFilter(const Self&) {}
00123   void operator=(const Self&) {}
00124 
00125 };
00126 
00127 } // end namespace itk
00128 
00129 
00130 #endif
00131 

Generated at Tue Jul 29 19:49:06 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000