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

Arefin Shamsil marefin at uwo.ca
Tue Jul 31 12:23:37 EDT 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180731/f853a1a9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture.JPG
Type: image/jpeg
Size: 28248 bytes
Desc: not available
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180731/f853a1a9/attachment.jpe>


More information about the vtkusers mailing list