[vtkusers] ActiViz | Changing Window Level and Window Width in a RenderWindowControl
Matias Montroull
matimontg at gmail.com
Sat Feb 8 09:11:52 EST 2014
Thanks David, I have set the interactor to: vtkInteractorStyleImage and
works just fine, however, the WW and WL is not working.. according to this:
http://fossies.org/linux/misc/vtk-6.0.0.tar.gz:a/VTK6.0.0/Interaction/Style/vtkInteractorStyleImage.h
it should work just by pressing left mouse button and dragging..
any clue what I may be missing?
Here's my code:
vtkImageViewer2 _ImageViewer = vtkImageViewer2.New();
vtkDICOMImageReader reader = vtkDICOMImageReader.New();
reader.SetFileName(ofdmulti.FileNames[0]); /only first
image to be renderer
reader.Update();
_ImageViewer.SetInputConnection(reader.GetOutputPort());
vtkRenderWindow renderWindow =
renderWindowControl1.RenderWindow;
vtkRenderer ren =
renderWindow.GetRenderers().GetFirstRenderer();
vtkRenderWindowInteractor interactor =
vtkRenderWindowInteractor.New();
vtkInteractorStyleImage iteractor_image =
vtkInteractorStyleImage.New();
interactor.SetInteractorStyle(iteractor_image);
renderWindow.GetInteractor().SetInteractorStyle(iteractor_image);
_ImageViewer.SetRenderWindow(renderWindow);
_ImageViewer.SetSlice(0);
_ImageViewer.Render();
Thanks!
On Sat, Feb 8, 2014 at 10:36 AM, David Cole <dlrdave at aol.com> wrote:
> Zoom, pan and rotation are built in to the default interactor style that
> you get when you create a vtkRenderWindow (which the RenderWindowControl
> does for you).
>
> If you want one that provides WW/WL control in the interactor style, you
> just have to instantiate a style that provides that behavior and then set
> it as the current interactor style in the control's interactor.
>
> Google around for examples on setting interactor styles, and then adapt
> one of those and call the method:
>
> renderWIndowControl.GetRenderWindow().GetInteractor().
> SetInteractorStyle(
> ..... put the new style here .....);
>
>
> HTH,
> David C.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140208/1ba59864/attachment.html>
More information about the vtkusers
mailing list