00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMinimumProjectionImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008/02/08 04:52:21 $ 00007 Version: $Revision: 1.1 $ 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 __itkMinimumProjectionImageFilter_h 00019 #define __itkMinimumProjectionImageFilter_h 00020 00021 #include "itkProjectionImageFilter.h" 00022 #include "itkNumericTraits.h" 00023 #include "itkConceptChecking.h" 00024 00025 namespace itk { 00046 namespace Function { 00047 template <class TInputPixel> 00048 class MinimumAccumulator 00049 { 00050 public: 00051 MinimumAccumulator( unsigned long ) {} 00052 ~MinimumAccumulator(){} 00053 00054 inline void Initialize() 00055 { 00056 m_Minimum = NumericTraits< TInputPixel >::max(); 00057 } 00058 00059 inline void operator()( const TInputPixel &input ) 00060 { 00061 m_Minimum = vnl_math_min( m_Minimum, input ); 00062 } 00063 00064 inline TInputPixel GetValue() 00065 { 00066 return m_Minimum; 00067 } 00068 00069 TInputPixel m_Minimum; 00070 }; 00071 } // end namespace Function 00072 00073 00074 template <class TInputImage, class TOutputImage> 00075 class ITK_EXPORT MinimumProjectionImageFilter : public 00076 ProjectionImageFilter<TInputImage, TOutputImage, 00077 Function::MinimumAccumulator< typename TInputImage::PixelType > > 00078 { 00079 public: 00080 typedef MinimumProjectionImageFilter Self; 00081 typedef ProjectionImageFilter<TInputImage, TOutputImage, 00082 Function::MinimumAccumulator< 00083 typename TInputImage::PixelType > > Superclass; 00084 00085 typedef TInputImage InputImageType; 00086 typedef typename InputImageType::PixelType InputPixelType; 00087 00088 typedef SmartPointer<Self> Pointer; 00089 typedef SmartPointer<const Self> ConstPointer; 00090 00092 itkTypeMacro(MinimumProjectionImageFilter, ProjectionImageFilter); 00093 00095 itkNewMacro(Self); 00096 00097 #ifdef ITK_USE_CONCEPT_CHECKING 00098 00099 itkConceptMacro(InputPixelTypeGreaterThanComparable, 00100 (Concept::LessThanComparable<InputPixelType>)); 00101 itkConceptMacro(InputHasNumericTraitsCheck, 00102 (Concept::HasNumericTraits<InputPixelType>)); 00103 00105 #endif 00106 00107 protected: 00108 MinimumProjectionImageFilter() {} 00109 virtual ~MinimumProjectionImageFilter() {} 00110 00111 private: 00112 MinimumProjectionImageFilter(const Self&); //purposely not implemented 00113 void operator=(const Self&); //purposely not implemented 00114 00115 }; // end MinimumProjectionImageFilter 00116 00117 } //end namespace itk 00118 00119 #endif 00120