Subject: CGAL users discussion list
List archive
- From: "Laurent Rineau (CGAL/GeometryFactory)" <>
- To:
- Cc: Johannes Totz <>
- Subject: Re: [cgal-discuss] VTK image interface
- Date: Wed, 16 Jul 2014 16:17:16 +0200
- Organization: GeometryFactory
Le Wednesday 16 July 2014 15:03:28 Johannes Totz a écrit :
> Hi there,
>
> we are using the VTK bits in CGAL_ImageIO/Image_3.cpp and related header
> file. Has worked fine so far, if used with VTK 5.10+.
>
> Now we have upgraded to VTK 6.1 and CGAL no longer compiles due to API
> changes in VTK.
> Is there a fix planned for the next release? Or shall I fix myself and
> submit a patch? If you have something in the pipe already then I wont
> duplicate your work, otherwise happy to contribute back.
That is funny you ask that question today. Yesterday I was trying to make it
compile with VTK 6, too. But I do not know VTK at all, and I had difficulties
and not enough time to solve the issues. That would be great if you can make
it compile and run correctly with VTK 6. Please send us a patch if you are
successful.
My patch, so far, was the following one. But be careful: I a pretty sure you
cannot trust it!
commit ff6d63e03b2fa66efa0dfb185a488815cc3517dc
Author: Laurent Rineau
<>
Date: Tue Jul 15 16:10:46 2014 +0200
Initial experimental support of VTK6
diff --git a/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h
b/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h
index 9f8501f..185cc25 100644
--- a/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h
+++ b/CGAL_ImageIO/include/CGAL/Image_3_vtk_interface.h
@@ -113,13 +113,15 @@ struct VTK_type_generator<boost::uint32_t> {
vtk_image->SetDimensions(image.xdim(),
image.ydim(),
image.zdim());
+#if VTK_MAJOR_VERSION < 6
vtk_image->SetWholeExtent(0, image.xdim(),
0, image.ydim(),
0, image.zdim());
+ vtk_image->SetScalarType(type);
+#endif // VTK < 6.x
vtk_image->SetSpacing(image.vx(),
image.vy(),
image.vz());
- vtk_image->SetScalarType(type);
vtk_image->GetPointData()->SetScalars(data_array);
return vtk_image;
} // end vtk_image_sharing_same_data_pointer
diff --git a/CGAL_ImageIO/src/CGAL_ImageIO/Image_3.cpp
b/CGAL_ImageIO/src/CGAL_ImageIO/Image_3.cpp
index f0f5e02..d617043 100644
--- a/CGAL_ImageIO/src/CGAL_ImageIO/Image_3.cpp
+++ b/CGAL_ImageIO/src/CGAL_ImageIO/Image_3.cpp
@@ -197,7 +197,9 @@ Image_3::read_vtk_image_data(vtkImageData* vtk_image)
image->vx = spacing[0];
image->vy = spacing[1];
image->vz = spacing[2];
+#if VTK_MAJOR_VERSION < 6
vtk_image->Update();
+#endif
image->endianness = ::_getEndianness();
int vtk_type = vtk_image->GetScalarType();
if(vtk_type == VTK_SIGNED_CHAR) vtk_type = VTK_CHAR;
--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/
- [cgal-discuss] VTK image interface, Johannes Totz, 07/16/2014
- Re: [cgal-discuss] VTK image interface, Laurent Rineau (CGAL/GeometryFactory), 07/16/2014
- Re: [cgal-discuss] VTK image interface, Johannes Totz, 07/17/2014
- Re: [cgal-discuss] VTK image interface, Laurent Rineau (CGAL/GeometryFactory), 07/16/2014
Archive powered by MHonArc 2.6.18.