From 5b958034376fb084cf85362926216533fc08fa52 Mon Sep 17 00:00:00 2001
From: Lozac'h Loic <loic.lozach@irstea.fr>
Date: Tue, 26 May 2020 10:17:28 +0200
Subject: [PATCH] FIX: issue with SignedSpacing

---
 include/otbCacheLessLabelImageToVectorData.txx    | 2 +-
 include/otbMeanResampleImageFilter.hxx            | 8 ++++----
 include/otbVectorDataToLabelImageCustomFilter.hxx | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/otbCacheLessLabelImageToVectorData.txx b/include/otbCacheLessLabelImageToVectorData.txx
index 8a6d39f..8573068 100644
--- a/include/otbCacheLessLabelImageToVectorData.txx
+++ b/include/otbCacheLessLabelImageToVectorData.txx
@@ -201,7 +201,7 @@ CacheLessLabelImageToVectorData<TInputImagePixel>
   bufferedInputImage->SetRegions(inputRegion);
   bufferedInputImage->Allocate();
   bufferedInputImage->SetMetaDataDictionary(inputPtr->GetMetaDataDictionary());
-  bufferedInputImage->SetSpacing(inputPtr->GetSignedSpacing());
+  bufferedInputImage->SetSignedSpacing(inputPtr->GetSignedSpacing());
   bufferedInputImage->SetOrigin (inputPtr->GetOrigin() );
 
 
diff --git a/include/otbMeanResampleImageFilter.hxx b/include/otbMeanResampleImageFilter.hxx
index 168ab99..0d2e396 100644
--- a/include/otbMeanResampleImageFilter.hxx
+++ b/include/otbMeanResampleImageFilter.hxx
@@ -43,15 +43,15 @@ MeanResampleImageFilter<TImage>
 
   // The new output image has the same origin
   ImagePointType origin = inputImage->GetOrigin();
-  origin[0] += 0.5 * inputImage->GetSignedSpacing()[0] * (m_StepX - 1);
-  origin[1] += 0.5 * inputImage->GetSignedSpacing()[1] * (m_StepY - 1);
+  origin[0] += 0.5 * inputImage->GetSpacing()[0] * (m_StepX - 1);
+  origin[1] += 0.5 * inputImage->GetSpacing()[1] * (m_StepY - 1);
   outputPtr->SetOrigin ( origin );
 
   // New spacing for the output image
-  ImageSpacingType spacing = inputImage->GetSignedSpacing();
+  ImageSpacingType spacing = inputImage->GetSpacing();
   spacing[0] *= m_StepX;
   spacing[1] *= m_StepY;
-  outputPtr->SetSignedSpacing (spacing);
+  outputPtr->SetSpacing (spacing);
 
   // New size for the output image
   ImageRegionType inRegion = inputImage->GetLargestPossibleRegion();
diff --git a/include/otbVectorDataToLabelImageCustomFilter.hxx b/include/otbVectorDataToLabelImageCustomFilter.hxx
index 5503472..017d07a 100644
--- a/include/otbVectorDataToLabelImageCustomFilter.hxx
+++ b/include/otbVectorDataToLabelImageCustomFilter.hxx
@@ -119,7 +119,7 @@ VectorDataToLabelImageCustomFilter<TVectorData, TOutputImage>
 ::SetOutputParametersFromImage(const ImageBaseType * src)
  {
   this->SetOutputOrigin ( src->GetOrigin() );
-  this->SetOutputSignedSpacing ( src->GetSignedSpacing() );
+  this->SetOutputSpacing ( src->GetSignedSpacing() );
   this->SetOutputSize ( src->GetLargestPossibleRegion().GetSize() );
   otb::ImageMetadataInterfaceBase::Pointer imi = otb::ImageMetadataInterfaceFactory::CreateIMI(src->GetMetaDataDictionary());
   this->SetOutputProjectionRef(imi->GetProjectionRef());
@@ -144,7 +144,7 @@ VectorDataToLabelImageCustomFilter<TVectorData, TOutputImage>
   outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion);
 
   // Set spacing and origin
-  outputPtr->SetSignedSpacing(m_OutputSpacing);
+  outputPtr->SetSpacing(m_OutputSpacing);
   outputPtr->SetOrigin(m_OutputOrigin);
 
   itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary();
@@ -295,8 +295,8 @@ VectorDataToLabelImageCustomFilter<TVectorData, TOutputImage>::GenerateData()
   this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin);
   geoTransform[0] = bufferOrigin[0];
   geoTransform[3] = bufferOrigin[1];
-  geoTransform[1] = this->GetOutput()->GetSignedSpacing()[0];
-  geoTransform[5] = this->GetOutput()->GetSignedSpacing()[1];
+  geoTransform[1] = this->GetOutput()->GetSpacing()[0];
+  geoTransform[5] = this->GetOutput()->GetSpacing()[1];
 
   // FIXME: Here component 1 and 4 should be replaced by the orientation parameters
   geoTransform[2] = 0.;
-- 
GitLab