00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSparseFrequencyContainer_h
00018 #define __itkSparseFrequencyContainer_h
00019
00020 #include <map>
00021 #include "itkObjectFactory.h"
00022 #include "itkObject.h"
00023
00024 namespace itk{
00025 namespace Statistics{
00026
00035 template< class TFrequencyValue = float >
00036 class ITK_EXPORT SparseFrequencyContainer : public Object
00037 {
00038 public:
00040 typedef SparseFrequencyContainer Self;
00041 typedef Object Superclass;
00042 typedef SmartPointer<Self> Pointer;
00043
00045 itkTypeMacro(SparseFrequencyContainer, Object);
00046 itkNewMacro(Self);
00047
00049 typedef unsigned long InstanceIdentifier ;
00050
00052 typedef TFrequencyValue FrequencyType ;
00053
00055 typedef std::map< InstanceIdentifier, FrequencyType >
00056 FrequencyContainerType ;
00057
00059 typedef typename FrequencyContainerType::iterator
00060 FrequencyContainerIterator ;
00061
00063 void Initialize(unsigned long length) ;
00064
00066 void SetFrequency(const InstanceIdentifier id, const FrequencyType value) ;
00067
00070 void IncreaseFrequency(const InstanceIdentifier id,
00071 const FrequencyType value);
00072
00074 FrequencyType GetFrequency(const InstanceIdentifier id) const ;
00075
00076 FrequencyType GetTotalFrequency()
00077 { return m_TotalFrequency ; }
00078
00079 protected:
00080 SparseFrequencyContainer() ;
00081 virtual ~SparseFrequencyContainer() {}
00082 void PrintSelf(std::ostream& os, Indent indent) const;
00083
00084 private:
00085 SparseFrequencyContainer(const Self&) ;
00086 void operator=(const Self&) ;
00087
00088
00089 FrequencyContainerType m_FrequencyContainer ;
00090 FrequencyType m_TotalFrequency ;
00091 } ;
00092
00093 }
00094 }
00095
00096 #ifndef ITK_MANUAL_INSTANTIATION
00097 #include "itkSparseFrequencyContainer.txx"
00098 #endif
00099
00100 #endif