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

Adrian Wyssmann wyssa1 at hta-bi.bfh.ch
Thu Nov 25 11:03:03 EST 2004


I still have the problem with that window-level stuff. I tried different
things, but didn't get rid of it. I really get that thing to work. The
problem ist, that if I change the window level to somewhat, the image get's
black and white (see attachement). The same happens with
vtkImageViewer2

pImageMapToWindowLevelColors->SetLevel(0.5*(range[1] + range[0]));	
pImageMapToWindowLevelColors->SetWindow(range[1] - range[0]-2);	
pImageMapToWindowLevelColors->SetInput(pImageData);
pImageMapToWindowLevelColors->SetLookupTable(pLookupTableOriginal);
pImageMapToWindowLevelColors->Update();
pImageData = pImageMapToWindowLevelColors->GetOutput();

The pLookupTableOriginal is the same lookuptable I use for the
ScalarBarActor (see attatchment).

On resetting the WindowLevel to 255 and 127.5 the colors are back.
 

-----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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: blackWhite.gif
Type: image/gif
Size: 67954 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041125/d9674907/attachment.gif>


More information about the vtkusers mailing list