From 54b1d547551dcaeba536ce59104db998e9c40719 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Mon, 5 Mar 2018 11:39:26 +0100 Subject: [PATCH] close #57 The origin is modify in autoCrop, do not modify it again in cropFilter --- tools/clitkCropImageGenericFilter.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/clitkCropImageGenericFilter.cxx b/tools/clitkCropImageGenericFilter.cxx index 0e2818a..c3343f6 100644 --- a/tools/clitkCropImageGenericFilter.cxx +++ b/tools/clitkCropImageGenericFilter.cxx @@ -182,10 +182,12 @@ void clitk::CropImageGenericFilter::UpdateWithInputImageType() typename ImageType::IndexType index = region.GetIndex(); typename ImageType::PointType origin = output->GetOrigin(); typename ImageType::SpacingType spacing = output->GetSpacing(); - if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl; - input->TransformIndexToPhysicalPoint(index,origin); - if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl; - output->SetOrigin(origin); + if (!mArgsInfo.BG_given) { + if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl; + input->TransformIndexToPhysicalPoint(index,origin); + if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl; + output->SetOrigin(origin); + } index.Fill(itk::NumericTraits::Zero); region.SetIndex(index); -- 2.47.1