OTB  10.0.0
Orfeo Toolbox
otbStatisticsXMLFileReader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbStatisticsXMLFileReader_h
22 #define otbStatisticsXMLFileReader_h
23 
24 #include "itkProcessObject.h"
25 #include <string>
26 
27 namespace otb
28 {
29 
41 template <class TMeasurementVector>
42 class StatisticsXMLFileReader : public itk::Object
43 {
44 public:
47  typedef itk::Object Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkTypeMacro(StatisticsXMLFileReader, itk::Object);
53 
55  itkNewMacro(Self);
56 
58  typedef TMeasurementVector MeasurementVectorType;
59  typedef typename MeasurementVectorType::ValueType InputValueType;
60 
62  typedef std::pair<std::string, MeasurementVectorType> InputDataType;
63  typedef std::vector<InputDataType> MeasurementVectorContainer;
64 
65  typedef std::map<std::string, std::string> GenericMapType;
66  typedef std::map<std::string, GenericMapType> GenericMapContainer;
67 
68  void Modified() const override
69  {
70  m_IsUpdated = false;
71  }
72 
74  itkSetStringMacro(FileName);
75  itkGetStringMacro(FileName);
77 
79  unsigned int GetNumberOfOutputs();
80 
82  std::vector<std::string> GetStatisticVectorNames();
83 
85  std::vector<std::string> GetStatisticMapNames();
86 
88  MeasurementVectorType GetStatisticVectorByName(const char* statisticName);
89 
91  template <typename MapType>
92  MapType GetStatisticMapByName(const char* statisticName);
93 
94 protected:
96  virtual void Read();
97 
100  {
101  }
102  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
103 
104 private:
105  StatisticsXMLFileReader(const Self&) = delete;
106  void operator=(const Self&) = delete;
107 
108  std::string m_FileName;
110  mutable bool m_IsUpdated;
112 
113 }; // end of class StatisticsXMLFileReader
114 
115 } // end of namespace otb
116 
117 #ifndef OTB_MANUAL_INSTANTIATION
119 #endif
120 
121 #endif
Read a xml file where are stored several statistics.
itk::SmartPointer< const Self > ConstPointer
MeasurementVectorType GetStatisticVectorByName(const char *statisticName)
MeasurementVectorType::ValueType InputValueType
std::vector< std::string > GetStatisticMapNames()
StatisticsXMLFileReader(const Self &)=delete
std::pair< std::string, MeasurementVectorType > InputDataType
std::map< std::string, GenericMapType > GenericMapContainer
std::vector< std::string > GetStatisticVectorNames()
MapType GetStatisticMapByName(const char *statisticName)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
MeasurementVectorContainer m_MeasurementVectorContainer
void operator=(const Self &)=delete
std::vector< InputDataType > MeasurementVectorContainer
std::map< std::string, std::string > GenericMapType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.