ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkDenseFrequencyContainer2.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkDenseFrequencyContainer2_h
00019 #define __itkDenseFrequencyContainer2_h
00020 
00021 #include <map>
00022 #include "itkValarrayImageContainer.h"
00023 #include "itkMeasurementVectorTraits.h"
00024 
00025 namespace itk
00026 {
00027 namespace Statistics
00028 {
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 
00073   typedef ValarrayImageContainer< InstanceIdentifier, AbsoluteFrequencyType >
00074   FrequencyContainerType;
00075 
00076   typedef FrequencyContainerType::Pointer FrequencyContainerPointer;
00077 
00080   void Initialize(SizeValueType length);
00081 
00084   void SetToZero();
00085 
00088   bool SetFrequency(const InstanceIdentifier id, const AbsoluteFrequencyType value);
00089 
00093   bool IncreaseFrequency(const InstanceIdentifier id,
00094                          const AbsoluteFrequencyType value);
00095 
00098   AbsoluteFrequencyType GetFrequency(const InstanceIdentifier id) const;
00099 
00101   TotalAbsoluteFrequencyType GetTotalFrequency()
00102   {
00103     return m_TotalFrequency;
00104   }
00105 
00106 protected:
00107   DenseFrequencyContainer2();
00108   virtual ~DenseFrequencyContainer2() {}
00109   void PrintSelf(std::ostream & os, Indent indent) const;
00110 
00111 private:
00112   DenseFrequencyContainer2(const Self &); //purposely not implemented
00113   void operator=(const Self &);           //purposely not implemented
00114 
00116   FrequencyContainerPointer  m_FrequencyContainer;
00117   TotalAbsoluteFrequencyType m_TotalFrequency;
00118 };  // end of class
00119 } // end of namespace Statistics
00120 } // end of namespace itk
00121 
00122 #endif
00123