[vtkusers] Using vtkImageViewer2 and let dicom image fill entire viewport?

Kuan-Yu Hsieh r00922103 at ntu.edu.tw
Sat Feb 2 12:03:31 EST 2013


Hello, 
I am using a vtkImageViewer2 to Read in a Dicom image series, and I try to
show each slice while using Mouse Wheel to change the viewing slice.

For this part, it Works well just like the following screenshots.
<http://vtk.1045678.n5.nabble.com/file/n5718237/001.jpg> 

after wheel up:
<http://vtk.1045678.n5.nabble.com/file/n5718237/003.jpg> 


Then, here is my problem.

I need to use my right mouse button on the render window to zoom the image
in and then get this full view.
<http://vtk.1045678.n5.nabble.com/file/n5718237/002.jpg> 
This "get full view" I refer to means *FILL the Entire image slice to the
viewport* or let the image slice fill the entire render window.

And following this resizing, I use the mouse wheel to change slice again.
The viewport just filled with entire image and the slice size never be
changed even when I scroll the wheel to change slice.

*I need this to be my default viewport setting!!!*
Which means when the moment the image being rendered, the image should
already fill the entire viewport and never change only if the user change it
by mouse's right button intentionally.

After all, I did a little search...and I found the behavior that I need is
calling a Dolly() function and change the value.
But even if I set a new Dolly value, like this : "camera->Dolly( 10 );",
nothing happened.

Here is my partial code:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// Visualize
	imageViewer = vtkSmartPointer<vtkImageViewer2>::New();

	imageViewer->SetInput( vtkImage );	//vtkImage is a 3d Dicom

	imageViewer->SetColorLevel( 60 );
	imageViewer->SetColorWindow( 450 );

	vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
	imageViewer->SetupInteractor( renderWindowInteractor );


	vtkSmartPointer<vtkCamera> camera = vtkSmartPointer<vtkCamera>::New();
	camera->ParallelProjectionOn();

	*camera->Dolly( 10 );//nothing happened!!*

	// to flip image
	camera->SetViewUp (0, -1, 0);  

	imageViewer->GetRenderer()->SetActiveCamera( camera );
	imageViewer->GetRenderer()->ResetCamera();

	this->ui->qvtkWidget->SetRenderWindow( imageViewer->GetRenderWindow() );
	this->ui->qvtkWidget->GetRenderWindow()->Render( );
	this->ui->qvtkWidget->show();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Is there anyone know how should I try to get the image fill the entire
viewport??

I have been doing this all day and get nothing.....

Even a liitle clue would be helpful!!

Thanks in advance.



--
View this message in context: http://vtk.1045678.n5.nabble.com/Using-vtkImageViewer2-and-let-dicom-image-fill-entire-viewport-tp5718237.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list