Hi All,<div><br></div><div>I'm getting a strange behavior since I moved from QT 4.3 to QT 4.6 (Mac Snow Leopard and Ubuntu 64bit).</div><div><br></div><div>To display an image in the GUI, I'm using QVTKWidget with vtkImageViewer2.</div>
<div><br></div><div>I need that every time the user clicks on the image with the mouse, a new image will be displayed.</div><div><br></div><div>To do that, I'm doing this:</div><div><br></div><div>-----------------------------------------------------</div>
<div><div> // Create Viewer</div><div> viewer = vtkImageViewer2::New();</div><div> viewer->SetInput(IMAGE);</div><div> viewer->SetupInteractor(vtkWidget->GetRenderWindow()->GetInteractor());</div><div>
</div><div> vtkWidget->SetRenderWindow(viewer->GetRenderWindow());</div><div><br></div><div> vtkInteractorStyleImage *imageStyle = vtkInteractorStyleImage::New();</div><div> vtkPointPicker* picker = vtkPointPicker::New();</div>
<div> vtkWidget->GetRenderWindow()->GetInteractor()->SetPicker(picker);</div><div><br></div><div> // Create callback</div><div> vtkImageInteractionCallback *callback = vtkImageInteractionCallback::New();</div>
<div> callback->SetInteractor(vtkWidget->GetRenderWindow()->GetInteractor());</div><div> callback->SetPicker(picker);</div><div> callback->SetImageViewer(viewer); // Send a reference to callback</div>
<div> imageStyle->AddObserver(vtkCommand::MouseMoveEvent, callback);</div><div> imageStyle->AddObserver(vtkCommand::LeftButtonPressEvent, callback);</div><div> imageStyle->AddObserver(vtkCommand::LeftButtonReleaseEvent, callback);</div>
<div> </div><div> vtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(imageStyle);</div></div><div> viewer->GetRenderer()->ResetCamera();</div><div><br></div><div>-----------------------------------------------------</div>
<div><br></div><div>The Execute method of the vtkImageInteractionCallback class basically performs this:</div><div><br></div><div> viewer->SetInput(NEW_IMAGE);</div><div> viewer->Render();</div><div><br></div><div>
In other words, this is what happens every time the user clicks on the image.</div><div><br></div><div>It is working fine, but the problem is that the first click performs a ZOOM OUT on the image. And it is always the first click!!</div>
<div><br></div><div>This is only happening in the first time the method Execute (vtkImageInteractionCallback : vtkCommand) call viewer->Render(). When I call Render() outside vtkImageInteractionCallback, the "problem" does NOT happen.</div>
<div><br></div><div>Does anyone have an idea on what is going on? How can I fix this?</div><div><br></div><div>Any help will be appreciated!</div><div><br></div><div>Thanks & Regards,</div><div>Luis</div>