[vtkusers] QVTKWidget and Interacting with Image

DL I inglis.dl at gmail.com
Tue Oct 14 10:25:21 EDT 2014


Hi Nick,

I would set up the rendering environment first before setting any data inputs:
in TestInterface.cpp, get the vtkRenderWindow from your QVTKWidget, and
get its vtkRenderWindowInteractor:

vtkRenderWindow* renwin = ui->vtkWidget->GetRenderWindow()

//get the windows interactor:

vtkRenderWindowInteractor* iact = renwin->GetInteractor();

//set your custom interactor style

iact->SetInteractorStyle(myInteractorStyle);

// init the image viewer:

 imageViewer->SetRenderWindow(renwin);
 imageViewer->SetupInteractor(iact);


then set up all your other mappers and actors
and finally,

imageViewer->SetInputConnection(reader->GetOutputPort());

let me 9and vtkusers cc'd) know if that worked

regards,
Dean



On Tue, Oct 14, 2014 at 9:48 AM, Nick Patterson <pattersonnp at gmail.com> wrote:
> Dear Dean,
>
>         Thanks for getting in touch. I have some contact from another member of the user group, but have heard nothing since. I had made an example project in Qt which I shared, and have attached for you to look at. I effectively am trying to interact with the QVTKWidget (to scroll through the DICOM images as an example) in the same way as you can in the example shown at the web link I provided.
>
>         If you think you can explain how to do this, I would greatly appreciate any input. I have attached some test code to this message.
>
> Regards, Nick.
>
>
>
>
> On 14 Oct 2014, at 14:43, DL I <inglis.dl at gmail.com> wrote:
>
>> Hi Nick,
>>
>> can you post some of your source code showing how you set up the QVTKWidget with
>> the vtkImageViewer2, if you use that class?  Have a look at the
>> documentation for vtkImageViewer2 as
>> well as the source code.  I expect you may not be initializing the
>> viewer's render window correctly.
>>
>> Dean
>>
>> On Sat, Oct 11, 2014 at 1:39 PM, Nick Patterson <pattersonnp at gmail.com> wrote:
>>> VTK Users,
>>>
>>> I would like to take the example for visualising a DICOM series in VTK (http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries) as outlined in the example I have linked to, but I want to render this within a QVTKWidget.
>>>
>>> I have quite happily rendered the DICOM series in a QVTKWidget and can scroll through the image slices using something like a QSlider widget. But I simply cannot determine a way to interact with the image in the same way as the example shows, effectively being able to scroll through the images use the mouse wheel.
>>>
>>> There seems to be a lack of documentation of how to interact with the rendered window with a QVTKWidget and I hoped that someone with experience of this can advise on how I can interact with the image (as per the example I linked to above) but when it is rendered within the QT widget.
>>>
>>>
>>> Regards, Nick.
>>> _______________________________________________
>>> 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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


More information about the vtkusers mailing list