ITK  6.0.0
Insight Toolkit
itkSparseFrequencyContainer2.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkSparseFrequencyContainer2_h
19 #define itkSparseFrequencyContainer2_h
20 
21 #include <map>
22 #include "itkObjectFactory.h"
23 #include "itkObject.h"
24 #include "itkNumericTraits.h"
26 #include "ITKStatisticsExport.h"
27 
28 namespace itk
29 {
30 namespace Statistics
31 {
42 class ITKStatistics_EXPORT SparseFrequencyContainer2 : public Object
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(SparseFrequencyContainer2);
46 
49  using Superclass = Object;
52 
54  itkOverrideGetNameOfClassMacro(SparseFrequencyContainer2);
55  itkNewMacro(Self);
60 
63 
66 
69 
72 
74  using FrequencyContainerType = std::map<InstanceIdentifier, AbsoluteFrequencyType>;
75  using FrequencyContainerConstIterator = FrequencyContainerType::const_iterator;
76 
78  void
79  Initialize(SizeValueType length);
80 
83  void
84  SetToZero();
85 
88  bool
89  SetFrequency(const InstanceIdentifier id, const AbsoluteFrequencyType value);
90 
93  bool
94  IncreaseFrequency(const InstanceIdentifier id, const AbsoluteFrequencyType value);
95 
99  GetFrequency(const InstanceIdentifier id) const;
100 
103  {
104  return m_TotalFrequency;
105  }
106 
107 protected:
109  ~SparseFrequencyContainer2() override = default;
110  void
111  PrintSelf(std::ostream & os, Indent indent) const override;
112 
113 private:
114  // Container of histogram
115  FrequencyContainerType m_FrequencyContainer{};
116  TotalAbsoluteFrequencyType m_TotalFrequency{};
117 }; // end of class
118 } // end of namespace Statistics
119 } // end of namespace itk
120 
121 #endif
itk::Statistics::SparseFrequencyContainer2::TotalRelativeFrequencyType
MeasurementVectorTraits::TotalRelativeFrequencyType TotalRelativeFrequencyType
Definition: itkSparseFrequencyContainer2.h:71
itkObjectFactory.h
itk::Statistics::MeasurementVectorTraits::InstanceIdentifier
IdentifierType InstanceIdentifier
Definition: itkMeasurementVectorTraits.h:49
itk::Statistics::SparseFrequencyContainer2
his class is a container for an histogram.
Definition: itkSparseFrequencyContainer2.h:42
itk::Statistics::MeasurementVectorTraits::TotalRelativeFrequencyType
NumericTraits< RelativeFrequencyType >::AccumulateType TotalRelativeFrequencyType
Definition: itkMeasurementVectorTraits.h:55
itk::Statistics::SparseFrequencyContainer2::AbsoluteFrequencyType
MeasurementVectorTraits::AbsoluteFrequencyType AbsoluteFrequencyType
Definition: itkSparseFrequencyContainer2.h:62
itk::Statistics::SparseFrequencyContainer2::GetTotalFrequency
TotalAbsoluteFrequencyType GetTotalFrequency() const
Definition: itkSparseFrequencyContainer2.h:102
itk::Statistics::SparseFrequencyContainer2::FrequencyContainerType
std::map< InstanceIdentifier, AbsoluteFrequencyType > FrequencyContainerType
Definition: itkSparseFrequencyContainer2.h:74
itk::Statistics::SparseFrequencyContainer2::RelativeFrequencyType
MeasurementVectorTraits::RelativeFrequencyType RelativeFrequencyType
Definition: itkSparseFrequencyContainer2.h:68
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Statistics::MeasurementVectorTraits::AbsoluteFrequencyType
InstanceIdentifier AbsoluteFrequencyType
Definition: itkMeasurementVectorTraits.h:52
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkObject.h
itkMeasurementVectorTraits.h
itk::Statistics::MeasurementVectorTraits::RelativeFrequencyType
NumericTraits< AbsoluteFrequencyType >::RealType RelativeFrequencyType
Definition: itkMeasurementVectorTraits.h:53
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Statistics::MeasurementVectorTraits::TotalAbsoluteFrequencyType
NumericTraits< AbsoluteFrequencyType >::AccumulateType TotalAbsoluteFrequencyType
Definition: itkMeasurementVectorTraits.h:54
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itkNumericTraits.h
itk::Statistics::SparseFrequencyContainer2::InstanceIdentifier
MeasurementVectorTraits::InstanceIdentifier InstanceIdentifier
Definition: itkSparseFrequencyContainer2.h:59
itk::Statistics::SparseFrequencyContainer2::TotalAbsoluteFrequencyType
MeasurementVectorTraits::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType
Definition: itkSparseFrequencyContainer2.h:65
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::Statistics::SparseFrequencyContainer2::FrequencyContainerConstIterator
FrequencyContainerType::const_iterator FrequencyContainerConstIterator
Definition: itkSparseFrequencyContainer2.h:75