Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fixes for VTK 6 #218

Closed
wants to merge 10 commits into from
Closed

Conversation

kylelutz
Copy link

This fixes compilation errors encountered when building PCL
against VTK 6 (from the current git master). The changes are
based on the recommendations in the VTK 6 migration guide [1].

[1] http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide

@kylelutz
Copy link
Author

This is a first pass which allows PCL to compile against VTK 6. In the future another cleanup pass could be made to reduce (or abstract away) the separations between the VTK5 and VTK6 code paths.

@jspricke
Copy link
Member

Thanks a lot for submitting this! I will put some questions and comments inline.

@@ -209,9 +218,12 @@
vtkSmartPointer<vtkPolyData> poly_data = vtkSmartPointer<vtkPolyData>::New ();

pcl::io::mesh2vtk (mesh, poly_data);
poly_data->Update ();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ok with VTK5 as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, see my comments below.

@jspricke
Copy link
Member

You've remove quite a lot of update() calls. Are you sure this still works as before with VTK5? Otherwise I guess we have to #ifdef all of them.

This fixes compilation errors encountered when building PCL
against VTK 6 (from the current git master). The changes are
based on the recommendations in the VTK 6 migration guide [1].

This closes issue PointCloudLibrary#199.

[1] http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
@kylelutz
Copy link
Author

Thanks for the feedback!

In VTK5, vtkDataObject::Update() was provided as a convenience method which actually called update on the pipeline that produced the data object. Due to the decoupling of the data model and execution model in VTK6 this convenience method no longer exists. Making the proper change took a little work. In the case of any vtk*Writer::Write() methods, Update() will be automatically called making the explicit calls unnecessary and thus I removed them. In cases of the other VTK pipelines the Update() method should be called on the last algorithm in the pipeline instead of the data object itself and thus I moved the Update() calls there. In the case of just creating a vtkPolyData and adding points/cells/data to it no Update() needed to be called and I removed them.

I checked the changes by running the unit-tests (with ctest) and they all passed. I also opened a few data sets with pcl_viewer and everything looked fine. Can you recommend any other ways to test/verify the changes?

Thanks,
Kyle

@larshg
Copy link
Contributor

larshg commented Aug 21, 2013

Hi Kylelutz,

I tried using your changes for PCL 1.7 and it compiles fine. However I do get runtime errors when trying to run the openni_viewer example, in PCL_visualization: Some methods are defined like:

#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION >= 10))
win_->SetWindowName (name.c_str ());
#else
image_viewer_->GetRenderWindow ()->SetWindowName (name.c_str ());
#endif

but the constructor is in the opposite way

#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 10))
, image_viewer_ (vtkSmartPointer::New ())
#else
, win_ (vtkSmartPointer::New ())
, ren_ (vtkSmartPointer::New ())
, slice_ (vtkSmartPointer::New ())
#endif

and hence the method tries to access the image_viewer which isn't initialized.

There was a few other changes too, but since I don't have that much experince with VTK, I think you or someone with more experince should go over the files.

I don't mind committing the changes I have made, since I can run the viewer example, but something should probably be changed/optimized.

Long post, but hopes its okay.

Regards, Lars

This fixes compilation errors encountered when building PCL
against VTK 6 (from the current git master). The changes are
based on the recommendations in the VTK 6 migration guide [1].

This closes issue PointCloudLibrary#199.

[1] http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
@kylelutz
Copy link
Author

@larshg Sorry for the delay, I've been quite busy. Can you upload the changes that you have? I'll look them over and merge them into my branch. Thanks!

@larshg
Copy link
Contributor

larshg commented Sep 1, 2013

@kylelutz

Hi Kyle,

I have uploaded the changes, but I have started from a newer master branch - so mayby you can cherry pick the commits or else I'll try make a branch from your branch and upload it separately for a pull/merge.

Here is the commit: larshg@d72b363

The imageviewer is not working probably yet, though it doesn't crash due to invalid pointer. As of now it only shows a black screen. The VTK lib comes with following error: vtkTrivialProducer: <0BD1777B8> This data object does not contain the requested extent.

I can't find any comments about this and I haven't figured out what is wrong. The image data seems fine, but mayby its wrong use of a dataobject in VTK.

regards, Lars

@richmattes
Copy link
Contributor

PCLConfig.cmake.in also needs to be changed for this patch to work. Right now, the VTK_LIBRARIES are hard-coded into the cmake file, and they're all wrong for vtk6.

Additionally, it looks like the way PCLConfig.cmake is collecting preprocessor definitions is broken when using vtk6. When trying to build a project that uses pcl, calling ADD_DEFINITIONS(${PCL_DEFINITIONS}) causes make to bail because of unescaped parentheses on the command line. I'm still looking into that issue, I'll try to generate a test case to reproduce the issue

@rbrusu rbrusu mentioned this pull request Sep 7, 2013
@jspricke
Copy link
Member

jspricke commented Oct 6, 2013

HI @kylelutz could you streamline this a litte? Like remove the merge and unrelated commits? Try git rebase -i. This would make it easier to review. Thanks!

yangyanli and others added 2 commits October 8, 2013 17:26
Conflicts:
	apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h
@fran6co
Copy link
Contributor

fran6co commented Nov 14, 2013

@jspricke @kylelutz I took the liberty to rebase it, could you review it in #363?

@jspricke
Copy link
Member

closing this one in favor of #363, thanks for the work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants