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: 2007/09/27 11:36:39 $
00007   Version:   $Revision: 1.6 $
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 
00102   itkTypeMacro(AbsoluteValueDifferenceImageFilter, 
00103                BinaryFunctorImageFilter);
00104 
00105 #ifdef ITK_USE_CONCEPT_CHECKING
00106 
00107   itkConceptMacro(Input1CovertibleToDoubleCheck,
00108     (Concept::Convertible<typename TInputImage1::PixelType, double>));
00109   itkConceptMacro(Input2ConvertibleToDoubleCheck,
00110     (Concept::Convertible<typename TInputImage2::PixelType, double>));
00111   itkConceptMacro(DoubleCovertibleToOutputCheck,
00112     (Concept::Convertible<double, typename TOutputImage::PixelType>));
00113 
00115 #endif
00116 
00117 protected:
00118   AbsoluteValueDifferenceImageFilter() {}
00119   virtual ~AbsoluteValueDifferenceImageFilter() {}
00120 
00121 private:
00122   AbsoluteValueDifferenceImageFilter(const Self&); //purposely not implemented
00123   void operator=(const Self&); //purposely not implemented
00124 
00125 };
00126 
00127 } // end namespace itk
00128 
00129 
00130 #endif
00131 

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