Application engine: `ExecuteAndWriteOutputs()` does modify `m_ExecuteDone` but not `WriteOutputs()`
Description
ExecuteAndWriteOutputs()
does modify m_ExecuteDone
but not WriteOutputs()
.
Since !932 (merged), this cause an issue in the following use-case:
- set a filename for an output parameter image,
- directly use
WriteOutput()
, - access output parameters (e.g. image metadata or size)
Since UpdateParameter()
is called when the filename is set, the m_ExecuteDone
is set back to false
.
Even if the Execute()
has been properly called before setting the filename.
Steps to reproduce
Code
import otbApplication
img_pth = "/vsicurl/https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Input/SP67_FR_subset_1.tif?inline=false"
app = otbApplication.Registry.CreateApplication("BandMath")
app.SetParameterStringList("il", [img_pth])
app.SetParameterString("exp", "im1b1")
app.Execute()
print(app.GetImageSize("out")) # WORKS
app.SetParameterString("out", "/tmp/toto.tif")
#print(app.GetImageSize("out")) # ERROR, but LGTM (parameters have been modified). Not a bug.
app.WriteOutput()
print(app.GetImageSize("out")) # ERROR: this is a bug since the whole pipeline has been executed.
# If we had used app.ExecuteAndWriteOutput() instead of
# app.WriteOutput(), it would not have raised the error.
Output
itk::ERROR: BandMath(0x12d7870): Call Execute() or ExecuteAndWriteOutput() before trying to reach output image information
Configuration information
Ubuntu 20.04, Any OTB develop branch after !932 (merged)
Edited by Rémi Cresson