I spent a few hours today reading through the source and experimenting. I found a few things..
The 7.0 version completely ignores the Window Width and Window Center values in the file by default. You can get it to apply that transform by adding
I think this is a bad idea for the default behavior; it would make more sense to have a no-window flag.
However, this still does not produce the right output. I found that there is a block of code which attempts to covert the pixel to a signed integer (or maybe fake it, I'm not really sure):
Code: Select all
if (info->signed_data == 1)
pixel_value-=32767;
In 6.9.7, this block is only executed if the window_width is 0. This may actually be a bug in this version, but in the case of my file(s) it causes them to render correctly in 6.9.7.
It appears that the DCM decoder assumes the Bits Stored and High Bit DICOM tags are accurate; however in our experience these tags are almost always incorrect and using them to determine the type of stored pixels will result in an incorrect rendering.
I have no idea how you
should detect whether the pixels are actually signed or not..