]> Creatis software - clitk.git/commitdiff
close #57 The origin is modify in autoCrop, do not modify it again in cropFilter
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 5 Mar 2018 10:39:26 +0000 (11:39 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 5 Mar 2018 10:39:26 +0000 (11:39 +0100)
tools/clitkCropImageGenericFilter.cxx

index 0e2818ac67e4d3584e20891545aa37d641ce0fba..c3343f6d3913b073a5bdec7070676e75366cf8ed 100644 (file)
@@ -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<double>::Zero);
   region.SetIndex(index);