Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
3d29ed97
Commit
3d29ed97
authored
Mar 14, 2022
by
Julien Osman
Browse files
Merge branch '2260-TSX_metadata' into 'release-8.0'
Correctly read TSX metadata See merge request
!895
parents
3be4f753
707eaa51
Pipeline
#10037
passed with stages
in 88 minutes and 10 seconds
Changes
14
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Data/Baseline/OTB/Files/ioTvImageMetadataInterfaceTest_Sentinel1.txt
View file @
3d29ed97
...
...
@@ -21,7 +21,6 @@ GreenDisplayChannel 0
BlueDisplayChannel 0
PRF 1663.48
RadarFrequency 5.405e+09
CenterIncidenceAngle 44.7171
LineSpacing 4.08568
PixelSpacing 3.19483
AbsoluteCalibrationConstant 1
...
...
@@ -32,7 +31,7 @@ AcquisitionStopTime 2015-06-19T19:51:01.921994Z
SAR <SARParam>
SARCalib <SARCalib>
GCP <GCPParam>
FACILITY_IDENTIFIER
UPA_
FACILITY_IDENTIFIER
Aibus DS Sentinel-1 IPF 002.45
GCP
{"Projection": "GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]",
...
...
Data/Baseline/OTB/Files/ioTvImageMetadataInterfaceTest_TerraSar.txt
View file @
3d29ed97
SensorID
SAR
SensorID
TSX-1
Mission TSX-1
Instrument TSX-SAR
ProductType SSC____SM_S
Data/Input/cosmoskymed/cosmoskymed-1.geom
View file @
3d29ed97
...
...
@@ -256,12 +256,12 @@ support_data.geom.bursts.number_lines_per_burst: 14380
support_data
.
geom
.
bursts
.
number_samples_per_burst
:
17502
support_data
.
geom
.
gcp
.
number
:
1
support_data
.
geom
.
gcp
[
0
].
azimuthTime
:
2011
-
04
-
18
T18
:
03
:
28
.
648636
support_data
.
geom
.
gcp
[
0
].
im_pt
.
x
:
8707
.
88860642676
support_data
.
geom
.
gcp
[
0
].
im_pt
.
y
:
7191
.
48486375724
support_data
.
geom
.
gcp
[
0
].
im_pt
.
x
:
0
support_data
.
geom
.
gcp
[
0
].
im_pt
.
y
:
0
support_data
.
geom
.
gcp
[
0
].
slant_range_time
:
0
.
004
94748983592736
support_data
.
geom
.
gcp
[
0
].
world_pt
.
hgt
:
8
.5
6061888043765
e-1
1
support_data
.
geom
.
gcp
[
0
].
world_pt
.
lat
:
43
.
6
090634900135
support_data
.
geom
.
gcp
[
0
].
world_pt
.
lon
:
1
.
44722199061804
support_data
.
geom
.
gcp
[
0
].
world_pt
.
hgt
:
5
.5
3427526028827
e-1
0
support_data
.
geom
.
gcp
[
0
].
world_pt
.
lat
:
43
.
6
454490978792
support_data
.
geom
.
gcp
[
0
].
world_pt
.
lon
:
1
.
52085604938497
support_data
.
last_line_time
:
2011
-
04
-
18
T18
:
3
:
29
.
380925
support_data
.
line_time_interval
:
0
.
000101
881160627516
support_data
.
look_side
:
RIGHT
...
...
Data/Input/sentinel1/sentinel1-1.geom
View file @
3d29ed97
...
...
@@ -6922,7 +6922,7 @@ support_data.number_samples: 17663
support_data.orbit_cycle: 51
support_data.orbit_pass: ASCENDING
support_data.product_type: SLC
support_data.pulse_repetition_frequency: 1
.
663478
205991845e+03
support_data.pulse_repetition_frequency: 1663
.
478
14941406
support_data.radar_frequency: 5.405000454334350e+09
support_data.range_bandwidth: 4.218944400000000e+07
support_data.range_looks: 1
...
...
Data/Input/terrasar/terrasar-1.geom
View file @
3d29ed97
This diff is collapsed.
Click to expand it.
Modules/Core/Metadata/include/otbGeomMetadataSupplier.h
View file @
3d29ed97
...
...
@@ -80,11 +80,7 @@ public:
bool
FetchGCP
(
ImageMetadata
&
imd
);
/** Get the number of keys starting with path */
unsigned
int
GetNumberOf
(
std
::
string
const
&
)
const
override
{
otbLogMacro
(
Error
,
<<
"GetNumberOf() not yet implemented in otbGeomMetadataSupplier"
);
return
0
;
}
unsigned
int
GetNumberOf
(
std
::
string
const
&
)
const
override
;
/** If multiple keys have the same path, gives the position of the one with value value*/
unsigned
int
GetAttributId
(
std
::
string
const
&
,
std
::
string
const
&
)
const
override
...
...
Modules/Core/Metadata/src/otbGeomMetadataSupplier.cxx
View file @
3d29ed97
...
...
@@ -23,6 +23,7 @@
#include <fstream>
#include <boost/algorithm/string.hpp>
#include <unordered_map>
#include <algorithm>
#include "otbGeomMetadataSupplier.h"
#include "otbMetaDataKey.h"
...
...
@@ -30,6 +31,7 @@
#include "otbStringUtils.h"
#include "otbSARMetadata.h"
#include "otbDateTime.h"
#include "otbSpatialReference.h"
namespace
otb
{
...
...
@@ -154,25 +156,36 @@ bool GeomMetadataSupplier::FetchGCP(ImageMetadata & imd)
if
(
numberOfGcp
==
0
)
return
false
;
double
delta_x
=
0
;
double
delta_y
=
0
;
// TerrasarX GCP are shifted
if
(
imd
[
MDStr
::
Instrument
]
==
"TSX-SAR"
)
{
delta_x
=
1
;
delta_y
=
1
;
}
Projection
::
GCPParam
gcpPrm
;
std
::
unordered_map
<
std
::
string
,
GCPTime
>
gcpTimes
;
std
::
ostringstream
oss
;
for
(
int
i
=
0
;
i
<
numberOfGcp
;
++
i
)
// GCP id starts at 1
for
(
int
i
=
1
;
i
<
numberOfGcp
+
1
;
++
i
)
{
oss
.
str
(
""
);
oss
<<
"support_data.geom.gcp["
<<
i
<<
"]."
;
gcpPrm
.
GCPs
.
emplace_back
(
std
::
to_string
(
i
),
// ID
""
,
// Comment
GetAs
<
double
>
(
oss
.
str
()
+
"im_pt.x"
)
,
// col
GetAs
<
double
>
(
oss
.
str
()
+
"im_pt.y"
)
,
// row
GetAs
<
double
>
(
oss
.
str
()
+
"world_pt.lon"
),
// px
GetAs
<
double
>
(
oss
.
str
()
+
"world_pt.lat"
),
// py
GetAs
<
double
>
(
oss
.
str
()
+
"world_pt.hgt"
));
// pz
oss
<<
"support_data.geom.gcp["
<<
i
-
1
<<
"]."
;
gcpPrm
.
GCPs
.
emplace_back
(
std
::
to_string
(
i
),
// ID
""
,
// Comment
GetAs
<
double
>
(
oss
.
str
()
+
"im_pt.x"
)
+
delta_x
,
// col
GetAs
<
double
>
(
oss
.
str
()
+
"im_pt.y"
)
+
delta_y
,
// row
GetAs
<
double
>
(
oss
.
str
()
+
"world_pt.lon"
),
// px
GetAs
<
double
>
(
oss
.
str
()
+
"world_pt.lat"
),
// py
GetAs
<
double
>
(
oss
.
str
()
+
"world_pt.hgt"
));
// pz
GCPTime
time
;
time
.
azimuthTime
=
MetaData
::
ReadFormattedDate
(
GetAs
<
std
::
string
>
(
oss
.
str
()
+
"azimuthTime"
));
time
.
slantRangeTime
=
GetAs
<
double
>
((
oss
.
str
()
+
"slant_range_time"
));
gcpTimes
[
std
::
to_string
(
i
)]
=
time
;
}
gcpPrm
.
GCPProjection
=
otb
::
SpatialReference
::
FromWGS84
().
ToWkt
();
imd
.
Add
(
MDGeom
::
GCP
,
gcpPrm
);
// This step will erase the GCP read by GDAL if any.
if
(
imd
.
Has
(
MDGeom
::
SAR
))
{
...
...
@@ -191,6 +204,14 @@ bool GeomMetadataSupplier::FetchGCP(ImageMetadata & imd)
return
true
;
}
unsigned
int
GeomMetadataSupplier
::
GetNumberOf
(
std
::
string
const
&
pattern
)
const
{
return
std
::
count_if
(
m_MetadataDic
.
cbegin
(),
m_MetadataDic
.
cend
(),
[
pattern
](
DictType
::
value_type
u
){
return
u
.
first
.
rfind
(
pattern
,
0
)
==
0
;}
);
}
std
::
string
GeomMetadataSupplier
::
PrintSelf
()
const
{
std
::
ostringstream
oss
;
...
...
Modules/Core/Metadata/src/otbSARMetadata.cxx
View file @
3d29ed97
...
...
@@ -40,7 +40,7 @@ namespace
catch
(
const
std
::
out_of_range
&
e
)
{
otbGenericExceptionMacro
(
itk
::
ExceptionObject
,
<<
"Unable to find "
<<
key
<<
"in the input keywordlist"
);
<<
"Unable to find
'
"
<<
key
<<
"
'
in the input keywordlist"
);
}
}
...
...
Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx
View file @
3d29ed97
...
...
@@ -756,8 +756,10 @@ void Sentinel1ImageMetadataInterface::ParseGdal(ImageMetadata & imd)
ManifestMS
.
GetFirstAs
<
std
::
string
>
(
"xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:platform.safe:instrument.safe:extension.s1sarl1:instrumentMode.s1sarl1:swath"
));
imd
.
Add
(
"FACILITY_IDENTIFIER"
,
ManifestMS
.
GetFirstAs
<
std
::
string
>
(
"xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:processing.safe:facility.name"
));
auto
FIorganisation
=
ManifestMS
.
GetFirstAs
<
std
::
string
>
(
"xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:processing.safe:facility.organisation"
);
auto
FIsoftware
=
ManifestMS
.
GetFirstAs
<
std
::
string
>
(
"xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:processing.safe:facility.safe:software.name"
);
auto
FIversion
=
ManifestMS
.
GetFirstAs
<
std
::
string
>
(
"xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:processing.safe:facility.safe:software.version"
);
imd
.
Add
(
"FACILITY_IDENTIFIER"
,
FIorganisation
+
" "
+
FIsoftware
+
" "
+
FIversion
);
// Annotation file
auto
AnnotationFileName
=
imageFineName
+
".xml"
;
...
...
@@ -788,7 +790,6 @@ void Sentinel1ImageMetadataInterface::ParseGdal(ImageMetadata & imd)
imd
.
Add
(
MDNum
::
AverageSceneHeight
,
this
->
getBandTerrainHeight
(
AnnotationFilePath
));
imd
.
Add
(
MDNum
::
RadarFrequency
,
AnnotationMS
.
GetAs
<
double
>
(
"product.generalAnnotation.productInformation.radarFrequency"
));
imd
.
Add
(
MDNum
::
PRF
,
AnnotationMS
.
GetAs
<
double
>
(
"product.imageAnnotation.imageInformation.azimuthFrequency"
));
imd
.
Add
(
MDNum
::
CenterIncidenceAngle
,
AnnotationMS
.
GetAs
<
double
>
(
"product.imageAnnotation.imageInformation.incidenceAngleMidSwath"
));
// Calibration file
std
::
string
CalibrationFilePath
=
...
...
@@ -840,8 +841,9 @@ void Sentinel1ImageMetadataInterface::ParseGeom(ImageMetadata & imd)
CheckFetch
(
MDStr
::
BeamMode
,
imd
,
"manifest_data.acquisition_mode"
)
||
CheckFetch
(
MDStr
::
BeamMode
,
imd
,
"support_data.acquisition_mode"
);
CheckFetch
(
MDStr
::
BeamSwath
,
imd
,
"manifest_data.swath"
)
||
CheckFetch
(
MDStr
::
BeamSwath
,
imd
,
"support_data.swath"
);
CheckFetch
(
MDStr
::
Instrument
,
imd
,
"manifest_data.instrument"
)
||
CheckFetch
(
MDStr
::
Instrument
,
imd
,
"support_data.instrument"
);
CheckFetch
(
MDStr
::
Mission
,
imd
,
"manifest_data.instrument"
)
||
CheckFetch
(
MDStr
::
Mission
,
imd
,
"support_data.instrument"
);
CheckFetch
(
MDStr
::
OrbitDirection
,
imd
,
"manifest_data.orbit_pass"
)
||
CheckFetch
(
MDStr
::
OrbitDirection
,
imd
,
"support_data.orbit_pass"
);
CheckFetch
(
MDNum
::
OrbitNumber
,
imd
,
"manifest_data.abs_orbit"
)
||
CheckFetch
(
MD
Str
::
Orbit
Direction
,
imd
,
"support_data.abs_orbit"
);
CheckFetch
(
MDNum
::
OrbitNumber
,
imd
,
"manifest_data.abs_orbit"
)
||
CheckFetch
(
MD
Num
::
Orbit
Number
,
imd
,
"support_data.abs_orbit"
);
CheckFetch
(
MDStr
::
ProductType
,
imd
,
"manifest_data.product_type"
)
||
CheckFetch
(
MDStr
::
ProductType
,
imd
,
"support_data.product_type"
);
CheckFetch
(
MDTime
::
ProductionDate
,
imd
,
"manifest_data.date"
)
||
CheckFetch
(
MDTime
::
ProductionDate
,
imd
,
"support_data.date"
);
CheckFetch
(
MDTime
::
AcquisitionDate
,
imd
,
"manifest_data.image_date"
)
||
CheckFetch
(
MDTime
::
AcquisitionDate
,
imd
,
"support_data.image_date"
);
...
...
@@ -867,9 +869,6 @@ void Sentinel1ImageMetadataInterface::ParseGeom(ImageMetadata & imd)
CreateCalibrationLookupData
(
sarCalib
,
imd
,
*
m_MetadataSupplierInterface
,
true
);
CreateThermalNoiseLookupData
(
sarCalib
,
imd
,
*
m_MetadataSupplierInterface
,
true
);
imd
.
Add
(
MDGeom
::
SARCalib
,
sarCalib
);
Projection
::
GCPParam
gcp
;
imd
.
Add
(
MDGeom
::
GCP
,
gcp
);
}
void
Sentinel1ImageMetadataInterface
::
Parse
(
ImageMetadata
&
imd
)
...
...
Modules/Core/Metadata/src/otbTerraSarXSarImageMetadataInterface.cxx
View file @
3d29ed97
...
...
@@ -794,12 +794,12 @@ void TerraSarXSarImageMetadataInterface::ParseGdal(ImageMetadata &imd)
imd
.
Add
(
MDNum
::
LineSpacing
,
MainXMLFileMetadataSupplier
.
GetAs
<
double
>
(
"level1Product.productSpecific.complexImageInfo.projectedSpacingAzimuth"
));
imd
.
Add
(
MDNum
::
PixelSpacing
,
MainXMLFileMetadataSupplier
.
GetAs
<
double
>
(
"level1Product.productSpecific.complexImageInfo.projectedSpacingRange.slantRange"
));
imd
.
Add
(
MDStr
::
Mission
,
MainXMLFileMetadataSupplier
.
GetAs
<
std
::
string
>
(
"level1Product.generalHeader.mission"
));
imd
.
Add
(
MDStr
::
SensorID
,
MainXMLFileMetadataSupplier
.
GetAs
<
std
::
string
>
(
"level1Product.generalHeader.mission"
));
// This sensorID corresponds to the sensorID read in OTB 7.3 and below, e.g. MGD_SE_SM_S, but OTB 7.4 read productVariant, i.e. MGD in this case
const
std
::
string
productVariant
=
MainXMLFileMetadataSupplier
.
GetAs
<
std
::
string
>
(
"level1Product.productInfo.productVariantInfo.productVariant"
);
imd
.
Add
(
MDStr
::
ProductType
,
MainXMLFileMetadataSupplier
.
GetAs
<
std
::
string
>
(
"level1Product.productInfo.productVariantInfo.productType"
));
imd
.
Add
(
MDStr
::
Mode
,
MainXMLFileMetadataSupplier
.
GetAs
<
std
::
string
>
(
"level1Product.productInfo.acquisitionInfo.imagingMode"
));
imd
.
Add
(
MDStr
::
SensorID
,
MainXMLFileMetadataSupplier
.
GetAs
<
std
::
string
>
(
"level1Product.productInfo.acquisitionInfo.sensor"
));
imd
.
Add
(
MDNum
::
RadarFrequency
,
MainXMLFileMetadataSupplier
.
GetAs
<
double
>
(
"level1Product.instrument.radarParameters.centerFrequency"
));
imd
.
Add
(
MDTime
::
AcquisitionStartTime
,
MetaData
::
ReadFormattedDate
(
MainXMLFileMetadataSupplier
.
GetFirstAs
<
std
::
string
>
(
"level1Product.productInfo.sceneInfo.start.timeUTC"
)));
imd
.
Add
(
MDTime
::
AcquisitionStopTime
,
MetaData
::
ReadFormattedDate
(
MainXMLFileMetadataSupplier
.
GetFirstAs
<
std
::
string
>
(
"level1Product.productInfo.sceneInfo.stop.timeUTC"
)));
...
...
@@ -886,82 +886,107 @@ void TerraSarXSarImageMetadataInterface::ParseGeom(ImageMetadata & imd)
{
Fetch
(
MDNum
::
LineSpacing
,
imd
,
"meters_per_pixel_y"
);
Fetch
(
MDNum
::
PixelSpacing
,
imd
,
"meters_per_pixel_x"
);
Fetch
(
MDStr
::
Mode
,
imd
,
"acquisitionInfo.imagingMode"
);
if
(
!
CheckFetch
(
MDStr
::
Mode
,
imd
,
"acquisitionInfo.imagingMode"
))
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDStr
::
Mode
,
imd
,
"support_data.acquisition_mode"
);
// TerraSAR-X geoms (OTB >= 7.4)
Fetch
(
MDStr
::
Mission
,
imd
,
"sensor"
);
Fetch
(
MDStr
::
ProductType
,
imd
,
"product_type"
);
Fetch
(
MDStr
::
SensorID
,
imd
,
"acquisitionInfo.sensor"
);
Fetch
(
MDTime
::
AcquisitionStartTime
,
imd
,
"azimuth_start_time"
);
Fetch
(
MDTime
::
AcquisitionStopTime
,
imd
,
"azimuth_stop_time"
);
Fetch
(
MDNum
::
RangeTimeFirstPixel
,
imd
,
"range_first_time"
);
Fetch
(
MDNum
::
RangeTimeLastPixel
,
imd
,
"range_last_time"
);
Fetch
(
MDNum
::
PRF
,
imd
,
"sensor_params.prf"
);
imd
.
Add
(
MDStr
::
Instrument
,
"TSX-SAR"
);
if
(
!
CheckFetch
(
MDStr
::
ProductType
,
imd
,
"product_type"
))
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDStr
::
ProductType
,
imd
,
"support_data.product_type"
);
// TerraSAR-X geoms (OTB >= 7.4)
if
(
!
CheckFetch
(
MDTime
::
AcquisitionStartTime
,
imd
,
"azimuth_start_time"
))
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDTime
::
AcquisitionStartTime
,
imd
,
"support_data.first_line_time"
);
// TerraSAR-X geoms (OTB >= 7.4)
if
(
!
CheckFetch
(
MDTime
::
AcquisitionStopTime
,
imd
,
"azimuth_stop_time"
))
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDTime
::
AcquisitionStopTime
,
imd
,
"support_data.last_line_time"
);
// TerraSAR-X geoms (OTB >= 7.4)
if
(
!
CheckFetch
(
MDNum
::
PRF
,
imd
,
"sensor_params.prf"
))
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDNum
::
PRF
,
imd
,
"support_data.pulse_repetition_frequency"
);
// TerraSAR-X geoms (OTB >= 7.4)
Fetch
(
MDNum
::
CalFactor
,
imd
,
"calibration.calibrationConstant.calFactor"
);
Fetch
(
MDNum
::
CalScale
,
imd
,
"calibration.calibrationConstant.calFactor"
);
Fetch
(
MDStr
::
Polarization
,
imd
,
"acquisitionInfo.polarisationList[0]"
);
if
(
!
CheckFetch
(
MDStr
::
Polarization
,
imd
,
"acquisitionInfo.polarisationList[0]"
))
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDStr
::
Polarization
,
imd
,
"header.polarisation"
);
// TerraSAR-X geoms (OTB >= 7.4)
Fetch
(
MDNum
::
NumberOfLines
,
imd
,
"number_lines"
);
Fetch
(
MDNum
::
NumberOfColumns
,
imd
,
"number_samples"
);
Fetch
(
MDNum
::
RadarFrequency
,
imd
,
"radarFrequency"
);
if
(
!
CheckFetch
(
MDNum
::
RadarFrequency
,
imd
,
"radarFrequency"
))
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDNum
::
RadarFrequency
,
imd
,
"support_data.radar_frequency"
);
// TerraSAR-X geoms (OTB >= 7.4)
Fetch
(
MDStr
::
OrbitDirection
,
imd
,
"support_data.orbit_pass"
);
Fetch
(
MDNum
::
OrbitNumber
,
imd
,
"support_data.abs_orbit"
);
if
(
!
CheckFetch
(
MDNum
::
RangeTimeFirstPixel
,
imd
,
"support_data.slant_range_to_first_pixel"
))
// TerraSAR-X geoms (OTB >= 7.4)
Fetch
(
MDNum
::
RangeTimeFirstPixel
,
imd
,
"range_first_time"
);
// TerraSAR-X geoms (OTB < 7.4)
if
(
!
CheckFetch
(
MDNum
::
RangeTimeLastPixel
,
imd
,
"support_data.slant_range_to_last_pixel"
))
// TerraSAR-X geoms (OTB >= 7.4)
Fetch
(
MDNum
::
RangeTimeLastPixel
,
imd
,
"range_last_time"
);
// TerraSAR-X geoms (OTB < 7.4)
if
(
!
CheckFetch
(
MDNum
::
RSF
,
imd
,
"support_data.range_sampling_rate"
))
// TerraSAR-X geoms (OTB >= 7.4)
Fetch
(
MDNum
::
RSF
,
imd
,
"sensor_params.sampling_frequency"
);
// TerraSAR-X geoms (OTB < 7.4)
Fetch
(
MDStr
::
SensorID
,
imd
,
"sensor"
);
imd
.
Add
(
MDStr
::
Instrument
,
"TSX-SAR"
);
// Main XML file
std
::
string
MainFilePath
=
ExtractXMLFiles
::
GetResourceFile
(
itksys
::
SystemTools
::
GetFilenamePath
(
m_MetadataSupplierInterface
->
GetResourceFile
(
""
)),
"T[S|D]X1_SAR__.*.xml"
)
;
if
(
!
MainFilePath
.
empty
())
{
XMLMetadataSupplier
MainXMLFileMS
(
MainFilePath
);
imd
.
Add
(
MDStr
::
OrbitDirection
,
MainXMLFileMS
.
GetAs
<
std
::
string
>
(
"level1Product.productInfo.missionInfo.orbitDirection"
));
imd
.
Add
(
MDNum
::
OrbitNumber
,
MainXMLFileMS
.
GetAs
<
double
>
(
"level1Product.productInfo.missionInfo.absOrbit"
));
imd
.
Add
(
MDNum
::
RSF
,
MainXMLFileMS
.
GetAs
<
double
>
(
"level1Product.productSpecific.complexImageInfo.commonRSF"
));
// Open the georef file containing GCPs
XMLMetadataSupplier
GCPXMLFileMS
(
itksys
::
SystemTools
::
GetParentDirectory
(
MainFilePath
)
+
"/ANNOTATION/GEOREF.xml"
);
//SAR Parameters
SARParam
sarParam
;
sarParam
.
orbits
=
this
->
GetOrbitsGeom
();
sarParam
.
azimuthFmRates
=
this
->
GetAzimuthFmRateGeom
();
sarParam
.
dopplerCentroids
=
this
->
GetDopplerCentroidGeom
();
SARParam
sarParam
;
// Rigth looking flag is always true for TSX products
sarParam
.
rightLookingFlag
=
true
;
// Fetch the GCP
if
(
imd
[
MDStr
::
ProductType
].
find
(
"SSC"
)
!=
std
::
string
::
npos
)
{
ReadGeorefGCP
(
MetaData
::
ReadFormattedDate
(
MainXMLFileMS
.
GetAs
<
std
::
string
>
(
"level1Product.productInfo.sceneInfo.start.timeUTC"
)),
itksys
::
SystemTools
::
GetParentDirectory
(
MainFilePath
)
+
"/ANNOTATION/GEOREF.xml"
,
imd
,
sarParam
);
}
ReadSARSensorModel
(
MainXMLFileMS
,
imd
[
MDStr
::
Polarization
],
sarParam
);
const
std
::
string
supportDataPrefix
=
"support_data."
;
sarParam
.
rangeSamplingRate
=
m_MetadataSupplierInterface
->
GetAs
<
double
>
(
supportDataPrefix
+
"range_sampling_rate"
);
// Scene coordinate
sarParam
.
centerSceneCoord
=
GetSceneCoord
(
*
m_MetadataSupplierInterface
,
"sceneCoord.sceneCenterCoord"
);
for
(
unsigned
int
i
=
0
;
i
<
m_MetadataSupplierInterface
->
GetAs
<
unsigned
int
>
(
"sceneCoord.numberOfSceneCornerCoord"
)
;
++
i
)
{
std
::
stringstream
oss
;
oss
.
str
(
""
);
oss
<<
"sceneCoord.sceneCornerCoord["
<<
i
<<
"]"
;
InfoSceneCoord
isc
=
GetSceneCoord
(
*
m_MetadataSupplierInterface
,
oss
.
str
());
if
(
isc
.
referenceRow
==
1
&&
isc
.
referenceColumn
>
1
)
sarParam
.
urSceneCoord
=
isc
;
else
if
(
isc
.
referenceRow
==
imd
[
MDNum
::
NumberOfLines
]
&&
isc
.
referenceColumn
>
1
)
sarParam
.
lrSceneCoord
=
isc
;
else
if
(
isc
.
referenceRow
==
imd
[
MDNum
::
NumberOfLines
]
&&
isc
.
referenceColumn
==
1
)
sarParam
.
llSceneCoord
=
isc
;
else
sarParam
.
ulSceneCoord
=
isc
;
}
sarParam
.
nearRangeTime
=
m_MetadataSupplierInterface
->
GetAs
<
double
>
(
supportDataPrefix
+
"slant_range_to_first_pixel"
);
sarParam
.
rangeResolution
=
m_MetadataSupplierInterface
->
GetAs
<
double
>
(
supportDataPrefix
+
"range_spacing"
);
sarParam
.
azimuthTimeInterval
=
MetaData
::
Duration
::
Seconds
(
m_MetadataSupplierInterface
->
GetAs
<
double
>
(
supportDataPrefix
+
"line_time_interval"
)
);
//For Terrasar-X only 1 burst is supported for now
BurstRecord
burstRecord
;
burstRecord
.
azimuthStartTime
=
imd
[
MDTime
::
AcquisitionStartTime
];
burstRecord
.
azimuthStopTime
=
imd
[
MDTime
::
AcquisitionStopTime
];
burstRecord
.
startLine
=
0
;
burstRecord
.
endLine
=
static_cast
<
int
>
(
imd
[
MDNum
::
NumberOfLines
])
-
1
;
burstRecord
.
startSample
=
0
;
burstRecord
.
endSample
=
static_cast
<
int
>
(
imd
[
MDNum
::
NumberOfColumns
])
-
1
;
burstRecord
.
azimuthAnxTime
=
0.
;
sarParam
.
burstRecords
.
push_back
(
burstRecord
);
imd
.
Add
(
MDGeom
::
SAR
,
sarParam
);
// Scene coordinate
sarParam
.
centerSceneCoord
=
GetSceneCoord
(
*
m_MetadataSupplierInterface
,
"sceneCoord.sceneCenterCoord"
);
for
(
unsigned
int
i
=
0
;
i
<
m_MetadataSupplierInterface
->
GetAs
<
unsigned
int
>
(
"sceneCoord.numberOfSceneCornerCoord"
)
;
++
i
)
{
std
::
stringstream
oss
;
oss
.
str
(
""
);
oss
<<
"sceneCoord.sceneCornerCoord["
<<
i
<<
"]"
;
InfoSceneCoord
isc
=
GetSceneCoord
(
*
m_MetadataSupplierInterface
,
oss
.
str
());
if
(
isc
.
referenceRow
==
1
&&
isc
.
referenceColumn
>
1
)
sarParam
.
urSceneCoord
=
isc
;
else
if
(
isc
.
referenceRow
==
imd
[
MDNum
::
NumberOfLines
]
&&
isc
.
referenceColumn
>
1
)
sarParam
.
lrSceneCoord
=
isc
;
else
if
(
isc
.
referenceRow
==
imd
[
MDNum
::
NumberOfLines
]
&&
isc
.
referenceColumn
==
1
)
sarParam
.
llSceneCoord
=
isc
;
else
sarParam
.
ulSceneCoord
=
isc
;
}
imd
.
Add
(
MDGeom
::
SAR
,
sarParam
);
SARCalib
sarCalib
;
LoadRadiometricCalibrationData
(
sarCalib
,
*
m_MetadataSupplierInterface
,
imd
);
sarCalib
.
calibrationLookupFlag
=
false
;
imd
.
Add
(
MDGeom
::
SARCalib
,
sarCalib
);
}
void
TerraSarXSarImageMetadataInterface
::
Parse
(
ImageMetadata
&
imd
)
{
// Try to fetch the metadata from GEOM file
if
(
m_MetadataSupplierInterface
->
GetAs
<
std
::
string
>
(
""
,
"sensor"
)
==
"TSX-1"
)
if
(
m_MetadataSupplierInterface
->
GetAs
<
std
::
string
>
(
""
,
"sensor"
)
==
"TSX-1"
||
m_MetadataSupplierInterface
->
GetAs
<
std
::
string
>
(
""
,
"sensor"
)
==
"PAZ-1"
||
m_MetadataSupplierInterface
->
GetAs
<
std
::
string
>
(
""
,
"sensor"
)
==
"TDX-1"
)
this
->
ParseGeom
(
imd
);
// Try to fetch the metadata from GDAL Metadata Supplier
else
...
...
Modules/Core/Metadata/test/CMakeLists.txt
View file @
3d29ed97
...
...
@@ -176,7 +176,8 @@ set(worldview2_geom_file ${INPUTDATA}/wv2/wv2-2.geom)
set
(
quickbird_geom_file
${
INPUTDATA
}
/QB/qb-2.geom
)
set
(
Radarsat2_geom_file
${
INPUTDATA
}
/radarsat2/radarsat2-1.geom
)
set
(
TerraSar_geom_file
${
INPUTDATA
}
/terrasar/terrasar-1.geom
)
#set(CosmoSkyMed_geom_file ${INPUTDATA}/cosmoskymed/cosmoskymed-1.geom)
set
(
CosmoSkyMed_geom_file
${
INPUTDATA
}
/cosmoskymed/cosmoskymed-1.geom
)
set
(
Sentinel1_geom_file
${
INPUTDATA
}
/sentinel1/sentinel1-1.geom
)
foreach
(
sensor
${
sensor_list
}
)
...
...
Modules/Filtering/Projection/test/CMakeLists.txt
View file @
3d29ed97
...
...
@@ -169,7 +169,7 @@ SPOT6/600143101-Primary-Bundle-JP2-LOSSLESS/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_S
QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF
IKONOS/BLOSSEVILLE/po_2619900_nir_0000000.tif
RAPIDEYE/level1B/2008-12-25T005918_RE3_1B-NAC_397971_12345_band3.ntf
SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff
# TODO Reactivate when SARModel is implemented
SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff
)
set
(
TOLERANCE_RATIO
...
...
Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
View file @
3d29ed97
...
...
@@ -1909,10 +1909,6 @@ void GDALImageIO::ExportMetadata()
void
GDALImageIO
::
ImportMetadata
()
{
// TODO
// Check special value METADATATYPE=OTB before continue processing
// Keys Starting with: MDGeomNames[MDGeom::SensorGeometry] + '.' should
// be decoded by the (future) SensorModelFactory.
// Use ImageMetadataBase::FromKeywordlist to ingest the metadata
bool
hasValue
;
if
(
std
::
string
(
GetMetadataValue
(
"METADATATYPE"
,
hasValue
))
!=
"OTB"
)
...
...
Modules/IO/TestKernel/src/otbTestHelper.cxx
View file @
3d29ed97
...
...
@@ -1628,8 +1628,8 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char
if
(
blImPtr
->
GetGCPProjection
().
compare
(
testImPtr
->
GetGCPProjection
())
!=
0
)
{
std
::
cerr
<<
"The gcp projection of the baseline image and Test image do not match!"
<<
std
::
endl
;
std
::
cerr
<<
"baseline image: "
<<
baselineImageFilename
<<
" has gcp projection "
<<
blImPtr
->
GetGCPProjection
()
<<
std
::
endl
;
std
::
cerr
<<
"Test image: "
<<
testImageFilename
<<
" has gcp projection "
<<
testImPtr
->
GetGCPProjection
()
<<
std
::
endl
;
std
::
cerr
<<
"baseline image: "
<<
baselineImageFilename
<<
" has gcp projection
'
"
<<
blImPtr
->
GetGCPProjection
()
<<
"'
\n
'"
;
std
::
cerr
<<
"Test image: "
<<
testImageFilename
<<
" has gcp projection
'
"
<<
testImPtr
->
GetGCPProjection
()
<<
"'
\n
"
;
errcount
++
;
}
...
...
@@ -1643,29 +1643,30 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char
}
else
{
double
tol
=
0.0000001
;
for
(
unsigned
int
i
=
0
;
i
<
blImPtr
->
GetGCPCount
();
++
i
)
{
if
((
blImPtr
->
GetGCPId
(
i
).
compare
(
testImPtr
->
GetGCPId
(
i
))
!=
0
)
||
(
blImPtr
->
GetGCPInfo
(
i
).
compare
(
testImPtr
->
GetGCPInfo
(
i
))
!=
0
)
||
(
blImPtr
->
GetGCPRow
(
i
)
!=
testImPtr
->
GetGCPRow
(
i
))
||
(
blImPtr
->
GetGCPCol
(
i
)
!=
testImPtr
->
GetGCPCol
(
i
))
||
(
blImPtr
->
GetGCPX
(
i
)
!=
testImPtr
->
GetGCPX
(
i
))
||
(
blImPtr
->
GetGCPY
(
i
)
!=
testImPtr
->
GetGCPY
(
i
))
||
(
blImPtr
->
GetGCPZ
(
i
)
!=
testImPtr
->
GetGCPZ
(
i
)))
(
blImPtr
->
GetGCPX
(
i
)
-
testImPtr
->
GetGCPX
(
i
)
>
tol
)
||
(
blImPtr
->
GetGCPY
(
i
)
-
testImPtr
->
GetGCPY
(
i
)
>
tol
)
||
(
blImPtr
->
GetGCPZ
(
i
)
-
testImPtr
->
GetGCPZ
(
i
)
>
tol
))
{
std
::
cerr
<<
"The GCP number "
<<
i
<<
" of the baseline image and Test image do not match!"
<<
std
::
endl
;
std
::
cerr
<<
"baseline image: "
<<
baselineImageFilename
<<
" has gcp number "
<<
i
<<
" ("
<<
"id: "
<<
blImPtr
->
GetGCPId
(
i
)
<<
", "
<<
"info: "
<<
blImPtr
->
GetGCPInfo
(
i
)
<<
", "
<<
"row: "
<<
blImPtr
->
GetGCPRow
(
i
)
<<
", "
<<
"col: "
<<
blImPtr
->
GetGCPCol
(
i
)
<<
", "
<<
"X: "
<<
blImPtr
->
GetGCPX
(
i
)
<<
", "
<<
"Y: "
<<
blImPtr
->
GetGCPY
(
i
)
<<
", "
<<
"Z: "
<<
blImPtr
->
GetGCPZ
(
i
)
<<
")"
<<
std
::
endl
;
<<
"id:
'
"
<<
blImPtr
->
GetGCPId
(
i
)
<<
"
'
, "
<<
"info:
'
"
<<
blImPtr
->
GetGCPInfo
(
i
)
<<
"
'
, "
<<
"row:
'
"
<<
blImPtr
->
GetGCPRow
(
i
)
<<
"
'
, "
<<
"col:
'
"
<<
blImPtr
->
GetGCPCol
(
i
)
<<
"
'
, "
<<
"X:
'
"
<<
blImPtr
->
GetGCPX
(
i
)
<<
"
'
, "
<<
"Y:
'
"
<<
blImPtr
->
GetGCPY
(
i
)
<<
"
'
, "
<<
"Z:
'
"
<<
blImPtr
->
GetGCPZ
(
i
)
<<
"
'
)"
<<
std
::
endl
;
std
::
cerr
<<
"Test image: "
<<
testImageFilename
<<
" has gcp number "
<<
i
<<
" ("
<<
"id: "
<<
testImPtr
->
GetGCPId
(
i
)
<<
", "
<<
"info: "
<<
testImPtr
->
GetGCPInfo
(
i
)
<<
", "
<<
"row: "
<<
testImPtr
->
GetGCPRow
(
i
)
<<
", "
<<
"col: "
<<
testImPtr
->
GetGCPCol
(
i
)
<<
", "
<<
"X: "
<<
testImPtr
->
GetGCPX
(
i
)
<<
", "
<<
"Y: "
<<
testImPtr
->
GetGCPY
(
i
)
<<
", "
<<
"Z: "
<<
testImPtr
->
GetGCPZ
(
i
)
<<
")"
<<
std
::
endl
;
<<
"id:
'
"
<<
testImPtr
->
GetGCPId
(
i
)
<<
"
'
, "
<<
"info:
'
"
<<
testImPtr
->
GetGCPInfo
(
i
)
<<
"
'
, "
<<
"row:
'
"
<<
testImPtr
->
GetGCPRow
(
i
)
<<
"
'
, "
<<
"col:
'
"
<<
testImPtr
->
GetGCPCol
(
i
)
<<
"
'
, "
<<
"X:
'
"
<<
testImPtr
->
GetGCPX
(
i
)
<<
"
'
, "
<<
"Y:
'
"
<<
testImPtr
->
GetGCPY
(
i
)
<<
"
'
, "
<<
"Z:
'
"
<<
testImPtr
->
GetGCPZ
(
i
)
<<
"
'
)"
<<
std
::
endl
;
errcount
++
;
}
}
...
...
@@ -1675,7 +1676,7 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char
const
auto
&
testImageMetadata
=
testImPtr
->
GetImageMetadata
();
// Compare string keys (strict equality)
// Don't test OTB_VERSION, as it change with the version of OTB used
// Don't test OTB_VERSION, as it change
s
with the version of OTB used
std
::
vector
<
MDStr
>
untestedMDStr
=
{
MDStr
::
OtbVersion
};
errcount
+=
CompareMetadataDict
(
baselineImageMetadata
.
StringKeys
,
testImageMetadata
.
StringKeys
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment