[vtkusers] Re: vtkImagePlaneWidget problem on vtkImageData (C++)

Adrian Wyssmann wyssa1 at hta-bi.bfh.ch
Thu Nov 25 01:50:54 EST 2004


My Image on the vtkImageViewer2 has only black and white pixels. My
vtkImageData has scalar values from 800 to 2600. So then scalar values over
255 are cut of and set to white?  How do I solve that? 

With vtkImageViewer the colors are shown correctly, also after changing the
window by mouse (default interaction). But the problem with vtkImageViewer
is, that the other implemented interaction (pan, zoom, ...) doesn't work no
more.

So either vtkImageViewer nor vtkImageViewer2 does fullfill my needs:
Interact within the renderer (pan, zoom) and changig the window level. 

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of dean.inglis at camris.ca
Sent: Dienstag, 9. November 2004 14:12
To: vtkusers at vtk.org
Subject: Re:[vtkusers] Re: vtkImagePlaneWidget problem on vtkImageData (C++)

Adrian,

if you have tcl wrapping enabled for your vtk build, (or you could convert
to c++), try the following tcl script for window/level interaction using
vtkImageViewer2, and maybe with your particular image data.  Default window
level is usually calculated as: 

double* range = image->GetScalaRange();
double window = range[1] - range[0];
double level = 0.5*(range[1] + range[0]);

So, depending on how the scalar values of your data are distributed, the
window level can be weighted either too high or to low and the image will
appear initially "fogged", too dark (even black) or too light (even white).


Dean

#///////////////////////////////////////////////////////////////////////////
/////////
package require vtk

vtkBMPReader reader
reader SetFileName $VTK_DATA_ROOT/Data/masonry.bmp

# set the window/level
vtkImageViewer2 viewer
viewer SetInput [reader GetOutput]
viewer SetColorWindow 100.0
viewer SetColorLevel 127.5
vtkRenderWindowInteractor iren
[viewer GetRenderWindow] SetInteractor iren viewer SetupInteractor iren

viewer Render

# here's how to interact:
# left mouse button left - right controls window # left mouse button up -
down controls level # press "r" key resets the internal
vtkImageMapToWindowLevelColors to its default w/l # right button zooms image
# shift + "r" resets the zoom 

_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://www.vtk.org/Wiki/VTK_FAQ>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list