OTB  7.2.0
Orfeo Toolbox
otbImageMetadataInterfaceBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 otbImageMetadataInterfaceBase_h
22 #define otbImageMetadataInterfaceBase_h
23 
24 #include <string>
25 
26 #include "otbImageKeywordlist.h"
27 #include "itkMetaDataDictionary.h"
28 #include "otbMetaDataKey.h"
29 #include "itkImageBase.h"
30 
31 #include "OTBMetadataExport.h"
32 
33 namespace otb
34 {
35 
43 class OTBMetadata_EXPORT ImageMetadataInterfaceBase : public itk::Object
44 {
45 public:
47  typedef itk::Object Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkTypeMacro(ImageMetadataInterfaceBase, itk::Object);
53 
54  typedef itk::ImageBase<2> ImageType;
55  typedef itk::MetaDataDictionary MetaDataDictionaryType;
59  typedef unsigned int UnsignedIntType;
60  typedef std::vector<std::string> StringVectorType;
61  typedef std::vector<unsigned int> UIntVectorType;
62 
63 
65  void SetImage(ImageType* image)
66  {
67  this->SetMetaDataDictionary(image->GetMetaDataDictionary());
68  }
69 
71  void SetMetaDataDictionary(const MetaDataDictionaryType& dict)
72  {
73  m_MetaDataDictionary = dict;
74  }
75 
77  const MetaDataDictionaryType& GetMetaDataDictionary() const
78  {
79  return m_MetaDataDictionary;
80  }
81 
83  std::string GetProjectionRef() const;
84 
86  std::string GetGCPProjection() const;
87  // otbMetadataGetMacro(GCPProjection, std::string);
89 
90  UnsignedIntType GetGCPCount() const;
91  // otbMetadataGetMacro(GCPCount, unsigned int);
92 
93  OTB_GCP& GetGCPs(unsigned int GCPnum);
94  // otbMetadataGetGCPnumMacro(GCPs, OTB_GCP&, GCPnum, unsigned int);
95 
96  std::string GetGCPId(unsigned int GCPnum) const;
97  // otbMetadataGetGCPnumMacro(GCPId, std::string, GCPnum, unsigned int);
98 
99  std::string GetGCPInfo(unsigned int GCPnum) const;
100  // otbMetadataGetGCPnumMacro(GCPInfo, std::string, GCPnum, unsigned int);
101 
102  double GetGCPRow(unsigned int GCPnum) const;
103  // otbMetadataGetGCPnumMacro(GCPRow, double, GCPnum, unsigned int);
104 
105  double GetGCPCol(unsigned int GCPnum) const;
106  // otbMetadataGetGCPnumMacro(GCPCol, double, GCPnum, unsigned int);
107 
108  double GetGCPX(unsigned int GCPnum) const;
109  // otbMetadataGetGCPnumMacro(GCPX, double, GCPnum, unsigned int);
110 
111  double GetGCPY(unsigned int GCPnum) const;
112  // otbMetadataGetGCPnumMacro(GCPY, double, GCPnum, unsigned int);
113 
114  double GetGCPZ(unsigned int GCPnum) const;
115  // otbMetadataGetGCPnumMacro(GCPZ, double, GCPnum, unsigned int);
116 
121  bool GetNoDataFlags(std::vector<bool>& flags, std::vector<double>& values) const;
122 
125  VectorType GetGeoTransform() const;
126  // otbMetadataGetMacro(GeoTransform, VectorType);
127 
130  VectorType GetUpperLeftCorner() const;
131  // otbMetadataGetMacro(UpperLeftCorner, VectorType);
132 
133  VectorType GetUpperRightCorner() const;
134  // otbMetadataGetMacro(UpperRightCorner, VectorType);
135 
136  VectorType GetLowerLeftCorner() const;
137  // otbMetadataGetMacro(LowerLeftCorner, VectorType);
138 
139  VectorType GetLowerRightCorner() const;
140  // otbMetadataGetMacro(LowerRightCorner, VectorType);
141 
143  ImageKeywordlistType GetImageKeywordlist();
144 
145  const ImageKeywordlistType GetImageKeywordlist() const;
146 
149  std::string const GetSensorID() const;
150 
154  bool GetSensorID(std::string& sensorId) const;
155 
156  // otbMetadataGetMacro(SensorID, std::string);
157 
161  UnsignedIntType GetNumberOfBands() const;
162  // otbMetadataGetMacro(NumberOfBands, unsigned int);
164 
168  StringVectorType GetBandName() const;
169  // otbMetadataGetMacro(BandName, std::vector<std::string>);
171 
173  double GetXPixelSpacing() const;
174  // otbMetadataGetMacro(XPixelSpacing, double);
176 
178  double GetYPixelSpacing() const;
179  // otbMetadataGetMacro(YPixelSpacing, double);
181 
185  virtual int GetDay() const = 0;
186  // otbMetadataGetMacro(Day, int);
188 
192  virtual int GetMonth() const = 0;
193  // otbMetadataGetMacro(Month, int);
195 
199  virtual int GetYear() const = 0;
200  // otbMetadataGetMacro(Year, int);
202 
206  virtual int GetHour() const = 0;
207  // otbMetadataGetMacro(Hour, int);
209 
213  virtual int GetMinute() const = 0;
214  // otbMetadataGetMacro(Minute, int);
216 
220  virtual int GetProductionDay() const = 0;
221  // otbMetadataGetMacro(ProductionDay, int);
223 
227  virtual int GetProductionMonth() const = 0;
228  // otbMetadataGetMacro(ProductionMonth, int);
230 
234  virtual int GetProductionYear() const = 0;
235  // otbMetadataGetMacro(ProductionYear, int);
237 
241  virtual StringVectorType GetEnhancedBandNames() const = 0;
242 
245  virtual UIntVectorType GetDefaultDisplay() const = 0;
246 
247  virtual bool CanRead() const = 0;
248 
249  static void PrintMetadata(std::ostream& os, itk::Indent indent, const MetaDataDictionaryType& dict);
250 
251 protected:
254  {
255  }
256 
257  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
258 
259  MetaDataDictionaryType m_MetaDataDictionary;
260 
261 private:
262  ImageMetadataInterfaceBase(const Self&) = delete;
263  void operator=(const Self&) = delete;
264 
266 };
267 
268 } // end namespace otb
269 
270 #endif
void SetMetaDataDictionary(const MetaDataDictionaryType &dict)
Base class for captor metadata reading.
Storage and conversion for OSSIM metadata.
std::vector< unsigned int > UIntVectorType
std::vector< double > VectorType
This OTB_GCP class is used to manage the GCP parameters in OTB.
itk::VariableLengthVector< double > VariableLengthVectorType
MetaDataKey::VariableLengthVectorType VariableLengthVectorType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
itk::SmartPointer< const Self > ConstPointer
const MetaDataDictionaryType & GetMetaDataDictionary() const