OTB  6.7.0
Orfeo Toolbox
otbStatisticsXMLFileReader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 
40 template < class TMeasurementVector>
42  public itk::Object
43 {
44 public:
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:
95 
97  virtual void Read();
98 
101  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
102 
103 private:
104  StatisticsXMLFileReader(const Self&) = delete;
105  void operator=(const Self&) = delete;
106 
107  std::string m_FileName;
109  mutable bool m_IsUpdated;
111 
112 }; // end of class StatisticsXMLFileReader
113 
114 } // end of namespace otb
115 
116 #ifndef OTB_MANUAL_INSTANTIATION
118 #endif
119 
120 #endif
itk::SmartPointer< const Self > ConstPointer
void PrintSelf(std::ostream &os, itk::Indent indent) const override
std::vector< std::string > GetStatisticVectorNames()
Read a xml file where are stored several statistics.
std::pair< std::string, MeasurementVectorType > InputDataType
MeasurementVectorContainer m_MeasurementVectorContainer
std::map< std::string, GenericMapType > GenericMapContainer
std::vector< InputDataType > MeasurementVectorContainer
std::vector< std::string > GetStatisticMapNames()
MeasurementVectorType::ValueType InputValueType
MapType GetStatisticMapByName(const char *statisticName)
void operator=(const Self &)=delete
MeasurementVectorType GetStatisticVectorByName(const char *statisticName)
std::map< std::string, std::string > GenericMapType