00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkHistogramToIntensityImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-01-17 09:13:59 $ 00007 Version: $Revision: 1.6 $ 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 #ifndef __itkHistogramIntensityFunction_h 00018 #define __itkHistogramIntensityFunction_h 00019 00020 #include "itkHistogramToImageFilter.h" 00021 00022 namespace itk 00023 { 00024 00038 namespace Function { 00039 template< class TInput, class TOutput=unsigned long > 00040 class HistogramIntensityFunction 00041 { 00042 public: 00043 00044 //Intensity function returns pixels of unsigned long.. 00045 typedef TOutput OutputPixelType ; 00046 00047 00048 HistogramIntensityFunction(): 00049 m_TotalFrequency(1) {} 00050 00051 ~HistogramIntensityFunction() {}; 00052 00053 inline OutputPixelType operator()( const TInput & A ) 00054 { 00055 return static_cast<OutputPixelType>( A ); 00056 } 00057 00058 void SetTotalFrequency( unsigned long n ) 00059 { 00060 m_TotalFrequency = n; 00061 } 00062 00063 unsigned long GetTotalFrequency( ) const 00064 { 00065 return m_TotalFrequency; 00066 } 00067 00068 private: 00069 unsigned long m_TotalFrequency; 00070 }; 00071 } 00072 00073 template <class THistogram, class TOutputPixel=unsigned long > 00074 class ITK_EXPORT HistogramToIntensityImageFilter : 00075 public HistogramToImageFilter< THistogram, 00076 Function::HistogramIntensityFunction< unsigned long, TOutputPixel > > 00077 { 00078 public: 00079 00081 typedef HistogramToIntensityImageFilter Self; 00082 00084 typedef HistogramToImageFilter< THistogram, 00085 Function::HistogramIntensityFunction< unsigned long, TOutputPixel > > 00086 Superclass; 00087 00088 //typedef typename Function::HistogramIntensityFunction FunctorType; 00089 typedef SmartPointer<Self> Pointer; 00090 typedef SmartPointer<const Self> ConstPointer; 00091 00093 itkTypeMacro( HistogramToIntensityImageFilter, HistogramToImageFilter ); 00094 00096 itkNewMacro(Self); 00097 00098 protected: 00099 HistogramToIntensityImageFilter() {} 00100 virtual ~HistogramToIntensityImageFilter() {} 00101 00102 private: 00103 HistogramToIntensityImageFilter(const Self&); //purposely not implemented 00104 void operator=(const Self&); //purposely not implemented 00105 00106 }; 00107 00108 } // end namespace itk 00109 00110 #endif 00111 00112 00113 00114