Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkSparseFrequencyContainer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSparseFrequencyContainer.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/07/22 22:52:59 $
00007   Version:   $Revision: 1.9 $
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 __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   typedef SmartPointer<const Self> ConstPointer;
00044 
00046   itkTypeMacro(SparseFrequencyContainer, Object);
00047   itkNewMacro(Self);
00048 
00050   typedef unsigned long InstanceIdentifier ;
00051 
00053   typedef TFrequencyValue FrequencyType ;
00054 
00056   typedef std::map< InstanceIdentifier, FrequencyType > 
00057   FrequencyContainerType ;  
00058 
00059   typedef typename FrequencyContainerType::const_iterator 
00060   FrequencyContainerConstIterator ;   
00061 
00063   void Initialize(unsigned long length) ;
00064 
00067   void SetToZero() ;
00068 
00071   bool SetFrequency(const InstanceIdentifier id, const FrequencyType value) ;
00072 
00075   bool IncreaseFrequency(const InstanceIdentifier id, 
00076                          const FrequencyType value);
00077 
00080   FrequencyType GetFrequency(const InstanceIdentifier id) const ;
00081 
00082   FrequencyType GetTotalFrequency()
00083   { return m_TotalFrequency ; }
00084 
00085 protected:
00086   SparseFrequencyContainer() ;
00087   virtual ~SparseFrequencyContainer() {}
00088   void PrintSelf(std::ostream& os, Indent indent) const;
00089 
00090 private:
00091   SparseFrequencyContainer(const Self&) ; //purposely not implemented
00092   void operator=(const Self&) ; //purposely not implemented
00093 
00094   // Container of histogram
00095   FrequencyContainerType m_FrequencyContainer ;
00096   FrequencyType  m_TotalFrequency ;
00097 } ; // end of class
00098 
00099   } // end of namespace Statistics
00100 } // end of namespace itk
00101 
00102 #ifndef ITK_MANUAL_INSTANTIATION
00103 #include "itkSparseFrequencyContainer.txx"
00104 #endif
00105 
00106 #endif

Generated at Wed Mar 30 00:11:43 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000