diff --git a/include/otbTensorflowMultisourceModelBase.hxx b/include/otbTensorflowMultisourceModelBase.hxx index f0d414b6ef72b85ccb6e413f2a620535da80e50e..b67d92234f4b57f6100e69dad95fe47e8dfea92a 100644 --- a/include/otbTensorflowMultisourceModelBase.hxx +++ b/include/otbTensorflowMultisourceModelBase.hxx @@ -192,6 +192,18 @@ TensorflowMultisourceModelBase<TInputImage, TOutputImage>::GenerateOutputInforma << " and the number of input tensors names is " << m_InputPlaceholders.size()); } + // Check that no-data values size is consistent with the inputs + // If no value is specified, set a vector of the same size as the inputs + if (m_InputNodataValues.size() == 0 && m_InputHasNodata.size() == 0) + { + m_InputHasNodata = BoolListType(nbInputs, false); + m_InputNodataValues = ValueListType(nbInputs, 0.0); + } + if (nbInputs != m_InputNodataValues.size() || nbInputs != m_InputNodataValues.size()) + { + itkExceptionMacro("Number of input images is " << nbInputs << " but the number of no-data values is not consistent"); + } + ////////////////////////////////////////////////////////////////////////////////////////// // Get tensors information //////////////////////////////////////////////////////////////////////////////////////////