00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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,
00062 class THistogramMeasurement,
00063 class TFrequencyContainer = DenseFrequencyContainer< float > >
00064 class ITK_EXPORT ListSampleToHistogramGenerator :
00065 public Object
00066 {
00067 public:
00069 typedef ListSampleToHistogramGenerator Self;
00070 typedef Object Superclass;
00071 typedef SmartPointer<Self> Pointer;
00072 typedef SmartPointer<const Self> ConstPointer;
00073
00075 itkTypeMacro(ListSampleToHistogramGenerator, Object) ;
00076
00078 itkNewMacro(Self) ;
00079
00081 itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00082 TListSample::MeasurementVectorSize);
00083
00084 typedef Histogram< THistogramMeasurement,
00085 itkGetStaticConstMacro(MeasurementVectorSize),
00086 TFrequencyContainer > HistogramType ;
00087
00088 typedef typename HistogramType::SizeType HistogramSizeType ;
00089 typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
00090
00092 void SetListSample(const TListSample* list)
00093 { m_List = list ; }
00094
00095 void SetMarginalScale(float scale)
00096 { m_MarginalScale = scale ; }
00097
00098 void SetNumberOfBins(HistogramSizeType sizes)
00099 { m_Sizes = sizes ; }
00100
00101 const HistogramType* GetOutput() const
00102 { return m_Histogram ; }
00103
00104 void Update()
00105 { this->GenerateData() ; }
00106
00107 itkSetMacro(AutoMinMax,bool);
00108 itkGetConstReferenceMacro(AutoMinMax,bool);
00109
00110 void SetHistogramMin(const MeasurementVectorType & histogramMin)
00111 {
00112 m_HistogramMin = histogramMin;
00113 m_AutoMinMax = false;
00114 }
00115
00116 void SetHistogramMax(const MeasurementVectorType & histogramMax)
00117 {
00118 m_HistogramMax = histogramMax;
00119 m_AutoMinMax = false;
00120 }
00121
00122
00123 protected:
00124 ListSampleToHistogramGenerator() ;
00125 virtual ~ListSampleToHistogramGenerator() {}
00126 void GenerateData() ;
00127 void PrintSelf(std::ostream& os, Indent indent) const;
00128
00129 private:
00130 const TListSample* m_List ;
00131 typename HistogramType::Pointer m_Histogram ;
00132 HistogramSizeType m_Sizes ;
00133 float m_MarginalScale ;
00134 MeasurementVectorType m_HistogramMin;
00135 MeasurementVectorType m_HistogramMax;
00136 bool m_AutoMinMax;
00137
00138 } ;
00139
00140 }
00141 }
00142
00143 #ifndef ITK_MANUAL_INSTANTIATION
00144 #include "itkListSampleToHistogramGenerator.txx"
00145 #endif
00146
00147 #endif