00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkDenseFrequencyContainer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/09/30 14:14:18 $ 00007 Version: $Revision: 1.12 $ 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 __itkDenseFrequencyContainer_h 00018 #define __itkDenseFrequencyContainer_h 00019 00020 #include <map> 00021 #include "itkObjectFactory.h" 00022 #include "itkObject.h" 00023 #include "itkValarrayImageContainer.h" 00024 #include "itkNumericTraits.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00040 class ITK_EXPORT DenseFrequencyContainer 00041 : public Object 00042 { 00043 public: 00045 typedef DenseFrequencyContainer Self; 00046 typedef Object Superclass; 00047 typedef SmartPointer<Self> Pointer; 00048 typedef SmartPointer<const Self> ConstPointer; 00049 00051 itkTypeMacro(DenseFrequencyContainer, Object); 00052 00054 itkNewMacro(Self); 00055 00057 typedef unsigned long InstanceIdentifier ; 00058 00060 typedef float FrequencyType ; 00061 00063 typedef NumericTraits<FrequencyType>::AccumulateType TotalFrequencyType ; 00064 00066 typedef ValarrayImageContainer< InstanceIdentifier, FrequencyType > 00067 FrequencyContainerType ; 00068 typedef FrequencyContainerType::Pointer FrequencyContainerPointer ; 00069 00072 void Initialize(unsigned long length) ; 00073 00076 void SetToZero() ; 00077 00080 bool SetFrequency(const InstanceIdentifier id, const FrequencyType value) ; 00081 00085 bool IncreaseFrequency(const InstanceIdentifier id, 00086 const FrequencyType value); 00087 00090 FrequencyType GetFrequency(const InstanceIdentifier id) const ; 00091 00093 TotalFrequencyType GetTotalFrequency() 00094 { return m_TotalFrequency ; } 00095 00096 protected: 00097 DenseFrequencyContainer() ; 00098 virtual ~DenseFrequencyContainer() {} 00099 void PrintSelf(std::ostream& os, Indent indent) const; 00100 00101 private: 00102 DenseFrequencyContainer(const Self&) ; //purposely not implemented 00103 void operator=(const Self&) ; //purposely not implemented 00104 00106 FrequencyContainerPointer m_FrequencyContainer ; 00107 TotalFrequencyType m_TotalFrequency ; 00108 } ; // end of class 00109 00110 } // end of namespace Statistics 00111 } // end of namespace itk 00112 00113 #endif 00114 00115 00116