00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 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
return static_cast<TOutput>( diff * diff );
00063 }
00064 };
00065 }
00066
00067
template <
class TInputImage1,
class TInputImage2,
class TOutputImage>
00068 class ITK_EXPORT SquaredDifferenceImageFilter :
00069
public
00070
BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00071 Functor::SquaredDifference2<
00072 typename TInputImage1::PixelType,
00073 typename TInputImage2::PixelType,
00074 typename TOutputImage::PixelType> >
00075 {
00076
public:
00078 typedef SquaredDifferenceImageFilter
Self;
00079
typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00080
Functor::SquaredDifference2<
00081
typename TInputImage1::PixelType,
00082
typename TInputImage2::PixelType,
00083
typename TOutputImage::PixelType>
00084 >
Superclass;
00085 typedef SmartPointer<Self> Pointer;
00086 typedef SmartPointer<const Self> ConstPointer;
00087
00089
itkNewMacro(
Self);
00090
00091
protected:
00092 SquaredDifferenceImageFilter() {}
00093 virtual ~SquaredDifferenceImageFilter() {}
00094
00095
private:
00096 SquaredDifferenceImageFilter(
const Self&);
00097
void operator=(
const Self&);
00098
00099 };
00100
00101 }
00102
00103
00104
#endif