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: 2009-04-01 14:36:31 $
00007   Version:   $Revision: 1.10 $
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 std::vector< TInput > & B) const
00072     {
00073     OutputValueType A = NumericTraits< TOutput >::NonpositiveMin();
00074     for( unsigned int i=0; i< B.size(); i++ )
00075       {
00076       if( A < static_cast<OutputValueType>(B[i]) )
00077         {
00078         A = static_cast< OutputValueType > (B[i]);
00079         }
00080       }
00081     return A;
00082     }
00083   
00084   bool operator== (const Maximum1&) const
00085     {
00086     return true;
00087     }
00088   bool operator!= (const Maximum1&) const
00089     {
00090     return false;
00091     }
00092 };
00093 
00094 }
00095 template <class TInputImage, class TOutputImage>
00096 class ITK_EXPORT NaryMaximumImageFilter :
00097     public
00098 NaryFunctorImageFilter<TInputImage,TOutputImage, 
00099                        Functor::Maximum1<  typename TInputImage::PixelType, 
00100                            typename TInputImage::PixelType > > 
00101 {
00102 public:
00104   typedef NaryMaximumImageFilter    Self;
00105   typedef NaryFunctorImageFilter<
00106     TInputImage,TOutputImage, 
00107     Functor::Maximum1< typename TInputImage::PixelType, 
00108                        typename TInputImage::PixelType > >
00109                                     Superclass;
00110   typedef SmartPointer<Self>        Pointer;
00111   typedef SmartPointer<const Self>  ConstPointer;
00112 
00114   itkNewMacro(Self);
00115 
00117   itkTypeMacro(NaryMaximumImageFilter, 
00118                NaryFunctorImageFilter);
00119 
00120 #ifdef ITK_USE_CONCEPT_CHECKING
00121 
00122   itkConceptMacro(InputConvertibleToOutputCheck,
00123     (Concept::Convertible<typename TInputImage::PixelType,
00124                           typename TOutputImage::PixelType>));
00125   itkConceptMacro(InputLessThanComparableCheck,
00126     (Concept::LessThanComparable<typename TInputImage::PixelType>));
00127   itkConceptMacro(InputHasNumericTraitsCheck,
00128     (Concept::HasNumericTraits<typename TInputImage::PixelType>));
00129 
00131 #endif
00132 
00133 protected:
00134   NaryMaximumImageFilter() {}
00135   virtual ~NaryMaximumImageFilter() {}
00136 
00137 private:
00138   NaryMaximumImageFilter(const Self&); //purposely not implemented
00139   void operator=(const Self&); //purposely not implemented
00140 
00141 };
00142 
00143 } // end namespace itk
00144 
00145 
00146 #endif
00147 

Generated at Tue Sep 15 04:07:42 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000