00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkHistogramToIntensityImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-10-27 19:51:47 $ 00007 Version: $Revision: 1.4 $ 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> 00040 class HistogramIntensityFunction 00041 { 00042 public: 00043 00044 //Intensity function returns pixels of unsigned long.. 00045 typedef unsigned long 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 > 00074 class ITK_EXPORT HistogramToIntensityImageFilter : 00075 public HistogramToImageFilter< THistogram, 00076 Function::HistogramIntensityFunction< unsigned long> > 00077 { 00078 public: 00079 00081 typedef HistogramToIntensityImageFilter Self; 00082 //typedef typename Function::HistogramIntensityFunction FunctorType; 00083 typedef SmartPointer<Self> Pointer; 00084 typedef SmartPointer<const Self> ConstPointer; 00085 00087 itkTypeMacro( HistogramToIntensityImageFilter, HistogramToImageFilter ); 00088 00090 itkNewMacro(Self); 00091 00092 protected: 00093 HistogramToIntensityImageFilter() {} 00094 virtual ~HistogramToIntensityImageFilter() {} 00095 00096 private: 00097 HistogramToIntensityImageFilter(const Self&); //purposely not implemented 00098 void operator=(const Self&); //purposely not implemented 00099 00100 }; 00101 00102 } // end namespace itk 00103 00104 #endif 00105 00106 00107 00108