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: 2009-04-01 14:36:05 $
00007   Version:   $Revision: 1.8 $
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) const
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 
00096   typedef SmartPointer<Self>        Pointer;
00097   typedef SmartPointer<const Self>  ConstPointer;
00098 
00100   itkNewMacro(Self);
00101 
00103   itkTypeMacro(AbsoluteValueDifferenceImageFilter, 
00104                BinaryFunctorImageFilter);
00105 
00106 #ifdef ITK_USE_CONCEPT_CHECKING
00107 
00108   itkConceptMacro(Input1CovertibleToDoubleCheck,
00109     (Concept::Convertible<typename TInputImage1::PixelType, double>));
00110   itkConceptMacro(Input2ConvertibleToDoubleCheck,
00111     (Concept::Convertible<typename TInputImage2::PixelType, double>));
00112   itkConceptMacro(DoubleCovertibleToOutputCheck,
00113     (Concept::Convertible<double, typename TOutputImage::PixelType>));
00114 
00116 #endif
00117 
00118 protected:
00119   AbsoluteValueDifferenceImageFilter() {}
00120   virtual ~AbsoluteValueDifferenceImageFilter() {}
00121 
00122 private:
00123   AbsoluteValueDifferenceImageFilter(const Self&); //purposely not implemented
00124   void operator=(const Self&); //purposely not implemented
00125 
00126 };
00127 
00128 } // end namespace itk
00129 
00130 
00131 #endif
00132 

Generated at Tue Sep 15 02:06:05 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000