[vtkusers] vtk, QVTKRenderWindowInteractor and vtkImageViewer2

Lic. José M. Rodriguez Bacallao jmrbcu at gmail.com
Mon Nov 16 12:38:54 EST 2009


in fact, this is what I do to setup vtkImageViewer2 to work with pyqt4

        from vtk.qt4.QVTKRenderWindowInteractor import
QVTKRenderWindowInteractor

        interactor = QVTKRenderWindowInteractor(self)
        r = vtkgdcm.vtkGDCMImageReader()
        r.SetFileName('/home/jmrbcu/IM66.dcm')
        r.Update()

        v = vtk.vtkImageViewer2()
        v.SetupInteractor(interactor)
        v.SetRenderWindow(interactor.GetRenderWindow())
        v.SetInput(r.GetOutput())
        v.Render()

On 11/16/09, Clinton Stimpson <clinton at elemtech.com> wrote:
>
> Yes, but vtkImageViewer2 has an interactor too.
> Its usually a matter of telling vtkImageViewer2 to use the Qt one when you
> put
> them together.
>
> Clint
>
> On Monday 16 November 2009 09:39:47 am Lic. José M. Rodriguez Bacallao
> wrote:
>> I am using QVTKRenderWindowInteractor:
>>
>> from vtk.qt4.QVTKRenderWindowInteractor: import
>> QVTKRenderWindowInteractor:
>>
>> is this interactor right?
>>
>> On 11/16/09, Clinton Stimpson <clinton at elemtech.com> wrote:
>> > Its probably how the interactor is getting set up.  The default VTK
>> > interactor
>> > doesn't work with Qt, and can give X errors when its used.
>> >
>> > Clint
>> >
>> > On Sunday 15 November 2009 02:52:15 pm Lic. José M. Rodriguez Bacallao
>> >
>> > wrote:
>> >> no one?
>> >>
>> >> On 11/14/09, Lic. José M. Rodriguez Bacallao <jmrbcu at gmail.com> wrote:
>> >> > hi folks, I am using python and PyQt4 for displaying dicom images and
>> >> > using QVTKRenderWindowInteractor and vtkImageViewer2 (or
>> >> > vtkImageColorViewer from gdcm) to display it. The way I display the
>> >> > images is with a tab widget and as a tab page I add a QMainWindow
>> >> > with
>> >> > central widget set to QVTKRenderWindowInteractor with an
>> >> > vtkImageViewer2. Problem is when I try to close a tab page
>> >> > (QMainWindow) and then close the application, vtk is showing this
>> >> > messages:
>> >> >
>> >> > X Error: BadDrawable (invalid Pixmap or Window parameter) 9
>> >> >   Extension:    136 (Uknown extension)
>> >> >   Minor opcode: 9 (Unknown request)
>> >> >   Resource id:  0x2c00493
>> >> >
>> >> > this message does not appear when I close the application window
>> >> > directly from the window close button. Is there a proper way to
>> >> > destroy an vtk object?
>> >> >
>> >> > PS: Which is the better way to display dicom images with vtk?
>> >> >
>> >> > --
>> >> > Lic. José M. Rodriguez Bacallao
>> >> > Centro de Biofisica Medica
>> >> > -----------------------------------------------------------------
>> >> > Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos
>> >> > lo
>> >> > mismo.
>> >> >
>> >> > Recuerda: El arca de Noe fue construida por aficionados, el titanic
>> >> > por profesionales
>> >> > -----------------------------------------------------------------
>
>


-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-----------------------------------------------------------------
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-----------------------------------------------------------------



More information about the vtkusers mailing list