00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkListSampleToHistogramGenerator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/01/28 13:40:12 $ 00007 Version: $Revision: 1.3 $ 00008 00009 Copyright (c) 2002 Insight 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 __itkListSampleToHistogramGenerator_h 00018 #define __itkListSampleToHistogramGenerator_h 00019 00020 #include "itkObject.h" 00021 #include "itkListSampleBase.h" 00022 #include "itkHistogram.h" 00023 #include "itkStatisticsAlgorithm.h" 00024 #include "itkDenseFrequencyContainer.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00061 template< class TListSample, class THistogramMeasurement = float, 00062 class TFrequencyContainer = DenseFrequencyContainer< float > > 00063 class ITK_EXPORT ListSampleToHistogramGenerator : 00064 public Object 00065 { 00066 public: 00068 typedef ListSampleToHistogramGenerator Self; 00069 typedef Object Superclass; 00070 typedef SmartPointer<Self> Pointer; 00071 00073 itkTypeMacro(ListSampleToHistogramGenerator, Object) ; 00074 00076 itkNewMacro(Self) ; 00077 00079 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00080 TListSample::MeasurementVectorSize); 00081 00082 typedef Histogram< THistogramMeasurement, 00083 itkGetStaticConstMacro(MeasurementVectorSize), 00084 TFrequencyContainer > HistogramType ; 00085 00086 typedef typename HistogramType::SizeType HistogramSizeType ; 00087 00089 void SetListSample(TListSample* list) 00090 { m_List = list ; } 00091 00092 void SetMarginalScale(float scale) 00093 { m_MarginalScale = scale ; } 00094 00095 void SetNumberOfBins(HistogramSizeType sizes) 00096 { m_Sizes = sizes ; } 00097 00098 HistogramType* GetOutput() 00099 { return m_Histogram ; } 00100 00101 void Update() 00102 { this->GenerateData() ; } 00103 00104 protected: 00105 ListSampleToHistogramGenerator() ; 00106 virtual ~ListSampleToHistogramGenerator() {} 00107 void GenerateData() ; 00108 00109 private: 00110 TListSample* m_List ; 00111 typename HistogramType::Pointer m_Histogram ; 00112 HistogramSizeType m_Sizes ; 00113 float m_MarginalScale ; 00114 00115 } ; // end of class 00116 00117 } // end of namespace Statistics 00118 } // end of namespace itk 00119 00120 #ifndef ITK_MANUAL_INSTANTIATION 00121 #include "itkListSampleToHistogramGenerator.txx" 00122 #endif 00123 00124 #endif