From 5837b561063f5cc5cbeb0ad38b25e3f322361f1f Mon Sep 17 00:00:00 2001 From: Julien Osman <julien.osman@csgroup.eu> Date: Thu, 20 Aug 2020 09:40:15 +0200 Subject: [PATCH] REFACT: Create new file otbSARMetadata --- .../Metadata/include/otbGeometryMetadata.h | 113 ------------- .../Core/Metadata/include/otbImageMetadata.h | 1 + .../Core/Metadata/include/otbSARMetadata.h | 150 ++++++++++++++++++ .../otbSentinel1ImageMetadataInterface.cxx | 2 +- 4 files changed, 152 insertions(+), 114 deletions(-) create mode 100644 Modules/Core/Metadata/include/otbSARMetadata.h diff --git a/Modules/Core/Metadata/include/otbGeometryMetadata.h b/Modules/Core/Metadata/include/otbGeometryMetadata.h index f5d3493246..ccd902ecce 100644 --- a/Modules/Core/Metadata/include/otbGeometryMetadata.h +++ b/Modules/Core/Metadata/include/otbGeometryMetadata.h @@ -71,89 +71,6 @@ public: std::string ToJSON(bool multiline=false) const; }; -/** \struct AzimuthFmRate - * - * \brief This structure is used to manage parameters - * related to the Azimuth Frequency Modulation rate - */ -struct OTBMetadata_EXPORT AzimuthFmRate -{ - /** Zero Doppler azimuth time to which azimuth FM rate parameters apply */ - MetaData::Time azimuthTime; - /** Two way slant range time origin used for azimuth FM rate calculation */ - double t0; - /** Azimuth FM rate coefficients c0 c1 c2 */ - std::vector<double> azimuthFmRatePolynomial; -}; - -/** \struct CalibrationVector - * - * \brief This structure is used to handle calibration look up tables - */ -struct OTBMetadata_EXPORT CalibrationVector -{ - /** Image line at which the calibration vector applies */ - int line; - /** Zero Doppler azimuth time at which calibration vector applies */ - MetaData::Time azimuthTime; - /** Sigma nought calibration vector */ - MetaData::LUT1D sigmaNought; - /* Beta nought calibration vector */ - MetaData::LUT1D betaNought; - /* Gamma calibration vector */ - MetaData::LUT1D gamma; - /* Digital number calibration vector */ - MetaData::LUT1D dn; -}; - -/** \struct DopplerCentroid - * - * \brief This structure is used to handle Doppler centroid estimates - */ -struct OTBMetadata_EXPORT DopplerCentroid -{ - /** Zero Doppler azimuth time of this Doppler centroid estimate */ - MetaData::Time azimuthTime; - /* Two-way slant range time origin for Doppler centroid estimate */ - double t0; - /* Doppler centroid estimated from data */ - std::vector<double> dopCoef; - /* Doppler centroid estimated from orbit */ - std::vector<double> geoDopCoef; -}; - -/** \struct SARNoise - * - * \breif This structure is used to handle Noise look up tables - */ -struct OTBMetadata_EXPORT SARNoise -{ - /** Image line at which the noise vector applies */ - int line; - /** Zero Doppler azimuth time at which noise vector applies */ - MetaData::Time azimuthTime; - /** Noise look up talbe */ - MetaData::LUT1D noiseLut; -}; - -/** \struct Orbit - * - * \breif This structure is used to handle orbit information - */ -struct OTBMetadata_EXPORT Orbit -{ - /** Timestamp at which orbit state vectors apply */ - MetaData::Time time; - /** Position vector */ - double posX; - double posY; - double posZ; - /** Velocity vector */ - double velX; - double velY; - double velZ; -}; - namespace Projection { @@ -247,36 +164,6 @@ struct OTBMetadata_EXPORT RPCParam }; - -/** \struct SARParam - * - * \brief SAR sensors parameters - * - * \ingroup OTBMetadata - */ -struct OTBMetadata_EXPORT SARParam -{ - /** Azimuth Frequency Modulation (FM) rate list. - * contains an entry for each azimuth FM rate update made along azimuth. - */ - std::vector<AzimuthFmRate> azimuthFmRates; - - /** Calibration vector list */ - std::vector<CalibrationVector> calibrationVectors; - - MetaData::Time calibrationStartTime; - MetaData::Time calibrationStopTime; - - /** Doppler centroid estimates */ - std::vector<DopplerCentroid> dopplerCentroids; - - /** Noise look up tables */ - std::vector<SARNoise> noiseVector; - - /** List of orbit information */ - std::vector<Orbit> orbits; -}; - } // end namespace Projection } // end namespace otb diff --git a/Modules/Core/Metadata/include/otbImageMetadata.h b/Modules/Core/Metadata/include/otbImageMetadata.h index 235df765c7..f4d7b41c7c 100644 --- a/Modules/Core/Metadata/include/otbImageMetadata.h +++ b/Modules/Core/Metadata/include/otbImageMetadata.h @@ -22,6 +22,7 @@ #define otbImageMetadata_h #include "otbGeometryMetadata.h" +#include "otbSARMetadata.h" #include "otbMetaDataKey.h" #include "OTBMetadataExport.h" #include "otbMacro.h" diff --git a/Modules/Core/Metadata/include/otbSARMetadata.h b/Modules/Core/Metadata/include/otbSARMetadata.h new file mode 100644 index 0000000000..dd4956f7ae --- /dev/null +++ b/Modules/Core/Metadata/include/otbSARMetadata.h @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef otbSARMetadata_h +#define otbSARMetadata_h + +#include "OTBMetadataExport.h" +#include "otbMetaDataKey.h" + + +#include <string> +#include <vector> +#include <sstream> + +namespace otb +{ + +/** \struct AzimuthFmRate + * + * \brief This structure is used to manage parameters + * related to the Azimuth Frequency Modulation rate + */ +struct OTBMetadata_EXPORT AzimuthFmRate +{ + /** Zero Doppler azimuth time to which azimuth FM rate parameters apply */ + MetaData::Time azimuthTime; + /** Two way slant range time origin used for azimuth FM rate calculation */ + double t0; + /** Azimuth FM rate coefficients c0 c1 c2 */ + std::vector<double> azimuthFmRatePolynomial; +}; + +/** \struct CalibrationVector + * + * \brief This structure is used to handle calibration look up tables + */ +struct OTBMetadata_EXPORT CalibrationVector +{ + /** Image line at which the calibration vector applies */ + int line; + /** Zero Doppler azimuth time at which calibration vector applies */ + MetaData::Time azimuthTime; + /** Sigma nought calibration vector */ + MetaData::LUT1D sigmaNought; + /* Beta nought calibration vector */ + MetaData::LUT1D betaNought; + /* Gamma calibration vector */ + MetaData::LUT1D gamma; + /* Digital number calibration vector */ + MetaData::LUT1D dn; +}; + +/** \struct DopplerCentroid + * + * \brief This structure is used to handle Doppler centroid estimates + */ +struct OTBMetadata_EXPORT DopplerCentroid +{ + /** Zero Doppler azimuth time of this Doppler centroid estimate */ + MetaData::Time azimuthTime; + /* Two-way slant range time origin for Doppler centroid estimate */ + double t0; + /* Doppler centroid estimated from data */ + std::vector<double> dopCoef; + /* Doppler centroid estimated from orbit */ + std::vector<double> geoDopCoef; +}; + +/** \struct SARNoise + * + * \breif This structure is used to handle Noise look up tables + */ +struct OTBMetadata_EXPORT SARNoise +{ + /** Image line at which the noise vector applies */ + int line; + /** Zero Doppler azimuth time at which noise vector applies */ + MetaData::Time azimuthTime; + /** Noise look up talbe */ + MetaData::LUT1D noiseLut; +}; + +/** \struct Orbit + * + * \breif This structure is used to handle orbit information + */ +struct OTBMetadata_EXPORT Orbit +{ + /** Timestamp at which orbit state vectors apply */ + MetaData::Time time; + /** Position vector */ + double posX; + double posY; + double posZ; + /** Velocity vector */ + double velX; + double velY; + double velZ; +}; + +/** \struct SARParam + * + * \brief SAR sensors parameters + * + * \ingroup OTBMetadata + */ +struct OTBMetadata_EXPORT SARParam +{ + /** Azimuth Frequency Modulation (FM) rate list. + * contains an entry for each azimuth FM rate update made along azimuth. + */ + std::vector<AzimuthFmRate> azimuthFmRates; + + /** Calibration vector list */ + std::vector<CalibrationVector> calibrationVectors; + + MetaData::Time calibrationStartTime; + MetaData::Time calibrationStopTime; + + /** Doppler centroid estimates */ + std::vector<DopplerCentroid> dopplerCentroids; + + /** Noise look up tables */ + std::vector<SARNoise> noiseVector; + + /** List of orbit information */ + std::vector<Orbit> orbits; +}; + +} // end namespace otb + +#endif + diff --git a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx index 13fb397bf6..1a2eae2376 100644 --- a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx @@ -559,7 +559,7 @@ void Sentinel1ImageMetadataInterface::Parse(const MetadataSupplierInterface *mds // Band metadata for (int bandId = 0 ; bandId < mds->GetNbBands() ; ++bandId) { - Projection::SARParam sarParam; + SARParam sarParam; Fetch(MDStr::Polarization, *mds, "POLARISATION", bandId); std::string swath = Fetch(MDStr::Swath, *mds, "SWATH", bandId); -- GitLab