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

itkConstrainedValueDifferenceImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkConstrainedValueDifferenceImageFilter.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) Insight Software Consortium. All rights reserved.
00008   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even 
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00012      PURPOSE.  See the above copyright notices for more information.
00013 
00014 =========================================================================*/
00015 #ifndef __itkConstrainedValueDifferenceImageFilter_h
00016 #define __itkConstrainedValueDifferenceImageFilter_h
00017 
00018 #include "itkBinaryFunctorImageFilter.h"
00019 #include "itkNumericTraits.h"
00020 
00021 namespace itk
00022 {
00023   
00050 namespace Functor {  
00051   
00052 template< class TInput1, class TInput2, class TOutput>
00053 class ConstrainedValueDifference
00054 {
00055 public:
00056   ConstrainedValueDifference() {};
00057   ~ConstrainedValueDifference() {};
00058   inline TOutput operator()( const TInput1 & A, 
00059                              const TInput2 & B)
00060   {
00061     const double dA = static_cast<double>( A );
00062     const double dB = static_cast<double>( B );
00063     const double diff = dA - dB;
00064     const double cdiff = ( diff > NumericTraits<TOutput>::min() ) ? diff : NumericTraits<TOutput>::min(); 
00065     return static_cast<TOutput>( cdiff );
00066   }
00067 }; 
00068 }
00069 
00070 template <class TInputImage1, class TInputImage2, class TOutputImage>
00071 class ITK_EXPORT ConstrainedValueDifferenceImageFilter :
00072     public
00073 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00074                          Functor::ConstrainedValueDifference< 
00075   typename TInputImage1::PixelType, 
00076   typename TInputImage2::PixelType,
00077   typename TOutputImage::PixelType>   >
00078 {
00079 public:
00081   typedef ConstrainedValueDifferenceImageFilter  Self;
00082   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00083                                    Functor::ConstrainedValueDifference< 
00084     typename TInputImage1::PixelType, 
00085     typename TInputImage2::PixelType,
00086     typename TOutputImage::PixelType>   
00087   >  Superclass;
00088   typedef SmartPointer<Self>   Pointer;
00089   typedef SmartPointer<const Self>  ConstPointer;
00090 
00092   itkNewMacro(Self);
00093   
00094 protected:
00095   ConstrainedValueDifferenceImageFilter() {}
00096   virtual ~ConstrainedValueDifferenceImageFilter() {}
00097 
00098 private:
00099   ConstrainedValueDifferenceImageFilter(const Self&); //purposely not implemented
00100   void operator=(const Self&); //purposely not implemented
00101 
00102 };
00103 
00104 } // end namespace itk
00105 
00106 
00107 #endif

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