From 55f33218d418d30d5c66ec00b885c38c71bcd202 Mon Sep 17 00:00:00 2001 From: Remi Cresson <remi.cresson@irstea.fr> Date: Sun, 11 Apr 2021 22:13:11 +0200 Subject: [PATCH] ENH: maximise largest possible region of output image, thanks to expression field --- include/otbTensorflowMultisourceModelFilter.hxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/otbTensorflowMultisourceModelFilter.hxx b/include/otbTensorflowMultisourceModelFilter.hxx index 0a93ee4..2e60fc9 100644 --- a/include/otbTensorflowMultisourceModelFilter.hxx +++ b/include/otbTensorflowMultisourceModelFilter.hxx @@ -230,16 +230,15 @@ TensorflowMultisourceModelFilter<TInputImage, TOutputImage> m_OutputOrigin[0] = extentInf[0] + 0.5 * this->GetInput(0)->GetSpacing()[0]; m_OutputOrigin[1] = extentSup[1] - 0.5 * this->GetInput(0)->GetSpacing()[1]; - // The top-left corner of the first pixel starts at min(input_0_origin - input_0_rfield/2, ..., input_n_origin - input_n_rfield/2) - // We should take in account one more thing: the expression field. It enlarge slightly the output image extent. - // TODO: - // - update origin - // - update size - // Set final size m_OutputSize[0] = std::floor( (extentSup[0] - extentInf[0]) / std::abs(m_OutputSpacing[0]) ); m_OutputSize[1] = std::floor( (extentSup[1] - extentInf[1]) / std::abs(m_OutputSpacing[1]) ); + // We should take in account one more thing: the expression field. It enlarge slightly the output image extent. + m_OutputOrigin[0] -= m_OutputSpacing[0] * std::floor(0.5 * this->GetOutputExpressionFields().at(0)[0]); + m_OutputOrigin[1] -= m_OutputSpacing[1] * std::floor(0.5 * this->GetOutputExpressionFields().at(0)[1]); + m_OutputSize[0] += this->GetOutputExpressionFields().at(0)[0] - 1; + m_OutputSize[1] += this->GetOutputExpressionFields().at(0)[1] - 1; // Set output grid size if (!m_ForceOutputGridSize) -- GitLab