[vtkusers] vtkImageViewer interaction

Ivan Macia imacia at vicomtech.es
Wed Apr 14 06:02:44 EDT 2004


Hi,

I'm using a vtkImageViewer in an MFC application and I want to interact with
the images. The documentation says that the vtkInteractorStyleImage is
capable of changing window/level, zooming and panning interactively. I'm
able to do window/level adjustment with the left button but the other
interaction events that appear in the documentation of the
vtkInteractorStyleImage class are not working (i.e. SHIFT + Left Mouse pans
the camera, SHIFT + Right Mouse triggers pick events). I tried also in a
console application but I get the same results. How can I enable panning,
zooming and picking operations? Do I need to add observers for this?

The way setting up the viewer, render window and interactor is the following
(CVTKRenderArea is a CWnd derived window) :

int CVTKRenderArea::OnCreate(LPCREATESTRUCT lpCreateStruct)
{

if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
.....

vtkRenderWindow* renderWindow = m_vtkImageViewer->GetRenderWindow();
renderWindow->BordersOn();
renderWindow->SwapBuffersOn();
renderWindow->SetParentId(GetSafeHwnd()); // setup the parent window

// Set properties of interactor
m_vtkInteractor->SetRenderWindow(m_vtkImageViewer->GetRenderWindow());
m_vtkImageViewer->SetupInteractor(m_vtkInteractor);

....
}


Thanks in advance

Iván Macía





More information about the vtkusers mailing list