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

itkSquaredDifferenceImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSquaredDifferenceImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-01 14:36:35 $
00007   Version:   $Revision: 1.9 $
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 __itkSquaredDifferenceImageFilter_h
00018 #define __itkSquaredDifferenceImageFilter_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 SquaredDifference2
00052 {
00053 public:
00054   SquaredDifference2() {};
00055   ~SquaredDifference2() {};
00056   bool operator!=( const SquaredDifference2 & ) const
00057     {
00058     return false;
00059     }
00060   bool operator==( const SquaredDifference2 & other ) const
00061     {
00062     return !(*this != other);
00063     }
00064   inline TOutput operator()( const TInput1 & A, 
00065                              const TInput2 & B) const
00066     {
00067     const double dA = static_cast<double>( A );
00068     const double dB = static_cast<double>( B );
00069     const double diff = dA - dB;
00070     return static_cast<TOutput>( diff * diff );
00071     }
00072 }; 
00073 }
00074 
00075 template <class TInputImage1, class TInputImage2, class TOutputImage>
00076 class ITK_EXPORT SquaredDifferenceImageFilter :
00077     public
00078 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00079                          Functor::SquaredDifference2< 
00080   typename TInputImage1::PixelType, 
00081   typename TInputImage2::PixelType,
00082   typename TOutputImage::PixelType>   >
00083 {
00084 public:
00086   typedef SquaredDifferenceImageFilter  Self;
00087   typedef BinaryFunctorImageFilter<
00088     TInputImage1,TInputImage2,TOutputImage, 
00089     Functor::SquaredDifference2< 
00090       typename TInputImage1::PixelType, 
00091       typename TInputImage2::PixelType,
00092       typename TOutputImage::PixelType>   
00093     >                                   Superclass;
00094   typedef SmartPointer<Self>            Pointer;
00095   typedef SmartPointer<const Self>      ConstPointer;
00096 
00098   itkNewMacro(Self);
00099 
00101   itkTypeMacro(SquaredDifferenceImageFilter, 
00102                BinaryFunctorImageFilter);
00103 
00104 #ifdef ITK_USE_CONCEPT_CHECKING
00105 
00106   itkConceptMacro(Input1ConvertibleToDoubleCheck,
00107     (Concept::Convertible<typename TInputImage1::PixelType, double>));
00108   itkConceptMacro(Input2ConvertibleToDoubleCheck,
00109     (Concept::Convertible<typename TInputImage2::PixelType, double>));
00110   itkConceptMacro(DoubleConvertibleToOutputCheck,
00111     (Concept::Convertible<double, typename TOutputImage::PixelType>));
00112 
00114 #endif
00115 
00116 protected:
00117   SquaredDifferenceImageFilter() {}
00118   virtual ~SquaredDifferenceImageFilter() {}
00119 
00120 private:
00121   SquaredDifferenceImageFilter(const Self&); //purposely not implemented
00122   void operator=(const Self&); //purposely not implemented
00123 
00124 };
00125 
00126 } // end namespace itk
00127 
00128 
00129 #endif
00130 

Generated at Mon Jul 12 2010 19:57:38 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000