[vtkusers] vtkImageViewer + QVTKwidget scale to fit

chytu chyt_n_ya at yahoo.com
Wed Dec 28 12:21:05 EST 2011


Hi,

I am trying to view an image in QVTKWidget using vtkImageViewer with the
following code:

    vtkImageViewer* image_view = vtkImageViewer::New();
    image_view->SetInputConnection(_dest->GetProducerPort());

    ui->qvtkWidget->SetRenderWindow(image_view->GetRenderWindow());
   
image_view->SetupInteractor(ui->qvtkWidget->GetRenderWindow()->GetInteractor());    

    image_view->SetColorLevel(128);
    image_view->SetColorWindow(256);
    ui->qvtkWidget->show();

But the image shown is attached to the lower left corner of the qvtkwidget.
It is not scaled to fit the size of the qvtkwidget. Also, it does not occupy
the entire space of the QVTKWidget leaving some empty black areas. I tried
setting the size of imageViewer using :

image_view->SetSize(ui->qvtkWidget->geometry().width(),
ui->qvtkWidget->geometry().height());

but to no use. How should I make it so that the image occupies the whole
extent of the QVTKWidget and resizes along with it?

Thanks,
Chytu.

--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkImageViewer-QVTKwidget-scale-to-fit-tp5105707p5105707.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list