From 768e7862c59336f3c0222f2d98b184919330e668 Mon Sep 17 00:00:00 2001 From: remi cresson <remi.cresson@teledetection.fr> Date: Mon, 5 Feb 2018 09:52:00 +0000 Subject: [PATCH] FIX: enforce new ITK rule against pixel spacing --- app/otbExtractGeom.cxx | 2 +- include/otbVectorDataToLabelImageCustomFilter.hxx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/otbExtractGeom.cxx b/app/otbExtractGeom.cxx index 9a52f59..648741f 100644 --- a/app/otbExtractGeom.cxx +++ b/app/otbExtractGeom.cxx @@ -201,7 +201,7 @@ public: m_RasterizeFilter = RasteriseFilterType::New(); m_RasterizeFilter->AddVectorData(m_VectorDataReprojectionFilter->GetOutput()); m_RasterizeFilter->SetOutputOrigin(xs->GetOrigin()); - m_RasterizeFilter->SetOutputSpacing(xs->GetSpacing()); + m_RasterizeFilter->SetOutputSpacing(xs->GetSignedSpacing()); m_RasterizeFilter->SetOutputSize(xs->GetLargestPossibleRegion().GetSize()); m_RasterizeFilter->SetBurnMaxValueMode(true); m_RasterizeFilter->SetOutputProjectionRef(xs->GetProjectionRef()); diff --git a/include/otbVectorDataToLabelImageCustomFilter.hxx b/include/otbVectorDataToLabelImageCustomFilter.hxx index a68d71a..5503472 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->SetOutputSpacing ( src->GetSpacing() ); + this->SetOutputSignedSpacing ( 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->SetSpacing(m_OutputSpacing); + outputPtr->SetSignedSpacing(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()->GetSpacing()[0]; - geoTransform[5] = this->GetOutput()->GetSpacing()[1]; + geoTransform[1] = this->GetOutput()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetOutput()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters geoTransform[2] = 0.; -- GitLab