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 "itkVector.h"
00028
00029 namespace itk{
00030 namespace Statistics{
00031
00046 template < class TInputSample, class THistogramMeasurement >
00047 class ITK_EXPORT SampleToHistogramProjectionFilter :
00048 public SampleAlgorithmBase< TInputSample >
00049 {
00050 public:
00052 typedef SampleToHistogramProjectionFilter Self;
00053 typedef SampleAlgorithmBase< TInputSample > Superclass ;
00054 typedef SmartPointer< Self > Pointer ;
00055 typedef const SmartPointer< Self > ConstPointer ;
00056
00058 itkTypeMacro(SampleToHistogramProjectionFilter, SampleAlgorithmBase);
00059
00061 itkNewMacro(Self) ;
00062
00064 itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00065 TInputSample::MeasurementVectorSize) ;
00066 typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ;
00067 typedef typename TInputSample::MeasurementType MeasurementType ;
00068 typedef typename TInputSample::FrequencyType FrequencyType ;
00069 typedef typename TInputSample::InstanceIdentifier InstanceIdentifier ;
00070
00072 typedef typename Superclass::InputSampleType InputSampleType ;
00073
00075 typedef FixedArray< double,
00076 itkGetStaticConstMacro(MeasurementVectorSize) > ArrayType ;
00077
00079 typedef Vector< double,
00080 itkGetStaticConstMacro(MeasurementVectorSize) > MeanType ;
00081
00083 typedef Histogram< THistogramMeasurement, 1 > HistogramType ;
00084
00086 virtual void SetHistogram(HistogramType* histogram) ;
00087
00089 void SetMean(MeanType* center) ;
00090
00092 MeanType* GetMean() ;
00093
00095 void SetStandardDeviation(double* value) ;
00096
00098 double* GetStandardDeviation() ;
00099
00101 void SetProjectionAxis(ArrayType* axis) ;
00102
00104 ArrayType* GetProjectionAxis() ;
00105
00109 void SetHistogramBinOverlap(double overlap) ;
00110
00111 protected:
00112 SampleToHistogramProjectionFilter() ;
00113 virtual ~SampleToHistogramProjectionFilter() {}
00114 void PrintSelf(std::ostream& os, Indent indent) const ;
00115
00118 float CalculateOverlap(int binIndex,
00119 float dotProduct,
00120 float scale,
00121 float marginalDistance,
00122 bool firstHalf) ;
00124 void GenerateData() ;
00125
00126 private:
00127 SampleToHistogramProjectionFilter(const Self&) ;
00128 void operator=(const Self&) ;
00129
00130 bool m_HistogramUseEquiProbableBins ;
00131 double m_HistogramBinOverlap ;
00132 double m_OrthoMargin ;
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