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 std::vector< 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 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<TInputImage,TOutputImage,
00106 Functor::Maximum1< typename TInputImage::PixelType,
00107 typename TInputImage::PixelType > > Superclass;
00108 typedef SmartPointer<Self> Pointer;
00109 typedef SmartPointer<const Self> ConstPointer;
00110
00112 itkNewMacro(Self);
00113
00114 #ifdef ITK_USE_CONCEPT_CHECKING
00115
00116 itkConceptMacro(InputConvertibleToOutputCheck,
00117 (Concept::Convertible<typename TInputImage::PixelType,
00118 typename TOutputImage::PixelType>));
00119 itkConceptMacro(InputLessThanComparableCheck,
00120 (Concept::LessThanComparable<typename TInputImage::PixelType>));
00121 itkConceptMacro(InputHasNumericTraitsCheck,
00122 (Concept::HasNumericTraits<typename TInputImage::PixelType>));
00123
00125 #endif
00126
00127 protected:
00128 NaryMaximumImageFilter() {}
00129 virtual ~NaryMaximumImageFilter() {}
00130
00131 private:
00132 NaryMaximumImageFilter(const Self&);
00133 void operator=(const Self&);
00134
00135 };
00136
00137 }
00138
00139
00140 #endif
00141