00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSampleToHistogramProjectionFilter_h
00018 #define __itkSampleToHistogramProjectionFilter_h
00019
00020 #include "itkMacro.h"
00021 #include "itkObject.h"
00022 #include "itkSample.h"
00023 #include "itkSubsample.h"
00024 #include "itkFixedArray.h"
00025 #include "itkHistogram.h"
00026 #include "itkFunctionBase.h"
00027 #include "itkSampleAlgorithmBase.h"
00028 #include "itkVector.h"
00029
00030 namespace itk{
00031 namespace Statistics{
00032
00047 template < class TInputSample, class THistogramMeasurement >
00048 class ITK_EXPORT SampleToHistogramProjectionFilter :
00049 public SampleAlgorithmBase< TInputSample >
00050 {
00051 public:
00053 typedef SampleToHistogramProjectionFilter Self;
00054 typedef SampleAlgorithmBase< TInputSample > Superclass ;
00055 typedef SmartPointer< Self > Pointer ;
00056 typedef const SmartPointer< Self > ConstPointer ;
00057
00059 itkTypeMacro(SampleToHistogramProjectionFilter, SampleAlgorithmBase);
00060
00062 itkNewMacro(Self) ;
00063
00065 itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00066 TInputSample::MeasurementVectorSize) ;
00067 typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ;
00068 typedef typename TInputSample::MeasurementType MeasurementType ;
00069 typedef typename TInputSample::FrequencyType FrequencyType ;
00070 typedef typename TInputSample::InstanceIdentifier InstanceIdentifier ;
00071
00073 typedef typename Superclass::InputSampleType InputSampleType ;
00074
00076 typedef FixedArray< double,
00077 itkGetStaticConstMacro(MeasurementVectorSize) > ArrayType ;
00078
00080 typedef Vector< double,
00081 itkGetStaticConstMacro(MeasurementVectorSize) > MeanType ;
00082
00084 typedef Histogram< THistogramMeasurement, 1 > HistogramType ;
00085
00087 virtual void SetHistogram(HistogramType* histogram) ;
00088
00090 void SetMean(MeanType* center) ;
00091
00093 MeanType* GetMean() ;
00094
00096 void SetStandardDeviation(double* value) ;
00097
00099 double* GetStandardDeviation() ;
00100
00102 void SetProjectionAxis(ArrayType* axis) ;
00103
00105 ArrayType* GetProjectionAxis() ;
00106
00110 void SetHistogramBinOverlap(double overlap) ;
00111
00112 protected:
00113 SampleToHistogramProjectionFilter() ;
00114 virtual ~SampleToHistogramProjectionFilter() {}
00115 void PrintSelf(std::ostream& os, Indent indent) const ;
00116
00119 float CalculateOverlap(int binIndex,
00120 float dotProduct,
00121 float scale,
00122 float marginalDistance,
00123 bool firstHalf) ;
00125 void GenerateData() ;
00126
00127 private:
00128 SampleToHistogramProjectionFilter(const Self&) ;
00129 void operator=(const Self&) ;
00130
00131 bool m_HistogramUseEquiProbableBins ;
00132 double m_HistogramBinOverlap ;
00133
00134 MeanType* m_Mean ;
00135 ArrayType* m_ProjectionAxis ;
00136 double* m_StandardDeviation ;
00137 HistogramType* m_Histogram ;
00138 FrequencyType m_MinimumFrequency ;
00139 } ;
00140
00141 }
00142 }
00143
00144 #ifndef ITK_MANUAL_INSTANTIATION
00145 #include "itkSampleToHistogramProjectionFilter.txx"
00146 #endif
00147
00148 #endif