From: tbaudier Date: Mon, 5 Mar 2018 10:39:26 +0000 (+0100) Subject: close #57 The origin is modify in autoCrop, do not modify it again in cropFilter X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=54b1d547551dcaeba536ce59104db998e9c40719;p=clitk.git close #57 The origin is modify in autoCrop, do not modify it again in cropFilter --- 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);