itkSparseFrequencyContainer.h
Go to the documentation of this file.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 #include "itkNumericTraits.h"
00024
00025 namespace itk {
00026 namespace Statistics {
00027
00036 class ITK_EXPORT SparseFrequencyContainer : public Object
00037 {
00038 public:
00040 typedef SparseFrequencyContainer Self;
00041 typedef Object Superclass;
00042 typedef SmartPointer<Self> Pointer;
00043 typedef SmartPointer<const Self> ConstPointer;
00044
00046 itkTypeMacro(SparseFrequencyContainer, Object);
00047 itkNewMacro(Self);
00049
00051 typedef unsigned long InstanceIdentifier;
00052
00054 typedef float FrequencyType;
00055
00057 typedef NumericTraits<FrequencyType>::AccumulateType TotalFrequencyType;
00058
00060 typedef std::map< InstanceIdentifier, FrequencyType > FrequencyContainerType;
00061 typedef FrequencyContainerType::const_iterator
00062 FrequencyContainerConstIterator;
00063
00065 void Initialize(unsigned long length);
00066
00069 void SetToZero();
00070
00073 bool SetFrequency(const InstanceIdentifier id, const FrequencyType value);
00074
00077 bool IncreaseFrequency(const InstanceIdentifier id,
00078 const FrequencyType value);
00079
00082 FrequencyType GetFrequency(const InstanceIdentifier id) const;
00083
00084 TotalFrequencyType GetTotalFrequency()
00085 { return m_TotalFrequency; }
00086
00087 protected:
00088 SparseFrequencyContainer();
00089 virtual ~SparseFrequencyContainer() {}
00090 void PrintSelf(std::ostream& os, Indent indent) const;
00091
00092 private:
00093 SparseFrequencyContainer(const Self&);
00094 void operator=(const Self&);
00095
00096
00097 FrequencyContainerType m_FrequencyContainer;
00098 TotalFrequencyType m_TotalFrequency;
00099 };
00100
00101 }
00102 }
00103
00104 #endif
00105