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

itkAbsoluteValueDifferenceImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAbsoluteValueDifferenceImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/03/15 14:31:26 $
00007   Version:   $Revision: 1.5 $
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 __itkAbsoluteValueDifferenceImageFilter_h
00018 #define __itkAbsoluteValueDifferenceImageFilter_h
00019 
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkConceptChecking.h"
00022 
00023 namespace itk
00024 {
00025   
00049 namespace Functor {  
00050   
00051 template< class TInput1, class TInput2, class TOutput>
00052 class AbsoluteValueDifference2
00053 {
00054 public:
00055   AbsoluteValueDifference2() {};
00056   ~AbsoluteValueDifference2() {};
00057   bool operator!=( const AbsoluteValueDifference2 & ) const
00058   {
00059     return false;
00060   }
00061   bool operator==( const AbsoluteValueDifference2 & other ) const
00062   {
00063     return !(*this != other);
00064   }
00065   inline TOutput operator()( const TInput1 & A, 
00066                              const TInput2 & B)
00067   {
00068     const double dA = static_cast<double>( A );
00069     const double dB = static_cast<double>( B );
00070     const double diff = dA - dB;
00071     const double absdiff = ( diff > 0.0 ) ? diff : -diff; 
00072     return static_cast<TOutput>( absdiff );
00073   }
00074 }; 
00075 }
00076 
00077 template <class TInputImage1, class TInputImage2, class TOutputImage>
00078 class ITK_EXPORT AbsoluteValueDifferenceImageFilter :
00079     public
00080 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00081                          Functor::AbsoluteValueDifference2< 
00082   typename TInputImage1::PixelType, 
00083   typename TInputImage2::PixelType,
00084   typename TOutputImage::PixelType>   >
00085 {
00086 public:
00088   typedef AbsoluteValueDifferenceImageFilter  Self;
00089   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00090                                    Functor::AbsoluteValueDifference2< 
00091     typename TInputImage1::PixelType, 
00092     typename TInputImage2::PixelType,
00093     typename TOutputImage::PixelType>   
00094   >  Superclass;
00095   typedef SmartPointer<Self>   Pointer;
00096   typedef SmartPointer<const Self>  ConstPointer;
00097 
00099   itkNewMacro(Self);
00100 
00101 #ifdef ITK_USE_CONCEPT_CHECKING
00102 
00103   itkConceptMacro(Input1CovertibleToDoubleCheck,
00104     (Concept::Convertible<typename TInputImage1::PixelType, double>));
00105   itkConceptMacro(Input2ConvertibleToDoubleCheck,
00106     (Concept::Convertible<typename TInputImage2::PixelType, double>));
00107   itkConceptMacro(DoubleCovertibleToOutputCheck,
00108     (Concept::Convertible<double, typename TOutputImage::PixelType>));
00109 
00111 #endif
00112 
00113 protected:
00114   AbsoluteValueDifferenceImageFilter() {}
00115   virtual ~AbsoluteValueDifferenceImageFilter() {}
00116 
00117 private:
00118   AbsoluteValueDifferenceImageFilter(const Self&); //purposely not implemented
00119   void operator=(const Self&); //purposely not implemented
00120 
00121 };
00122 
00123 } // end namespace itk
00124 
00125 
00126 #endif
00127 

Generated at Sun Mar 11 23:25:31 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000