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: 2004/07/14 22:25:36 $
00007   Version:   $Revision: 1.1 $
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 
00022 namespace itk
00023 {
00024   
00048 namespace Functor {  
00049   
00050 template< class TInput1, class TInput2, class TOutput>
00051 class AbsoluteValueDifference2
00052 {
00053 public:
00054   AbsoluteValueDifference2() {};
00055   ~AbsoluteValueDifference2() {};
00056   inline TOutput operator()( const TInput1 & A, 
00057                              const TInput2 & B)
00058   {
00059     const double dA = static_cast<double>( A );
00060     const double dB = static_cast<double>( B );
00061     const double diff = dA - dB;
00062     const double absdiff = ( diff > 0.0 ) ? diff : -diff; 
00063     return static_cast<TOutput>( absdiff );
00064   }
00065 }; 
00066 }
00067 
00068 template <class TInputImage1, class TInputImage2, class TOutputImage>
00069 class ITK_EXPORT AbsoluteValueDifferenceImageFilter :
00070     public
00071 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00072                          Functor::AbsoluteValueDifference2< 
00073   typename TInputImage1::PixelType, 
00074   typename TInputImage2::PixelType,
00075   typename TOutputImage::PixelType>   >
00076 {
00077 public:
00079   typedef AbsoluteValueDifferenceImageFilter  Self;
00080   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00081                                    Functor::AbsoluteValueDifference2< 
00082     typename TInputImage1::PixelType, 
00083     typename TInputImage2::PixelType,
00084     typename TOutputImage::PixelType>   
00085   >  Superclass;
00086   typedef SmartPointer<Self>   Pointer;
00087   typedef SmartPointer<const Self>  ConstPointer;
00088 
00090   itkNewMacro(Self);
00091   
00092 protected:
00093   AbsoluteValueDifferenceImageFilter() {}
00094   virtual ~AbsoluteValueDifferenceImageFilter() {}
00095 
00096 private:
00097   AbsoluteValueDifferenceImageFilter(const Self&); //purposely not implemented
00098   void operator=(const Self&); //purposely not implemented
00099 
00100 };
00101 
00102 } // end namespace itk
00103 
00104 
00105 #endif

Generated at Wed May 24 22:44:54 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000