00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkHistogramToIntensityImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-01 14:36:37 $ 00007 Version: $Revision: 1.8 $ 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 __itkHistogramToIntensityImageFilter_h 00018 #define __itkHistogramToIntensityImageFilter_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 HistogramIntensityFunction(): 00048 m_TotalFrequency(1) {} 00049 00050 ~HistogramIntensityFunction() {}; 00051 00052 inline OutputPixelType operator()( const TInput & A ) const 00053 { 00054 return static_cast<OutputPixelType>( A ); 00055 } 00056 00057 void SetTotalFrequency( unsigned long n ) 00058 { 00059 m_TotalFrequency = n; 00060 } 00061 00062 unsigned long GetTotalFrequency( ) const 00063 { 00064 return m_TotalFrequency; 00065 } 00066 00067 private: 00068 unsigned long m_TotalFrequency; 00069 }; 00070 } 00071 00072 template <class THistogram, class TOutputPixel=unsigned long > 00073 class ITK_EXPORT HistogramToIntensityImageFilter : 00074 public HistogramToImageFilter< THistogram, 00075 Function::HistogramIntensityFunction< unsigned long, TOutputPixel > > 00076 { 00077 public: 00078 00080 typedef HistogramToIntensityImageFilter Self; 00081 00083 typedef HistogramToImageFilter< THistogram, 00084 Function::HistogramIntensityFunction< unsigned long, TOutputPixel > > 00085 Superclass; 00086 00087 //typedef typename Function::HistogramIntensityFunction FunctorType; 00088 typedef SmartPointer<Self> Pointer; 00089 typedef SmartPointer<const Self> ConstPointer; 00090 00092 itkTypeMacro( HistogramToIntensityImageFilter, HistogramToImageFilter ); 00093 00095 itkNewMacro(Self); 00096 00097 protected: 00098 HistogramToIntensityImageFilter() {} 00099 virtual ~HistogramToIntensityImageFilter() {} 00100 00101 private: 00102 HistogramToIntensityImageFilter(const Self&); //purposely not implemented 00103 void operator=(const Self&); //purposely not implemented 00104 00105 }; 00106 00107 } // end namespace itk 00108 00109 #endif 00110