From: tbaudier Date: Thu, 25 Feb 2016 14:25:33 +0000 (+0100) Subject: Change the origin of registered cropped image in clitkCropImage X-Git-Tag: v1.4.0~43 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=ac538b72507046befd497a70d9545f824724372b;p=clitk.git Change the origin of registered cropped image in clitkCropImage --- diff --git a/tools/clitkCropImageGenericFilter.cxx b/tools/clitkCropImageGenericFilter.cxx index ede4007..0e2818a 100644 --- a/tools/clitkCropImageGenericFilter.cxx +++ b/tools/clitkCropImageGenericFilter.cxx @@ -183,8 +183,7 @@ void clitk::CropImageGenericFilter::UpdateWithInputImageType() typename ImageType::PointType origin = output->GetOrigin(); typename ImageType::SpacingType spacing = output->GetSpacing(); if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl; - for (unsigned int i = 0; i < output->GetImageDimension(); i++) - origin[i] += index[i]*spacing[i]; + input->TransformIndexToPhysicalPoint(index,origin); if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl; output->SetOrigin(origin);