[Insight-users] VTK Button event of interactor

Bill Lorensen bill.lorensen at gmail.com
Mon Oct 19 16:59:30 EDT 2009


For these small examples, I think the wiki is good. It's really easy
to cut and paste from them.

As for the smart pointers, vtk already uses ::New() rather than new.
We should teach good practices to the new generation. Perhaps we can
make a small wiki page describing vtk's vtkSmartPoiner.

Bill


On Mon, Oct 19, 2009 at 4:29 PM, David Doria <daviddoria+itk at gmail.com> wrote:
> 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
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list