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

itkBinaryMagnitudeImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBinaryMagnitudeImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/01/15 19:35:57 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkBinaryMagnitudeImageFilter_h
00018 #define __itkBinaryMagnitudeImageFilter_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 Modulus2
00052   {
00053   public:
00054     Modulus2() {};
00055     ~Modulus2() {};
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       return static_cast<TOutput>( sqrt( dA*dA + dB*dB) );
00062     }
00063   }; 
00064 }
00065 
00066 template <class TInputImage1, class TInputImage2, class TOutputImage>
00067 class ITK_EXPORT BinaryMagnitudeImageFilter :
00068     public
00069     BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00070             Functor::Modulus2< 
00071                       typename TInputImage1::PixelType, 
00072                       typename TInputImage2::PixelType,
00073                       typename TOutputImage::PixelType>   >
00074 {
00075 public:
00077   typedef BinaryMagnitudeImageFilter  Self;
00078   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00079                       Functor::Modulus2< 
00080                       typename TInputImage1::PixelType, 
00081                       typename TInputImage2::PixelType,
00082                       typename TOutputImage::PixelType>   
00083                         >  Superclass;
00084   typedef SmartPointer<Self>   Pointer;
00085   typedef SmartPointer<const Self>  ConstPointer;
00086 
00088   itkNewMacro(Self);
00089   
00090 protected:
00091   BinaryMagnitudeImageFilter() {}
00092   virtual ~BinaryMagnitudeImageFilter() {}
00093 
00094 private:
00095   BinaryMagnitudeImageFilter(const Self&); //purposely not implemented
00096   void operator=(const Self&); //purposely not implemented
00097 
00098 };
00099 
00100 } // end namespace itk
00101 
00102 
00103 #endif

Generated at Wed Mar 12 01:12:48 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000