[vtkusers] [Insight-users] Problem using vtkImagePlaneWidget

Mathieu Stumpf mathieu.stumpf at etu.unistra.fr
Wed Mar 21 11:26:22 EDT 2012


Le mardi 20 mars 2012 à 14:07 +0000, Kevin Keraudren a écrit :
> When working with ITK or VTK from Python, use "print" on the objects to 
> know what they contain.
> 
> For instance:
> print( vtk_image )
> shows that already you have a problem.
> 
> You are trying to get information from object whose creation is not 
> completed yet: "Update()" has not been called yet, either directly, or 
> indirectly like by Render()

Indeed, with the help of Julien Pontabry, I realized that yesterday
(before I saw your mail).

So I added a n2vtk.Update() in my code, and my vtk_image now contains
needed information in memory.


> If your problem is VTK specific, you will surely get more help from:
> http://www.vtk.org/mailman/listinfo/vtkusers


Now I still doesn't display planes (and I have some code version which
make X11 crashes), but it is indeed more a VTK specific problem.

Julien Pontabry explained me that I probably have a problem with my
vtkWindowInteractor. He provided me a C++ code which go through the step
I should follow, but using an independant vtkRenderWindowInteractor.

As my current objet inherit from wxVTKRenderWindowInteractor, I tried to
adapt the given code.

Particularly I configure my planes with the vtkWindowInteractor I get
trough self.GetRenderWindow().GetInteractor() and call
self.planeWidget[XYZ].PlaceWidget() which should make them appear.

Julien Pontabry also reported me that vtkImagePlaneWidget's actors where
implicitly created, so I didn't need have to create one for each of my
plane and add them to my renderer. 

Now despite it doesn't display planes, the application will run when I
call self.Render(), but if I call self.Initialize() or self.Start(), it
will make X11 crashes.

Attached to the mail is the changed code, with lines which makes X11
crashes commented. I would appreciate if someone could test them and
tell me if it also make your X11 session crash once decommented (save
all your works!).

I don't know if self.Initialize() and self.Start() are really required
though. Maybe planes doesn't show for yet another reason.

Kind regards,
Mathieu

> Le 19/03/2012 12:05, Mathieu Stumpf a écrit :
> > Hello,
> >
> > I'm trying to write a simple software to visualize medical image with
> > SITK, VTK, and WxWidget.
> >
> > As far as I can perceive, my problem is due to GetWholeExtent which
> > doesn't provide slice number for each axis in my picture, as I would
> > expect. Instead I get (0,-1) tuples.
> >
> > Maybe I do others things in a wrong way, I don't know. May be
> > GetWholeExtent is not the method I should use.
> >
> > My code is in a substantial part an object oriented rewriting of [1]
> > using Wx instead of Tkinter as widgets provider. As I'm a python
> > beginner, I may have made errors in this transcriptions too.
> >
> > Other sources greatly inspired me on this work :
> > - http://www.siafoo.net/snippet/314?code=on&nolinenos
> > - Other codes which were privately sent to me by Antoine Grigis and
> > Kevin Keraudren (lot of thank to them).
> >
> > I hope someone will be able to point me where I'm wrong in my
> > vtkImagePlaneWidget usage. I would also appreciate any feedback on the
> > code in a whole.
> >
> > Thank for your attention,
> > Mathieu
> >
> > [1]
> > http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/GUI/Python/ImagePlaneWidget.py?root=VTK&content-type=text/plain
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.php
> >
> > 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
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: placid_and_clean_sitk_to_vtk.py
Type: text/x-python
Size: 16737 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120321/e5789a53/attachment.py>


More information about the vtkusers mailing list