<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Prathamesh,<div><br></div><div>Make sure you are using vtkInteractorStyleImage, which will only allow 2D rotations if you also press the ctrl button with mouse movements. If you want to totally disable rotations you will probably have to make a new interactor style.</div><div><br></div><div><a href="http://www.vtk.org/doc/nightly/html/classvtkInteractorStyleImage.html">http://www.vtk.org/doc/nightly/html/classvtkInteractorStyleImage.html</a></div><div><br></div><div>You can get the "active camera" from the renderer being used in the render window</div><div><br></div><div>widget->GetRenderWindow()->GetRenderer()->GetActiveCamera();</div><div><br></div><div>and set it to use "parallel projection" for images</div><div><br></div><div>camera->ParallelProjectionOn();</div><div><br></div><div>Then, in your callback for the mouse click you can reset the camera "view up" vector along with the camera reset (which has an option to take the bounds of the objects you want to fit in the window) to undo any rotations that have been made:</div><div><br></div><div>renderer->ResetCamera(imageActor->GetBounds());</div><div>renderer->GetActiveCamera()->SetViewUp(0,1,0);</div><div><br></div><div><a href="http://www.vtk.org/doc/nightly/html/classvtkCamera.html">http://www.vtk.org/doc/nightly/html/classvtkCamera.html</a></div><div><br></div><div>This is at least what has worked for me,</div><div>-Eric</div><div><br></div><div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div>------------------------------------------------------</div><div>Eric E Monson</div><div>Duke Visualization Technology Group</div><div><br class="webkit-block-placeholder"></div></span></div><br><div><div>On Jul 12, 2010, at 5:53 AM, Jothy wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">First Render or MyQVTKWidget->Show() and then reset the camera.<br><br>Jothy<br><br><div class="gmail_quote">On Mon, Jul 12, 2010 at 1:42 AM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; position: static; z-index: auto; "><div dir="ltr"><br><div>Hello all,</div><div><br></div><div><br></div><div>I am trying to use the QVTKWidget to display an image and reset its view at the click of a button. I tried many ways but it only resets the translation and does not affect rotation. Following is what I am using:</div>
<div><br></div><div>MyQVTKWidget->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->ResetCamera();</div><div>MyQVTKWidget->repaint();</div><div><br></div><div>OR</div><div><br></div><div>MyRendererConnectedToMyQVTKWidget()->ResetCamera();</div>
<div><br></div><div><br></div><div>Am I missing something here? Also, even when I do MyvtkImageActorConnectedToMyRenderer()->setPickable(1); I am still able to rotate the Image.</div><div><br></div><div>I want to be able to turn off rotation of the vtkImageActor in some way and let it only scale and drag using the default mouse actions.</div>
<div><br></div><div>Any help will be highly appreciated.</div><div><br></div><div><br></div><div>Thanks,</div><div>Prathamesh</div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br></div></body></html>