[magick-developers] DICOM bug
jcupitt at gmail.com
jcupitt at gmail.com
Mon Mar 9 19:07:09 UTC 2009
Hi,.
I think I've found a bug in the DICOM reader. In the current 6.4.9-8,
coders/dcm.c has in sketch form:
unsigned long
index,
...
index=ReadBlobLSBShort(image)
then at line 3487:
if (signed_data == 1)
index-=32767;
then later:
index=1UL*ConstrainColormapIndex(image,index);
pixel.red=1UL*image->colormap[index].red;
pixel.green=1UL*image->colormap[index].green;
pixel.blue=1UL*image->colormap[index].blue;
So if we are reading signed data we subtract 32767 from the colour map
index (an unsigned value). This produces a huge positive value for all
indexes less than 32767, which then gets clipped to 65535 by
ConstrainColormapIndex().
I suggest just removing the "if (signed_data == 1) index-=32767;"
lines. I'm not sure where this functionality should go. Perhaps after
looking up in the colormap?
John
More information about the Magick-developers
mailing list