00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00068
00069 Maximum1() {}
00070 ~Maximum1() {}
00071 inline TOutput operator()( const Array< TInput > & B)
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 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 TInputImage::PixelType > >
00097 {
00098 public:
00100 typedef NaryMaximumImageFilter Self;
00101 typedef NaryFunctorImageFilter<TInputImage,TOutputImage,
00102 Functor::Maximum1< typename TInputImage::PixelType,
00103 typename TInputImage::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&);
00116 void operator=(const Self&);
00117
00118 };
00119
00120 }
00121
00122
00123 #endif