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 class ITK_EXPORT SparseFrequencyContainer : public Object
00036 {
00037 public:
00039 typedef SparseFrequencyContainer Self;
00040 typedef Object Superclass;
00041 typedef SmartPointer<Self> Pointer;
00042 typedef SmartPointer<const Self> ConstPointer;
00043
00045 itkTypeMacro(SparseFrequencyContainer, Object);
00046 itkNewMacro(Self);
00047
00049 typedef unsigned long InstanceIdentifier ;
00050
00052 typedef float FrequencyType ;
00053
00055 typedef std::map< InstanceIdentifier, FrequencyType > FrequencyContainerType ;
00056 typedef FrequencyContainerType::const_iterator
00057 FrequencyContainerConstIterator ;
00058
00060 void Initialize(unsigned long length) ;
00061
00064 void SetToZero() ;
00065
00068 bool SetFrequency(const InstanceIdentifier id, const FrequencyType value) ;
00069
00072 bool IncreaseFrequency(const InstanceIdentifier id,
00073 const FrequencyType value);
00074
00077 FrequencyType GetFrequency(const InstanceIdentifier id) const ;
00078
00079 FrequencyType GetTotalFrequency()
00080 { return m_TotalFrequency ; }
00081
00082 protected:
00083 SparseFrequencyContainer() ;
00084 virtual ~SparseFrequencyContainer() {}
00085 void PrintSelf(std::ostream& os, Indent indent) const;
00086
00087 private:
00088 SparseFrequencyContainer(const Self&) ;
00089 void operator=(const Self&) ;
00090
00091
00092 FrequencyContainerType m_FrequencyContainer ;
00093 FrequencyType m_TotalFrequency ;
00094 } ;
00095
00096 }
00097 }
00098
00099 #endif