[vtk-developers] Bug in vtkImageMapToWindowLevelColors.cxx

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Aug 28 09:46:18 EDT 2007


Hello,

  We have had a long standing bug in GDCM where on one hand we would
need to use vtkImageViewer to be able to play with window/level with
RGB image. But on the other hand we had to use vtkImageViewer2 to be
able to display correctly image with a non rectangular pixel spacing.

  Anyway I decided to track down the issue with vtkImageViewer2, and
found out what the issue might be (see attached patch).
  I am not sure I understand what used to be done before. Apparently
the number of scalar from the input image was not used and the pixel
value from the first component was simply cope paste in all 3/4
components of the output image. Is this really what it was intended to
do ?

...
          if (*iptr <= lower)
            {
            result_val = lower_val;
            }
          else if (*iptr >= upper)
            {
            result_val = upper_val;
            }
          else
            {
            result_val = (unsigned char) ((*iptr + shift)*scale);
            }
          *optr = result_val;
          switch (outputFormat)
            {
            case VTK_RGBA:
              *(optr+1) = result_val;
              *(optr+2) = result_val;
              *(optr+3) = 255;
              break;
...

Thanks for comments,

-- 
Mathieu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: windowlevel.patch
Type: text/x-patch
Size: 5227 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070828/b79b4f9e/attachment-0001.bin>


More information about the vtk-developers mailing list