OTB  10.0.0
Orfeo Toolbox
otbSARMetadata.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 otbSARMetadata_h
22 #define otbSARMetadata_h
23 
24 #include "OTBMetadataExport.h"
25 #include "otbMetaDataKey.h"
27 
28 #include <string>
29 #include <vector>
30 #include <sstream>
31 #include <unordered_map>
32 
33 #include "itkPoint.h"
34 
35 #include "itkPointSet.h"
36 #include "otbDateTime.h"
37 
38 namespace otb
39 {
40 
41 class SarCalibrationLookupData;
42 
48 struct OTBMetadata_EXPORT AzimuthFmRate
49 {
50 
53 
55  double t0;
56 
58  std::vector<double> azimuthFmRatePolynomial;
59 
61  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix = "") const;
62 
64  static AzimuthFmRate FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix = "");
65 };
66 
71 struct OTBMetadata_EXPORT DopplerCentroid
72 {
73 
76  /* Two-way slant range time origin for Doppler centroid estimate */
77  double t0;
78  /* Doppler centroid estimated from data */
79  std::vector<double> dopCoef;
80  /* Doppler centroid estimated from orbit */
81  std::vector<double> geoDopCoef;
82 
84  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix = "") const;
85 
87  static DopplerCentroid FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix = "");
88 };
89 
94 struct OTBMetadata_EXPORT Orbit
95 {
96  using PointType = itk::Point<double, 3>;
97 
100 
103 
106 
108  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix = "") const;
109 
111  static Orbit FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix = "");
112 };
113 
118 struct OTBMetadata_EXPORT BurstRecord
119 {
122  unsigned long startLine;
123  unsigned long endLine;
124  unsigned long startSample;
125  unsigned long endSample;
127 
129  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix = "") const;
130 
132  static BurstRecord FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix = "");
133 };
134 
135 
140 struct OTBMetadata_EXPORT GCPTime
141 {
142 
145 
148 
150  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix = "") const;
151 };
152 
159 {
161  double rg0;
162  std::vector<double> coeffs;
163 
165  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix = "") const;
166 
168  static CoordinateConversionRecord FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix = "");
169 };
170 
175 {
176 
178  unsigned long referenceRow;
179 
181  unsigned long referenceColumn;
182 
184  double latitude;
185 
187  double longitude;
188 
191 
193  double rangeTime;
194 
197 
199  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix = "") const;
200 
202  static InfoSceneCoord FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix = "");
203 };
204 
211 struct OTBMetadata_EXPORT SARParam
212 {
213 
217  std::vector<AzimuthFmRate> azimuthFmRates;
218 
223 
224  unsigned long numberOfLinesPerBurst;
225  unsigned long numberOfSamplesPerBurst;
226 
227  double azimuthBandwidth = 0.;
228  double rangeBandwidth = 0.;
229  double azimuthSteeringRate = 0.;
230 
231  bool rightLookingFlag = true;
232 
234  std::vector<DopplerCentroid> dopplerCentroids;
235 
237  std::vector<Orbit> orbits;
238 
240  std::vector<BurstRecord> burstRecords;
241 
243  std::unordered_map<std::string, GCPTime> gcpTimes;
244 
246  std::vector<CoordinateConversionRecord> slantRangeToGroundRangeRecords;
247 
249  std::vector<CoordinateConversionRecord> groundRangeToSlantRangeRecords;
250 
257 
259  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix) const;
260 
262  void FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix);
263 
264  // Equality comparison operator (hidden friend idiom)
265  friend bool operator==(const SARParam & lhs, const SARParam & rhs)
266  {
267  MetaData::Keywordlist lhs_kwl;
268  lhs.ToKeywordlist(lhs_kwl, "");
269  MetaData::Keywordlist rhs_kwl;
270  rhs.ToKeywordlist(rhs_kwl, "");
271  return lhs_kwl == rhs_kwl;
272  }
273 };
274 
281 struct OTBMetadata_EXPORT SARCalib
282 {
283  using PointSetType = itk::PointSet<double, 2>;
284  using ArrayType = std::array<int, 2>;
285 
286  bool calibrationLookupFlag = false;
295  PointSetType::Pointer radiometricCalibrationNoise = PointSetType::New();
296  PointSetType::Pointer radiometricCalibrationAntennaPatternNewGain = PointSetType::New();
297  PointSetType::Pointer radiometricCalibrationAntennaPatternOldGain = PointSetType::New();
298  PointSetType::Pointer radiometricCalibrationIncidenceAngle = PointSetType::New();
299  PointSetType::Pointer radiometricCalibrationRangeSpreadLoss = PointSetType::New();
300  std::unordered_map<short, SarCalibrationLookupData::Pointer> calibrationLookupData;
301 
303  void ToKeywordlist(MetaData::Keywordlist & kwl, const std::string & prefix) const;
304 
306  void FromKeywordlist(const MetaData::Keywordlist & kwl, const std::string & prefix);
307 };
308 
309 } // end namespace otb
310 
311 #endif
Represents a duration.
Definition: otbDateTime.h:171
Represents a point in Time.
Definition: otbDateTime.h:98
std::unordered_map< std::string, std::string > Keywordlist
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
This structure is used to manage parameters related to the Azimuth Frequency Modulation rate.
MetaData::TimePoint azimuthTime
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix="") const
std::vector< double > azimuthFmRatePolynomial
static AzimuthFmRate FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix="")
This structure is used to handle burst records.
unsigned long startLine
MetaData::TimePoint azimuthStartTime
unsigned long startSample
unsigned long endLine
MetaData::TimePoint azimuthStopTime
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix="") const
static BurstRecord FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix="")
unsigned long endSample
This structure contains coefficients to convert between coordinates types, e.g. from ground range to ...
std::vector< double > coeffs
static CoordinateConversionRecord FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix="")
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix="") const
MetaData::TimePoint azimuthTime
This structure is used to handle Doppler centroid estimates.
MetaData::TimePoint azimuthTime
std::vector< double > geoDopCoef
std::vector< double > dopCoef
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix="") const
static DopplerCentroid FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix="")
This structure contains the azimuth and range times associated with a gcp.
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix="") const
double slantRangeTime
MetaData::TimePoint azimuthTime
Represents an InfoSceneCoord.
unsigned long referenceColumn
static InfoSceneCoord FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix="")
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix="") const
MetaData::TimePoint azimuthTime
unsigned long referenceRow
This structure is used to handle orbit information.
MetaData::TimePoint time
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix="") const
itk::Point< double, 3 > PointType
PointType velocity
static Orbit FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix="")
PointType position
SAR calibration LUTs.
MetaData::TimePoint calibrationStopTime
ArrayType radiometricCalibrationRangeSpreadLossPolynomialDegree
ArrayType radiometricCalibrationIncidenceAnglePolynomialDegree
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix) const
ArrayType radiometricCalibrationAntennaPatternNewGainPolynomialDegree
itk::PointSet< double, 2 > PointSetType
std::unordered_map< short, SarCalibrationLookupData::Pointer > calibrationLookupData
void FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix)
ArrayType radiometricCalibrationNoisePolynomialDegree
ArrayType radiometricCalibrationAntennaPatternOldGainPolynomialDegree
std::array< int, 2 > ArrayType
double rescalingFactor
MetaData::TimePoint calibrationStartTime
SAR sensors parameters.
std::vector< CoordinateConversionRecord > slantRangeToGroundRangeRecords
void ToKeywordlist(MetaData::Keywordlist &kwl, const std::string &prefix) const
MetaData::Duration azimuthTimeInterval
friend bool operator==(const SARParam &lhs, const SARParam &rhs)
std::vector< DopplerCentroid > dopplerCentroids
unsigned long numberOfLinesPerBurst
InfoSceneCoord llSceneCoord
unsigned long numberOfSamplesPerBurst
InfoSceneCoord centerSceneCoord
std::unordered_map< std::string, GCPTime > gcpTimes
double rangeResolution
double nearRangeTime
InfoSceneCoord ulSceneCoord
void FromKeywordlist(const MetaData::Keywordlist &kwl, const std::string &prefix)
double rangeSamplingRate
std::vector< BurstRecord > burstRecords
InfoSceneCoord urSceneCoord
std::vector< CoordinateConversionRecord > groundRangeToSlantRangeRecords
InfoSceneCoord lrSceneCoord
std::vector< Orbit > orbits
std::vector< AzimuthFmRate > azimuthFmRates