From eb146025de851586e631d22703611c05bbdc94d7 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Thu, 12 Jun 2014 18:16:35 +0200 Subject: [PATCH] BUG: Mantis-942: conversion between GDAL geotransform and OTB origin/spacing --- Code/Common/otbLabelImageToVectorDataFilter.txx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Common/otbLabelImageToVectorDataFilter.txx b/Code/Common/otbLabelImageToVectorDataFilter.txx index f512ced726..6a5f9f82e9 100644 --- a/Code/Common/otbLabelImageToVectorDataFilter.txx +++ b/Code/Common/otbLabelImageToVectorDataFilter.txx @@ -164,8 +164,8 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> IndexType bufferIndexOrigin = this->GetInput()->GetBufferedRegion().GetIndex(); OriginType bufferOrigin; this->GetInput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSpacing()[1]; geoTransform[1] = this->GetInput()->GetSpacing()[0]; geoTransform[5] = this->GetInput()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters @@ -234,8 +234,8 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> // the spacing is unchanged, the origin is relative to the buffered region bufferIndexOrigin = this->GetInputMask()->GetBufferedRegion().GetIndex(); this->GetInputMask()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSpacing()[1]; geoTransform[1] = this->GetInputMask()->GetSpacing()[0]; geoTransform[5] = this->GetInputMask()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters -- GitLab