[vtk-developers] Incorrect color function in vtkImageMapToWindowLevelColors with lookupTable

David Gobbi david.gobbi at gmail.com
Fri May 25 17:52:50 EDT 2018


Hi Victor,

I've written dozens of VTK apps for medical image visualization,
and I haven't used vtkImageViewer2 for any of them, nor have I
ever used vtkImageMapToWindowLevelColors.  I've always used
one of the following approaches:

1) Generate an RGB or RGBA image with vtkImageMapToColors,
 (use the Range of vtkLookupTable to control the window/level),
 put the image in a vtkTexture, and then apply the texture to a
 rectangular polygon.  This is for 2D images or for image slices
 extracted from a volume with vtkImageReslice.

2) Same as above, but with vtkImageActor instead of vtkTexture.

3) Recently, I've switched to a new set of classes that I wrote for VTK:
 https://www.vtk.org/Wiki/VTK/Image_Rendering_Classes


VTK's colors are 8-bit, meaning 24-bit RGB or 32-bit RGBA. If you
need something for a 10-bit monitor, that might be difficult.  You
wouldn't be able to use vtkLookupTable, because even though you
sets its color components as values in the range [0.0, 1.0], it stores
the values as integers with a range of [0,255].

 - David


On Fri, May 25, 2018 at 3:08 PM, xVict <suharev at roentgenprom.ru> wrote:

> Hi David!
>
> 1. We want to show the medical image correctly
> As a starting point, consider an example:
> https://lorensen.github.io/VTKExamples/site/Cxx/IO/ReadDICOM/
> We have next pipeline:
> vtkDICOMImageReader->vtkImageViewer2
> By mouse we can change windowLevel and windowWidth.
> ImageViewer2 internally transform 16bit input gray to output r=g=b color
> into the render window.
> Internally ImageViewer2 use vtkImageMapToWindowLevelColors for
> window-level.
>
> 2. I want use the same transformation but with LUT for 10-bit monitor.
> Because I pass my LUT to this class.
> imgViewer->GetWindowLevel()->SetLookupTable(colorLut);
> And for tests I using LUT with r=g=b.
> If that's wrong, correct me. (Specify the correct example to display 16-bit
> images on a 10-bit monitor).
> But this does not exclude the incomprehensible code in the
> vtkImageMapToWindowLevelColors class. Values less than 16 go to zero.
>
> Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtk-developers/attachments/20180525/0aa3b811/attachment.html>


More information about the vtk-developers mailing list