`GetImageMetaData` of Python API isn't updated after the execution of an app
Short description
When using the Phython API, I noticed that the geographic information returned by GetImageMetaData didn't seem to be updated when using ExtractROI
.
Example
Let's consider the case where I want to extract a portion (the red rectangle) of the image Data/Input/QB_Toulouse_Ortho_XS.tif
:
In Python, the code would be :
import otbApplication
image = 'QB_Toulouse_Ortho_XS.tif'
extracted = otbApplication.Registry.CreateApplication('ExtractROI')
extracted.SetParameterString('in', image)
extracted.SetParameterString('mode', 'extent')
extracted.SetParameterString('mode.extent.unit', 'phy')
extracted.SetParameterFloat('mode.extent.ulx', 374200)
extracted.SetParameterFloat('mode.extent.uly', 4829150)
extracted.SetParameterFloat('mode.extent.lrx', 374400)
extracted.SetParameterFloat('mode.extent.lry', 4829000)
If I use the python API (https://www.orfeo-toolbox.org/CookBook/PythonAPI.html#interactions-with-otb-pipeline) to get the ImageOrigin of extracted
:
extracted.Execute()
extracted.GetImageOrigin('out')
it returns [374200.0805558205,4829150.094438392], which is what I expected
However, if I use this python API to get the Upper Left coordinates of extracted
, via GetImageMetaData
method :
extracted.Execute()
print(extracted.GetImageMetaData('out')['UpperLeftCorner'])
The result is (374149.9805558205, 4829183.994438391), whereas I was expecting (374200, 4829150).
Is it normal that the dictionary of GetImageMetaData
is not updated ? Am I supposed to use it or should I stick to GetImageOrigin, GetImageSpacing etc... ?