Refactor SAR sensor models
Part of the sensor model refactoring.
The Sar functionalites should be refactored to become independent of Ossim.
SAR model
Metadata parsing
SARImageMetadataInterface : use of ossimSarSensorModel
to parse metadata, it has already been refactored to rely on GDAL instead of Ossim for metadata parsing, metadata parsing from geom file is still to be implemented.
While other sensors models are implemented in QGIS plugin, OTB currently uses 4 SAR sensor models:
- Sentinel 1
- RadarSat 2
- TerraSar-X
- CosmoSkyMed
The metadata parsing has been implemented in !761 (merged)
Support for geom files should still be added. TODO: can this be done for all sensors at once ? Or do we need to implement geom sensor by sensor ? (this was required for Optical Sensor Models, because each sensor had specific keys and needed post-processing)
ossimSARSensorModel
SAR processing in OTB is based on Ossim. Most SAR classes are implemented in the OssimPlugins module. The ossimSarSensorModel
, deriving from ossimSensorModel
from Ossim is the main virtual class used for SAR functionalities and SAR metadata reading.
SARSensorModelAdapters : Adapter class for ossimSarSensorModel processing functions, it defines the following methods :
bool LoadState(const ImageKeywordlist& image_kwl);
bool SaveState(ImageKeywordlist& image_kwl);
bool IsValidSensorModel() const;
bool Deburst(std::vector<std::pair<unsigned long, unsigned long>>& lines, std::pair<unsigned long, unsigned long>& samples, bool onlyValidSample = false);
bool BurstExtraction(const unsigned int burst_index, std::pair<unsigned long, unsigned long>& lines, std::pair<unsigned long, unsigned long>& samples, bool allPixels = false);
bool DeburstAndConcatenate(std::vector<std::pair<unsigned long, unsigned long>>& linesBursts, std::vector<std::pair<unsigned long, unsigned long>>& samplesBursts, unsigned int& linesOffset, unsigned int first_burstInd, bool inputWithInvalidPixels = false);
bool Overlap(std::pair<unsigned long, unsigned long>& linesUp, std::pair<unsigned long, unsigned long>& linesLow,
std::pair<unsigned long, unsigned long>& samplesUp, std::pair<unsigned long, unsigned long>& samplesLow, unsigned int burstIndUp,bool inputWithInvalidPixels = false);
bool WorldToLineSampleYZ(const Point3DType& inGeoPoint, Point2DType& cr, Point2DType& yz) const;
bool WorldToLineSample(const Point3DType& inGEoPOint, Point2DType& cr) const;
bool WorldToSatPositionAndVelocity(const Point3DType& inGeoPoint, Point3DType& satellitePosition, Point3DType& satelliteVelocity) const;
bool LineToSatPositionAndVelocity(const double line, Point3DType& satellitePosition, Point3DType& satelliteVelocity) const;
static bool WorldToCartesian(const Point3DType& inGeoPoint, Point3DType& outCartesianPoint);
static bool ImageLineToDeburstLine(const std::vector<std::pair<unsigned long, unsigned long>>& lines, unsigned long imageLine, unsigned long& deburstLine);
static void DeburstLineToImageLine(const std::vector<std::pair<unsigned long, unsigned long>>& lines, unsigned long deburstLine, unsigned long& imageLine);
ossimSARSensorModel is implemented by 3 sensor:
- ossimSentinel1Model
- ossimCosmoSkyMedModel
- ossimTerraSarXModel
ossimGeometricSARSensorModel
ossimGeometricSARSensorModel is another implementation of SAR models in OssimPlugins, it is used by older sensors (?), including:
- ossimRadarSatModel
- ossimRadarSat2Model
- ossimAlosPalsarModel
- ossimErsSarModel
- ossimEnvisatASarModel
while ossimGeometricSARSensorModel is not used by SARSensorModelAdapters, it is available through the ossimPlugins projection factory, which means OTB is able to transform sensor points to/from geo points for these sensors. As metadata parsing is not implemented (it has been removed at some point ?) for these models (excepting RadarSat2), it is only possible to use these sensor by providing a geom file containing the required metadata to instantiate the ossimSensorModel. These sensor are not tested in OTB.
Questions:
- are AlosPalsar, ErsSar, Envisat Asar and RadarSat deprecated ? Should we support them in OTB 8.0 ?
- There is a RPC model defined in RadarSat 2 metadata, can we use it ? There is a ossimRadarSat2RPCModel, but it is not used by the ossimProjection factory.
Refactoring plan
-
#2158 (closed) >> Bug in TerraSar-X calibration -
#2154 (closed) >> Implement SAR metadata parsing from geom files. -
#2159 (closed) >> Use ImageMetadata in SarCalibration filters -
#2150 (closed) >> Implement a factory for SensorTransformBase (only RPCForwardTransform and RPCInverseTransform are defined at this point), and use it in GenericRSTransform
. -
#2160 (closed) >> Implement otb::SarSensorModel
, this class provides the same algorithms asSARSensorModelAdapters
. This is the main issue of the refactoring, and it requires refinement. -
#2151 (closed) >> Implement otb::SarForwardTransform
andotb::SarInverseTransform
deriving fromSensorTransformBase
, usingotb::SarSensorModel
to map points -
#2152 (closed) >> Refactor SAR filter and application to use otb::SarSensorModel
,otb::SarForwardTransform
andotb::SarInverseTransform
. -
Implement(out of scope of version 8.0)otb::SarGeometricSensorModel
? -
#2153 (closed) >> Remove Ossim based SAR classes (including OssimPlugins)
While most of the code is in QGISPlugins and can be reused easily (some Ossim data structure should be refactored, and ITK or the standard library should be used), some functionalities might require more work, in particular, SAR model uses a lot of point projections utilities from Ossim, maybe Proj can be used as a replacement for these functionalities.
The impact of the refactoring on DiapOTB should also be investigated.
Tests
Test should be added for all methods implemented in SarSensorModel
test should also be added for otb::SarForwardTransform
and otb::SarInverseTransform
with different sensors. The baseline for these tests will be generated with Ossim and OTB 7.2.0.
Some test have been deactivated while implementing the geom file reading (!759 (merged)), because they rely heavily on the new SAR model. We need to reactivate them while implementing this model.
- saTvSarDeburstImageFilterTest
- saTvSarDeburstImageFilterTest2
- saTvSarDeburstImageFilterTest3
- saTvSarBurstExtractionImageFilterTest1
- saTvSarBurstExtractionImageFilterTest2
- prTvSensorModel_ers2-1
- prTvSensorModel_sentinel1-1
- prTvOrthoRectification_sentinel1_DEMGTIFF
- prTvOrthoRectification_sentinel1_DEMSRTM
- prTvOrthoRectification_sentinel1_noDEM
- otbSARAmplitudeEstimationImageFilterTest (DiapOTB)
- otbSARAmplitudeEstimationTest (DiapOTB)
- otbSARCartesianMeanEstimationTest (DiapOTB)