Request for Changes-8: Add support for CosmoSkymed Product

From OTBWiki
Jump to: navigation, search


Status

References:

Summary

COSMO-Skymed (Italy) was the radar component mentioned in ORFEO program but this is not supported yet in OrfeoToolBox. This RFC proposes a metadata interface class for reading CosmoSkymed radar product. It is important to note that processing of metadata is handled by GDAL library and not by OSSIM. The current implementation reads all metadata information from hdf file, read and write a .geom file. More details about .geom file below. Reading metadata through ossim like all other need a proper hdf5 driver in ossim. Unfortunately ossim core lib does not have this option. There is an ossim-plugins called hdf_plugin which adds complexity of maintaining the plugin inside ThirdParty/ossimPlugins/src/. Infact, all metadata parsed by ossim is kept in a single ossimKeywordlist and then stored in itk::MetadataDictionary. so If GDAL has all metadata and it stores them in itk::MetadataDictonary then why shouldn't we use it?. The RFC also propose a solution for handling .geom file without OSSIM.

Rationale

Read Cosmoskymed product in OTB. We focus mainly on getting metadata values used in SAR calibration.

Implementation details

This product comes in .h5 format and a thus demands a working hdf5 driver. GDAL has for reading .h5 files. Plus it also does a good job in reading metadata associated with hdf5 files. OTB already reads all metadata in GDALImageIO when opening any of the GDAL supported raster formats. This is then copied to itk::MetadataDictonary . see the implementation of ImageFileReader::InternalReadImageInformation(). The RFC adds some changes in the way OTB read and store metadata. Infact, we find the current read-write mechanism of metadata in OTB very inefficient when one has to directly access them.


Classes and files

ThirdParty/OssimPlugins/src/ossim/ Existing ossimCosmoSkymedModel is of no use so far. It cannot read the product but has some function to read an existing .geom file associated with a cosmoskymed product. There is no point in having these files except creates some confusion for developers.

D ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp
D ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.h

Modules/IO/

  • IOGDAL/src/otbGDALImageIO.cxx
  • IOJPEG2000/src/otbJPEG2000ImageIO.cxx

GDALImageIO saves metadata into itk::MetadataDictonary as Metadata_<count> "Key=Value". And later when writing metadata to output dataset. It split "Key=Value" to "key" and "value" and save via dataset->SetMetadataItem(key, value). Well, even though this "works" in the sense that metadata is read and written. It is not useful in case the developer want to get access to a particular metadata item. One needs to parse through every Metadata_*, split key=value and so on. The better option is to save it as Metadata.Key=Value . (eg: Metadata.MISSION_ID = CSK). This way it is easy to check for a key and read the correct values. When writing(::InternalWriteImageInformation) there is a check if the metadata key starts with "Metadata." and then it write the Metadata in GDAL dataset. The change in IOJPEG2000 is same as that of GDALImageIO.

  • IOGDAL/otb-module.cmake

change dependency to boost via OTBBoostAdapters. OTBBoost -> OTBBoostAdapters [1]

  • ImageBase/include/otbImageFileReader.txx

Read .geom file in case ossim cannot read it

  • ImageBase/include/otbImageFileWriter.txx

Read .geom file in case ossim cannot write it

Applications

  • ReadImageInfo

This application now reports the subdatasets if avaialable.

Tests

Three tests are added: Modules/Core/Metadata/

  1. ioTuCosmoSkymedImageMetadataInterfaceNew - test creation of metadatainterface class
  2. ioTvImageMetadataInterfaceBaseTest_COSMOSKYMED - test metadata read from a CosmoSkymed product. (Baseline pushed in OTB LargeInput)
  3. ioTvSarCalibrationLookupDataTest_COSMOSKYMED - test to check lookupdata value from CosmoSkymedImageMetadataInterface

Note that second test is not executed on dashboard because it required OTB_USE_LARGE_INPUT!

Baseline and inputs required for the above tests has been added to OTB-Data repository.

Baseline/OTB/Files/ioTvSarCalibrationLookupDataTest_COSMOSKYMED.txt

Baseline data to check ioTvSarCalibrationLookupDataTest_COSMOSKYMED test.

Input/COSMOSKYMED_extract_300_300.tif

A 300x300 extract of COSMOSKYMED data for ioTvSarCalibrationLookupDataTest_COSMOSKYMED test.

Input/COSMOSKYMED_extract_300_300.geom

.geom file for the above 300x300 extract.

Baseline/OTB/Files/ioTvImageMetadataInterfaceBase_COSMOSKYMED.txt

Baseline for ioTvImageMetadataInterfaceBase_COSMOSKYMED test.

Documentation

Additional notes

Note: SENTINEL-1 L2 data is netcdf format and we have same situation as reading .h5 files there also.