00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSampleToHistogramProjectionFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 19:29:54 $ 00007 Version: $Revision: 1.6 $ 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 __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 "itkHistogram.h" 00025 #include "itkFunctionBase.h" 00026 #include "itkSampleAlgorithmBase.h" 00027 #include "itkArray.h" 00028 00029 namespace itk { 00030 namespace Statistics { 00031 00053 template < class TInputSample, class THistogramMeasurement > 00054 class ITK_EXPORT SampleToHistogramProjectionFilter : 00055 public SampleAlgorithmBase< TInputSample > 00056 { 00057 public: 00059 typedef SampleToHistogramProjectionFilter Self; 00060 typedef SampleAlgorithmBase< TInputSample > Superclass; 00061 typedef SmartPointer< Self > Pointer; 00062 typedef const SmartPointer< Self > ConstPointer; 00063 00065 itkTypeMacro(SampleToHistogramProjectionFilter, SampleAlgorithmBase); 00066 00068 itkNewMacro(Self); 00069 00070 00072 typedef typename TInputSample::MeasurementVectorType MeasurementVectorType; 00073 typedef typename TInputSample::MeasurementType MeasurementType; 00074 typedef typename TInputSample::FrequencyType FrequencyType; 00075 typedef typename TInputSample::InstanceIdentifier InstanceIdentifier; 00076 00078 typedef typename Superclass::InputSampleType InputSampleType; 00079 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00080 00082 typedef Array< double > ArrayType; 00083 00085 typedef Array< double > MeanType; 00086 00088 typedef Histogram< THistogramMeasurement, 1 > HistogramType; 00089 00091 virtual void SetHistogram(HistogramType* histogram); 00092 00094 void SetMean(MeanType* center); 00095 00097 MeanType* GetMean(); 00098 00100 void SetStandardDeviation(double* value); 00101 00103 double* GetStandardDeviation(); 00104 00106 void SetProjectionAxis(ArrayType* axis); 00107 00109 ArrayType* GetProjectionAxis(); 00110 00114 void SetHistogramBinOverlap(double overlap); 00115 00116 protected: 00117 SampleToHistogramProjectionFilter(); 00118 virtual ~SampleToHistogramProjectionFilter() {} 00119 void PrintSelf(std::ostream& os, Indent indent) const; 00120 00123 float CalculateOverlap(int binIndex, 00124 float dotProduct, 00125 float scale, 00126 float marginalDistance, 00127 bool firstHalf); 00128 00130 void GenerateData(); 00131 00132 private: 00133 SampleToHistogramProjectionFilter(const Self&); //purposely not implemented 00134 void operator=(const Self&); //purposely not implemented 00135 00136 bool m_HistogramUseEquiProbableBins; 00137 double m_HistogramBinOverlap; 00138 00139 MeanType* m_Mean; 00140 ArrayType* m_ProjectionAxis; 00141 double* m_StandardDeviation; 00142 HistogramType* m_Histogram; 00143 FrequencyType m_MinimumFrequency; 00144 }; // end of class 00145 00146 } // end of namespace Statistics 00147 } // end of namespace itk 00148 00149 #ifndef ITK_MANUAL_INSTANTIATION 00150 #include "itkSampleToHistogramProjectionFilter.txx" 00151 #endif 00152 00153 #endif 00154