OTB  9.0.0
Orfeo Toolbox
otbContingencyTableCalculator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbContingencyTableCalculator_h
22 #define otbContingencyTableCalculator_h
23 
24 #include "itkObject.h"
25 #include "itkObjectFactory.h"
26 #include "otbContingencyTable.h"
27 #include <map>
28 
29 namespace otb
30 {
40 template <class TClassLabel>
41 class ITK_EXPORT ContingencyTableCalculator : public itk::Object
42 {
43 public:
44 
47  typedef itk::Object Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkTypeMacro(ContingencyTableCalculator, itk::Object);
53 
55  itkNewMacro(Self);
56 
59 
60  typedef typename std::map<TClassLabel, unsigned long> CountMapType;
61  typedef typename std::map<TClassLabel, CountMapType> MapOfClassesType;
62 
67  template <class TRefIterator, class TProdIterator>
68  void Compute(TRefIterator itRef, TProdIterator itProd, bool refHasNoData = false, typename TRefIterator::InternalPixelType refNoData = 0,
69  bool prodHasNoData = false, typename TProdIterator::InternalPixelType prodNoData = 0);
70 
75  template <class TRefIterator, class TProdIterator>
76  void Compute(TRefIterator refBegin, TRefIterator refEnd, TProdIterator prodBegin, TProdIterator prodEnd);
77 
78  itkGetConstMacro(NumberOfRefClasses, unsigned long);
79  itkGetConstMacro(NumberOfProdClasses, unsigned long);
80  itkGetConstMacro(NumberOfSamples, unsigned long);
81 
82  void Clear();
83  ContingencyTablePointerType BuildContingencyTable();
84 
85 protected:
88  {
89  }
90  // void PrintSelf(std::ostream& os, itk::Indent indent) const override;
91 
92 private:
93  ContingencyTableCalculator(const Self&) = delete;
94  void operator=(const Self&) = delete;
95 
97  unsigned long m_NumberOfRefClasses;
98  unsigned long m_NumberOfProdClasses;
99  unsigned long m_NumberOfSamples;
100 };
101 }
102 
103 #ifndef OTB_MANUAL_INSTANTIATION
105 #endif
106 
107 #endif // otbContingencyTableCalculator_h
otb::ContingencyTableCalculator::ContingencyTablePointerType
ContingencyTableType::Pointer ContingencyTablePointerType
Definition: otbContingencyTableCalculator.h:58
otbContingencyTable.h
otb::ContingencyTableCalculator::ContingencyTableType
ContingencyTable< TClassLabel > ContingencyTableType
Definition: otbContingencyTableCalculator.h:55
otb::ContingencyTableCalculator::~ContingencyTableCalculator
~ContingencyTableCalculator() override
Definition: otbContingencyTableCalculator.h:87
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ContingencyTableCalculator::m_LabelCount
MapOfClassesType m_LabelCount
Definition: otbContingencyTableCalculator.h:96
otb::ContingencyTableCalculator::Self
ContingencyTableCalculator Self
Definition: otbContingencyTableCalculator.h:46
otb::ContingencyTableCalculator::CountMapType
std::map< TClassLabel, unsigned long > CountMapType
Definition: otbContingencyTableCalculator.h:60
otb::ContingencyTableCalculator::MapOfClassesType
std::map< TClassLabel, CountMapType > MapOfClassesType
Definition: otbContingencyTableCalculator.h:61
otb::ContingencyTableCalculator::m_NumberOfRefClasses
unsigned long m_NumberOfRefClasses
Definition: otbContingencyTableCalculator.h:97
otb::ContingencyTableCalculator::Superclass
itk::Object Superclass
Definition: otbContingencyTableCalculator.h:47
otb::ContingencyTableCalculator::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbContingencyTableCalculator.h:49
otb::ContingencyTableCalculator::m_NumberOfSamples
unsigned long m_NumberOfSamples
Definition: otbContingencyTableCalculator.h:99
otb::ContingencyTable::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbContingencyTable.h:40
otb::ContingencyTableCalculator
ContingencyTableCalculator provide facilities to compute ContingencyTable.
Definition: otbContingencyTableCalculator.h:41
otb::ContingencyTableCalculator::m_NumberOfProdClasses
unsigned long m_NumberOfProdClasses
Definition: otbContingencyTableCalculator.h:98
otb::ContingencyTableCalculator::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbContingencyTableCalculator.h:48
otb::ContingencyTable
Definition: otbContingencyTable.h:34
otbContingencyTableCalculator.hxx