[Insight-users] VTK Button event of interactor

David Doria daviddoria+itk at gmail.com
Mon Oct 19 16:29:48 EDT 2009


On Mon, Oct 19, 2009 at 4:06 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> David,
>
> These small examples are great additions to vtk.
>
> A couple of suggestions:
>
> 1) Use vtkSmartPointer to avoid having to manage memory. We should
> encourage new users to use vtkSmartPointer.
> 2) Provide a small CMakeLists.txt file. Users can cut and paste it. It
> will provide the proper libraries.
>
> I did 1) and 2) in these examples (motivated by your early examples)
> http://www.vtk.org/Wiki/Create_models_from_labeled_volume_data_(Discrete_MarchingCubes)
> http://www.vtk.org/Wiki/Create_cubes_from_labeled_volume_data
>
> Bill
>

Thanks Bill. I have a couple of comments/responses:

1) I think that smart pointers are clearly a great thing. My concern
is that it is an extra piece of "what is going on??" for new users to
have to deal with.  If I am a beginning c++ programmer and I see:
vtkClass* MyClass = vtkClass::New();
I would think "ah, just like in my Programming 101 course!"

but If I saw:
vtkSmartPointer<vtkClass> MyClass = vtkSmartPointer<vtkClass>::New();
I would think "whoa, what is all this templated-smart-pointer business??"

My thought was that most users are not going to read from page 1 on
any tutorial / set of wiki examples we put out there, so explaining
smart pointers at the "beginning" doesn't really make sense. Writing
the examples in this smartpointer-less style was an attempt to convey
the easiest way possible things to people who have googled something
and come directly to the wiki example about some vtk concept. Then if
they eventually come across the vtkSmartPointer explanation somewhere,
they will realize "ah I could/should be using this for all my vtk
code!". I was treating it as an "extra" rather than a necessity. What
do you think about this line of reasoning?

2) I agree, a CMakeLists.txt file acompanying each example is key
(I've been harping about how vtk class documentations should explain
which libraries need to be linked to to use them, which I still
support, but here is my chance to at least kind of put that
information somewhere!). Do you think the wiki format makes sense for
these examples? Could there be an examples repo? Or these examples
added to the real Examples directory in the vtk repo? There was some
discussion about this a while back - the positive is that google could
potentially find it - the negative is that it is not regression tested
and users have to copy/paste the file (now 2 files with the cmake
file) which could get annoying if you want to go through several of
the examples. Thoughts?

Thanks,

David


More information about the Insight-users mailing list