OTB  10.0.0
Orfeo Toolbox
otbImageMetadataInterfaceBase.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 otbImageMetadataInterfaceBase_h
22 #define otbImageMetadataInterfaceBase_h
23 
24 #include <string>
25 
26 #include "itkMetaDataDictionary.h"
27 #include "otbMetaDataKey.h"
28 #include "itkImageBase.h"
29 #include "otbImageMetadata.h"
31 
32 #include "OTBMetadataExport.h"
33 
34 namespace otb
35 {
36 
44 class OTBMetadata_EXPORT ImageMetadataInterfaceBase : public itk::Object
45 {
46 public:
48  typedef itk::Object Superclass;
49  typedef itk::SmartPointer<Self> Pointer;
50  typedef itk::SmartPointer<const Self> ConstPointer;
51 
53  itkTypeMacro(ImageMetadataInterfaceBase, itk::Object);
54 
55  typedef itk::ImageBase<2> ImageType;
56  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 
69 
72 
75 
77  std::string GetProjectionRef() const;
78 
80  std::string GetGCPProjection() const;
81  // otbMetadataGetMacro(GCPProjection, std::string);
83 
85  // otbMetadataGetMacro(GCPCount, unsigned int);
86 
87  GCP& GetGCPs(unsigned int GCPnum);
88  // otbMetadataGetGCPnumMacro(GCPs, GCP&, GCPnum, unsigned int);
89 
90  std::string GetGCPId(unsigned int GCPnum) const;
91  // otbMetadataGetGCPnumMacro(GCPId, std::string, GCPnum, unsigned int);
92 
93  std::string GetGCPInfo(unsigned int GCPnum) const;
94  // otbMetadataGetGCPnumMacro(GCPInfo, std::string, GCPnum, unsigned int);
95 
96  double GetGCPRow(unsigned int GCPnum) const;
97  // otbMetadataGetGCPnumMacro(GCPRow, double, GCPnum, unsigned int);
98 
99  double GetGCPCol(unsigned int GCPnum) const;
100  // otbMetadataGetGCPnumMacro(GCPCol, double, GCPnum, unsigned int);
101 
102  double GetGCPX(unsigned int GCPnum) const;
103  // otbMetadataGetGCPnumMacro(GCPX, double, GCPnum, unsigned int);
104 
105  double GetGCPY(unsigned int GCPnum) const;
106  // otbMetadataGetGCPnumMacro(GCPY, double, GCPnum, unsigned int);
107 
108  double GetGCPZ(unsigned int GCPnum) const;
109  // otbMetadataGetGCPnumMacro(GCPZ, double, GCPnum, unsigned int);
110 
114  // otbMetadataGetMacro(GeoTransform, VectorType);
115 
119  // otbMetadataGetMacro(UpperLeftCorner, VectorType);
120 
122  // otbMetadataGetMacro(UpperRightCorner, VectorType);
123 
125  // otbMetadataGetMacro(LowerLeftCorner, VectorType);
126 
128  // otbMetadataGetMacro(LowerRightCorner, VectorType);
129 
133  virtual void Parse(ImageMetadata &)
134  {
135  otbGenericExceptionMacro(MissingMetadataException,<<"Metadata parsing not implemented")
136  }
137 
138  const std::string& Fetch(MDStr key, ImageMetadata & imd, const char *path, int band=-1);
139  bool CheckFetch(MDStr key, ImageMetadata & imd, const char *path, int band=-1);
140 
141  const double& Fetch(MDNum key, ImageMetadata & imd, const char *path, int band=-1);
142  bool CheckFetch(MDNum key, ImageMetadata & imd, const char *path, int band=-1);
143 
144  const MetaData::TimePoint& Fetch(MDTime key, ImageMetadata & imd, const char *path, int band=-1);
145  bool CheckFetch(MDTime key, ImageMetadata & imd, const char *path, int band=-1);
146 
147  const std::string& Fetch(std::string key, ImageMetadata & imd, const char *path, int band=-1);
148  bool CheckFetch(std::string key, ImageMetadata & imd, const char *path, int band=-1);
149 
150  const boost::any& FetchRPC(ImageMetadata& imd, const double lineOffset = 0.0, const double sampleOffset = 0.0);
151 
152 protected:
154  ~ImageMetadataInterfaceBase() override = default;
155 
156  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
157 
159 
160  const MetadataSupplierInterface * m_MetadataSupplierInterface = nullptr;
161 
162 private:
164  void operator=(const Self&) = delete;
165 
167 };
168 
169 } // end namespace otb
170 
171 #endif
This GCP class is used to manage the GCP parameters in OTB.
Base class for captor metadata reading.
double GetGCPX(unsigned int GCPnum) const
VectorType GetUpperLeftCorner() const
std::string GetGCPProjection() const
itk::SmartPointer< const Self > ConstPointer
const std::string & Fetch(std::string key, ImageMetadata &imd, const char *path, int band=-1)
double GetGCPCol(unsigned int GCPnum) const
bool CheckFetch(std::string key, ImageMetadata &imd, const char *path, int band=-1)
double GetGCPZ(unsigned int GCPnum) const
std::string GetGCPId(unsigned int GCPnum) const
const MetaDataDictionaryType & GetMetaDataDictionary() const
void SetMetadataSupplierInterface(const MetadataSupplierInterface &)
VectorType GetGeoTransform() const
const std::string & Fetch(MDStr key, ImageMetadata &imd, const char *path, int band=-1)
double GetGCPY(unsigned int GCPnum) const
GCP & GetGCPs(unsigned int GCPnum)
std::vector< unsigned int > UIntVectorType
double GetGCPRow(unsigned int GCPnum) const
MetaDataKey::VariableLengthVectorType VariableLengthVectorType
std::string GetGCPInfo(unsigned int GCPnum) const
const MetaData::TimePoint & Fetch(MDTime key, ImageMetadata &imd, const char *path, int band=-1)
void operator=(const Self &)=delete
const boost::any & FetchRPC(ImageMetadata &imd, const double lineOffset=0.0, const double sampleOffset=0.0)
void SetMetaDataDictionary(const MetaDataDictionaryType &dict)
UnsignedIntType GetGCPCount() const
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void SetImage(ImageType *image)
VectorType GetLowerLeftCorner() const
const double & Fetch(MDNum key, ImageMetadata &imd, const char *path, int band=-1)
VectorType GetUpperRightCorner() const
~ImageMetadataInterfaceBase() override=default
VectorType GetLowerRightCorner() const
bool CheckFetch(MDStr key, ImageMetadata &imd, const char *path, int band=-1)
std::string GetProjectionRef() const
bool CheckFetch(MDTime key, ImageMetadata &imd, const char *path, int band=-1)
bool CheckFetch(MDNum key, ImageMetadata &imd, const char *path, int band=-1)
ImageMetadataInterfaceBase(const Self &)=delete
Generic class containing image metadata used in OTB.
Represents a point in Time.
Definition: otbDateTime.h:98
Base class to access metadata information in files/images.
Exception to be used when metadata parsing fails.
std::vector< double > VectorType
itk::VariableLengthVector< double > VariableLengthVectorType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
#define otbGenericExceptionMacro(T, x)
Definition: otbMacro.h:196