Python Wrapper: issue to generate intermediate results of a pipeline
Description
Hi,
We have noticed that we cannot write intermediate outputs from a pipeline composed of OTB applications, from the python wrapper. Let App1 and App2 two OTB applications.
- App1 inputs the input.tif geotiff file, and write the out1.tif geotiff file
- App2 inputs App1 output, and write the out2.tif geotiff file
It is not possible to write out1.tif and out2.tif once the entire pipeline has been created (with Execute()
calls after setting App1 and App2)
graph LR;
'input.tif'-->App1
App1-->App2;
App1-->'out1.tif';
App2-->'out2.tif';
Steps to reproduce
bug.py:
import otbApplication
# Pipeline creation
app1 = otbApplication.Registry.CreateApplication("ManageNoData")
app1.SetParameterString("mode", "changevalue")
app1.SetParameterString("in", "input.tif")
app1.Execute()
app2 = otbApplication.Registry.CreateApplication("BandMath")
app2.AddImageToParameterInputImageList("il", app1.GetParameterOutputImage("out"))
app2.SetParameterString("exp", "im1b1")
app2.Execute()
# Later, we want to execute this pipeline
scenario = 3 # Change the value (1, 2 or 3)
if scenario == 1:
# This if OK
app1.SetParameterString("out", "out1.tif")
app1.ExecuteAndWriteOutput()
elif scenario == 2:
# This is OK
app2.SetParameterString("out", "app2.tif")
app2.ExecuteAndWriteOutput()
elif scenario == 3:
# This is NOT OK
app1.SetParameterString("out", "out1.tif")
app1.ExecuteAndWriteOutput()
app2.SetParameterString("out", "app2.tif")
app2.ExecuteAndWriteOutput()
Results in an ITK exception for scenario = 3
:
itk::ERROR: Region ImageRegion (0x7ffe0da89c10)
Dimension: 2
Index: [0, 0]
Size: [81, 11]
is outside of buffered region ImageRegion (0x1150f80)
Dimension: 2
Index: [0, 0]
Size: [0, 0]
Is this behavior expected?
Configuration information
OTB 7.4.0 Ubuntu 20.04
Edited by Rémi Cresson