From: tbaudier Date: Mon, 8 Feb 2016 15:51:19 +0000 (+0100) Subject: Ensure compatibility with VTK7 X-Git-Tag: v1.4.0~67 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=749a10abf2b91f6cedc3d89addd3658044670714;p=clitk.git Ensure compatibility with VTK7 --- 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