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

itkNaryMaximumImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNaryMaximumImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/05/16 16:40:03 $
00007   Version:   $Revision: 1.2 $
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 
00018 #ifndef __itkNaryMaximumImageFilter_h
00019 #define __itkNaryMaximumImageFilter_h
00020 
00021 #include "itkNaryFunctorImageFilter.h"
00022 #include "itkNumericTraits.h"
00023 
00024 
00025 namespace itk
00026 {
00027   
00060 namespace Functor {  
00061   
00062 template< class TInput, class TOutput >
00063 class Maximum1
00064 {
00065 public:
00066   typedef typename NumericTraits< TOutput >::ValueType OutputValueType; 
00067   // not sure if this typedef really makes things more clear... could just use TOutput?
00068   
00069   Maximum1() {}
00070   ~Maximum1() {}
00071   inline TOutput operator()( const TOutput & A, const TInput & B)
00072   {
00073     const OutputValueType queryValue = static_cast<OutputValueType>(B);
00074     if(A < queryValue)
00075     {
00076       return queryValue; 
00077     }
00078   else
00079     {
00080     return A;
00081     }
00082   }
00083   
00084   bool operator != (const Maximum1&) const
00085   {
00086     return false;
00087   }
00088 };
00089 
00090 }
00091 template <class TInputImage, class TOutputImage>
00092 class ITK_EXPORT NaryMaximumImageFilter :
00093     public
00094 NaryFunctorImageFilter<TInputImage,TOutputImage, 
00095                        Functor::Maximum1<  typename TInputImage::PixelType, 
00096                                        typename TOutputImage::PixelType>   >
00097 {
00098 public:
00100   typedef NaryMaximumImageFilter  Self;
00101   typedef NaryFunctorImageFilter<TInputImage,TOutputImage, 
00102                                  Functor::Maximum1< typename TInputImage::PixelType, 
00103                                                 typename TOutputImage::PixelType> >  Superclass;
00104   typedef SmartPointer<Self>   Pointer;
00105   typedef SmartPointer<const Self>  ConstPointer;
00106 
00108   itkNewMacro(Self);
00109   
00110 protected:
00111   NaryMaximumImageFilter() {}
00112   virtual ~NaryMaximumImageFilter() {}
00113 
00114 private:
00115   NaryMaximumImageFilter(const Self&); //purposely not implemented
00116   void operator=(const Self&); //purposely not implemented
00117 
00118 };
00119 
00120 } // end namespace itk
00121 
00122 
00123 #endif

Generated at Wed Mar 30 00:04:53 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000