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

dean.inglis at camris.ca dean.inglis at camris.ca
Thu Nov 25 13:11:54 EST 2004


Adrian, 

I think you have to tell vtkImageMapToWindowLevelColors superclass,
vtkImageMapToColors, to do
the following:

pImageMapToWindowLevelColors->SetOutputFormatToRGB()

or, depending on your input:

pImageMapToWindowLevelColors->SetOutputFormatToRGBA
();
pImageMapToWindowLevelColors->PassAlphaToOutputOff();

Dean


> 
> From: "Adrian Wyssmann" <wyssa1 at hta-bi.bfh.ch>
> Date: 2004/11/25 Thu AM 11:03:03 GMT-05:00
> To: <dean.inglis at camris.ca>,  <vtkusers at vtk.org>
> Subject: Re:[vtkusers] Re: vtkImagePlaneWidget problem on vtkImageData (C++)
> 
> 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:
> &lt;http://www.vtk.org/Wiki/VTK_FAQ&gt;
> 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/1e29872c/attachment.gif>


More information about the vtkusers mailing list