[vtkusers] Reset Window Level with code

Sankhesh Jhaveri sankhesh.jhaveri at kitware.com
Mon Oct 10 22:07:21 EDT 2016


Hi Fabian,

Are you looking for window width / level adjustment or camera adjustment?

The keypress callback for 'r' key resets the camera position and focal
point. Since, you've already tried calling ResetCamera() in the callback, I
would make sure that you are calling ResetCamera on the correct Renderer.
You'd also have to call RenderWindow::Render() after that.

​Hope this helps!

*Sankhesh Jhaveri*
*Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com> | (518)
881-4417




On Mon, Oct 10, 2016 at 5:24 PM, Fabian Torres <fabian.trobles at gmail.com>
wrote:

> Hi all.
>
> I have a slice of a volume displayed on a vtkImageViewer2.
>
> I understand that if I modified the window levels by pressing the button 1 of the mouse, I could reset the levels by pressing the letter 'r'.
> I'm trying to reset the window levels with a user interface button.
> I have implemented something similar to the code found in the interactorstyleImage class:
>
> if (reset){
>
>            viewerSagital->GetRenderer()->ResetCamera();
>            viewerSagital->Render();
> }
>
> but this does not do anything to the viewer.
>
> The interactorstyle code is as follows:
>
> case 'r' : case 'R' : this->FindPokedRenderer(rwi->GetEventPosition()[0],
> rwi->GetEventPosition()[1]); if(this->CurrentRenderer!=0) {
> this->CurrentRenderer->ResetCamera(); } else { vtkWarningMacro(<<"no
> current renderer on the interactor style."); } rwi->Render(); break;
>
> Someone could help me?
>
> Thanks
>
>
> --
> Fabián Torres Robles
> Maestria en Ciencias en Ingeniería Electrónica
> Ingeniería en Sistemas Electrónicos
> tel. 58081280, 0445534661338
> e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161010/196670a1/attachment.html>


More information about the vtkusers mailing list