[vtkusers] Displaying ITK image via VTK viewer on Qt GUI

kenichiro yoshimi rccm.kyoshimi at gmail.com
Fri Aug 3 23:59:12 EDT 2018


Hi,

You try to turn DebugOn to display some useful information.
  vtkImage->DebugOn();
Additionally you may want to use QVTKOpenGLWidget instead of
QvtkWidget, because QVTKWidget is deprecated for VTK 8.1 and will be
removed in a future version.

Regards
2018年8月1日(水) 1:23 Arefin Shamsil <marefin at uwo.ca>:
>
> Hello there Awesome VTK community,
>
> I have been trying to make a Qt app work for a few days with no success. The screenshot of the app is attached in this email. In this app (please look at the screenshot), the user will first select a directory. Once the directory is loaded, the user will click the "Feed a Dataset" button. It will then trigger an ITK function to read a file and execute a simple VTK function to display a 2D ultrasound image on the designated window. When the button is clicked again, the window should clear off and display the next image. That's is for now.
>
> The ultimate purpose of this application is to visualize incremental volume reconstruction from an already recorded tracked series of ultrasound images by providing an image one at a time. This has been done in many ways before. Nothing really new.
>
> The app runs fine and I am able to select a directory. THE PROBLEM is when I click the "Feed a Dataset" button, nothing displays on the window, the app freezes and then closes. I tried many ways but cannot really figure out why this is happening. The Ultrasound window is an object of class QVTKWidget. And the VTK function I am calling from inside the button's slot function is as follows.
> void USImageViewer::viewonUSwindow(ImageType2D::Pointer usImage){
>         // setup and connect itk with vtk
> vtkConnectorType::Pointer connector = vtkConnectorType::New();
> connector->SetInput(tacImage);
> connector->Update();   // seems to be ok until here
>
>         // Convert to vtk image
> vtkImage = vtkSmartPointer<vtkImageData>::New();
> vtkImage->DeepCopy(connector->GetOutput()); // hangs during executing this line, indicating something is wrong with the connector
> // Image actor
> tacIMactor = vtkSmartPointer<vtkImageActor>::New();
> tacIMactor->GetMapper()->SetInputData(vtkImage);
>         renderer = vtkSmartPointer<vtkRenderer>::New();
>         renderer->AddActor(tacIMactor);
> renderer->ResetCamera();
>
> ui->usImQVTKviewer->GetRenderWindow()->AddRenderer(renderer);
> ui->usImQVTKviewer->update();
> }
>
> Can anyone please help me out in this? Your help is much appreciated.
>
> Sincerely
> Shams
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list