00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkScalarImageToHistogramGenerator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-05-02 05:43:58 $ 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 #ifndef __itkScalarImageToHistogramGenerator_h 00018 #define __itkScalarImageToHistogramGenerator_h 00019 00020 00021 #ifdef ITK_USE_REVIEW_STATISTICS 00022 #include "itkImageToListSampleAdaptor.h" 00023 #include "itkSampleToHistogramFilter.h" 00024 #include "itkHistogram.h" 00025 #else 00026 #include "itkScalarImageToListAdaptor.h" 00027 #include "itkListSampleToHistogramGenerator.h" 00028 #endif 00029 00030 #include "itkObject.h" 00031 00032 namespace itk { 00033 namespace Statistics { 00034 00039 template< class TImageType > 00040 class ScalarImageToHistogramGenerator : public Object 00041 { 00042 public: 00044 typedef ScalarImageToHistogramGenerator Self; 00045 typedef Object Superclass; 00046 typedef SmartPointer<Self> Pointer; 00047 typedef SmartPointer<const Self> ConstPointer; 00048 00050 itkTypeMacro(ScalarImageToHistogramGenerator, Object); 00051 00053 itkNewMacro(Self); 00054 00055 typedef TImageType ImageType; 00056 #ifdef ITK_USE_REVIEW_STATISTICS 00057 typedef itk::Statistics::ImageToListSampleAdaptor< 00058 #else 00059 typedef itk::Statistics::ScalarImageToListAdaptor< 00060 #endif 00061 ImageType 00062 > AdaptorType; 00063 typedef typename AdaptorType::Pointer AdaptorPointer; 00064 typedef typename ImageType::PixelType PixelType; 00065 typedef typename NumericTraits< PixelType >::RealType RealPixelType; 00066 00067 #ifdef ITK_USE_REVIEW_STATISTICS 00068 typedef itk::Statistics::Histogram< double > HistogramType; 00069 typedef itk::Statistics::SampleToHistogramFilter< AdaptorType, HistogramType > GeneratorType; 00070 #else 00071 typedef itk::Statistics::ListSampleToHistogramGenerator< 00072 AdaptorType, 00073 RealPixelType, 00074 DenseFrequencyContainer 00075 > GeneratorType; 00076 typedef typename GeneratorType::HistogramType HistogramType; 00077 #endif 00078 00079 typedef typename GeneratorType::Pointer GeneratorPointer; 00080 00081 typedef typename HistogramType::Pointer HistogramPointer; 00082 typedef typename HistogramType::ConstPointer HistogramConstPointer; 00083 00084 public: 00085 00087 void Compute( void ); 00088 00090 void SetInput( const ImageType * ); 00091 00095 const HistogramType * GetOutput() const; 00096 00098 void SetNumberOfBins( unsigned int numberOfBins ); 00099 00101 void SetMarginalScale( double marginalScale ); 00102 00104 void SetHistogramMin( RealPixelType minimumValue ); 00105 00107 void SetHistogramMax( RealPixelType maximumValue ); 00108 00109 protected: 00110 ScalarImageToHistogramGenerator(); 00111 virtual ~ScalarImageToHistogramGenerator() {}; 00112 void PrintSelf(std::ostream& os, Indent indent) const; 00113 00114 00115 private: 00116 00117 AdaptorPointer m_ImageToListAdaptor; 00118 00119 GeneratorPointer m_HistogramGenerator; 00120 00121 ScalarImageToHistogramGenerator(const Self&); //purposely not implemented 00122 void operator=(const Self&); //purposely not implemented 00123 }; 00124 00125 00126 } // end of namespace Statistics 00127 } // end of namespace itk 00128 00129 #ifndef ITK_MANUAL_INSTANTIATION 00130 #include "itkScalarImageToHistogramGenerator.txx" 00131 #endif 00132 00133 #endif 00134