00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkDenseFrequencyContainer2.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-05-02 05:43:55 $ 00007 Version: $Revision: 1.1 $ 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 __itkDenseFrequencyContainer2_h 00018 #define __itkDenseFrequencyContainer2_h 00019 00020 #include <map> 00021 #include "itkObjectFactory.h" 00022 #include "itkObject.h" 00023 #include "itkValarrayImageContainer.h" 00024 #include "itkNumericTraits.h" 00025 #include "itkMeasurementVectorTraits.h" 00026 00027 namespace itk { 00028 namespace Statistics { 00029 00041 class ITK_EXPORT DenseFrequencyContainer2 00042 : public Object 00043 { 00044 public: 00046 typedef DenseFrequencyContainer2 Self; 00047 typedef Object Superclass; 00048 typedef SmartPointer<Self> Pointer; 00049 typedef SmartPointer<const Self> ConstPointer; 00050 00052 itkTypeMacro(DenseFrequencyContainer2, Object); 00053 00055 itkNewMacro(Self); 00056 00058 typedef MeasurementVectorTraits::InstanceIdentifier InstanceIdentifier; 00059 00061 typedef MeasurementVectorTraits::AbsoluteFrequencyType AbsoluteFrequencyType; 00062 00064 typedef MeasurementVectorTraits::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType; 00065 00067 typedef MeasurementVectorTraits::RelativeFrequencyType RelativeFrequencyType; 00068 00070 typedef MeasurementVectorTraits::TotalRelativeFrequencyType TotalRelativeFrequencyType; 00071 00072 00074 typedef ValarrayImageContainer< InstanceIdentifier, AbsoluteFrequencyType > 00075 FrequencyContainerType; 00076 00077 typedef FrequencyContainerType::Pointer FrequencyContainerPointer; 00078 00081 void Initialize(unsigned long length); 00082 00085 void SetToZero(); 00086 00089 bool SetFrequency(const InstanceIdentifier id, const AbsoluteFrequencyType value); 00090 00094 bool IncreaseFrequency(const InstanceIdentifier id, 00095 const AbsoluteFrequencyType value); 00096 00099 AbsoluteFrequencyType GetFrequency(const InstanceIdentifier id) const; 00100 00102 TotalAbsoluteFrequencyType GetTotalFrequency() 00103 { 00104 return m_TotalFrequency; 00105 } 00106 00107 protected: 00108 DenseFrequencyContainer2(); 00109 virtual ~DenseFrequencyContainer2() {} 00110 void PrintSelf(std::ostream& os, Indent indent) const; 00111 00112 private: 00113 DenseFrequencyContainer2(const Self&); //purposely not implemented 00114 void operator=(const Self&); //purposely not implemented 00115 00117 FrequencyContainerPointer m_FrequencyContainer; 00118 TotalAbsoluteFrequencyType m_TotalFrequency; 00119 }; // end of class 00120 00121 } // end of namespace Statistics 00122 } // end of namespace itk 00123 00124 #endif 00125