From 749a10abf2b91f6cedc3d89addd3658044670714 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Mon, 8 Feb 2016 16:51:19 +0100 Subject: [PATCH] Ensure compatibility with VTK7 --- common/vvImage.txx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/vvImage.txx b/common/vvImage.txx index ab518cb..8574bfd 100644 --- a/common/vvImage.txx +++ b/common/vvImage.txx @@ -41,11 +41,21 @@ void vvImage::AddItkImage(TItkImageType *input) matrix->Identity(); for(unsigned int i=0; iGetImageDimension(); i++) { for(unsigned int j=0; jGetImageDimension(); j++) { +#if VTK_MAJOR_VERSION <= 6 (*matrix)[i][j] = input->GetDirection()[i][j]; // Direction is used around the image origin in ITK (*matrix)[i][3] -= (*matrix)[i][j] * input->GetOrigin()[j]; +#else + (*matrix).SetElement(i, j, input->GetDirection()[i][j]); + // Direction is used around the image origin in ITK + (*matrix).SetElement(i, 3, (*matrix).GetElement(i,3) - (*matrix).GetElement(i,j) * input->GetOrigin()[j]); +#endif } +#if VTK_MAJOR_VERSION <= 6 (*matrix)[i][3] += input->GetOrigin()[i]; +#else + (*matrix).SetElement(i, 3, (*matrix).GetElement(i,3) + input->GetOrigin()[i]); +#endif } // GetDirection provides the forward transform, vtkImageReslice wants the inverse -- 2.45.1