X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreaVtk.txx;h=c83e758d6bb7ecbdcc5c8da594ff19fb24fbff2f;hb=fdf9dec759b0aacd36194286d2816e9feafd72ad;hp=b748e67a32987356194b465db25ff014772ea6d9;hpb=ca800a1a9a78f119d37d9642ea29acb7c9b9a323;p=crea.git diff --git a/src/creaVtk.txx b/src/creaVtk.txx index b748e67..c83e758 100644 --- a/src/creaVtk.txx +++ b/src/creaVtk.txx @@ -46,7 +46,7 @@ #include namespace crea { - template + template /*CREA_EXPORT*/ vtkImageData* NewVtkImageDataFromRaw( T* data, int nx, int ny, @@ -59,13 +59,22 @@ namespace crea // Shouldn't we pass NumberOfScalarComponents to deal with RGB, RGBA images as well? // JPR - image->SetNumberOfScalarComponents(1); int vtktype = vtkTypeTraits::VTKTypeID(); - image->SetScalarType(vtktype); image->SetDimensions(nx, ny ,nz); image->SetSpacing(1, 1, 1); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + image->SetNumberOfScalarComponents(1); + image->SetScalarType(vtktype); image->AllocateScalars(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + image->AllocateScalars(vtktype,1); +#endif + + vtkDataArray* array = 0; switch (vtktype) {