ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMinimumProjectionImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkMinimumProjectionImageFilter_h
00019 #define __itkMinimumProjectionImageFilter_h
00020 
00021 #include "itkProjectionImageFilter.h"
00022 #include "itkConceptChecking.h"
00023 
00024 namespace itk
00025 {
00046 namespace Functor
00047 {
00048 template< class TInputPixel >
00049 class MinimumAccumulator
00050 {
00051 public:
00052   MinimumAccumulator( SizeValueType ) {}
00053   ~MinimumAccumulator(){}
00054 
00055   inline void Initialize()
00056   {
00057     m_Minimum = NumericTraits< TInputPixel >::max();
00058   }
00059 
00060   inline void operator()(const TInputPixel & input)
00061   {
00062     m_Minimum = vnl_math_min(m_Minimum, input);
00063   }
00064 
00065   inline TInputPixel GetValue()
00066   {
00067     return m_Minimum;
00068   }
00069 
00070   TInputPixel m_Minimum;
00071 };
00072 } // end namespace Function
00073 
00074 template< class TInputImage, class TOutputImage >
00075 class ITK_EXPORT MinimumProjectionImageFilter:public
00076   ProjectionImageFilter< TInputImage, TOutputImage,
00077                          Functor::MinimumAccumulator< typename TInputImage::PixelType > >
00078 {
00079 public:
00080   typedef MinimumProjectionImageFilter Self;
00081   typedef ProjectionImageFilter< TInputImage, TOutputImage,
00082                                  Functor::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 protected:
00107   MinimumProjectionImageFilter() {}
00108   virtual ~MinimumProjectionImageFilter() {}
00109 private:
00110   MinimumProjectionImageFilter(const Self &); //purposely not implemented
00111   void operator=(const Self &);               //purposely not implemented
00112 };                                            // end
00113                                               // MinimumProjectionImageFilter
00114 } //end namespace itk
00116 
00117 #endif
00118