It appears there is some version or platform difference in how ImageMagick handles 16-bit grayscale DICOM images. Our code has not changed; on Linux and Windows with ImageMagick 6.4.3 we get a 16-bit grayscale result, wherease on Mac with ImageMagick 6.7.8 we get an RGB (3x8bits) image (with apparently identic color channels). This means serious loss in the precision (16 bits->8 bits). Is it possible to somehow force the 16-bit grayscale output? Our code is using Magick++ and looks about like this:
Code: Select all
Magick::Image image;
image.read(filename.c_str());
Magick::ImageType t = image.type();
if (t==Magick::GrayscaleType || t==Magick::GrayscaleMatteType) {
switch(image.depth()) {
case 8:
image.write(0, 0, w, h, "I", Magick::CharPixel, buffer);
break;
default:
image.write(0, 0, w, h, "I", Magick::ShortPixel, buffer);
break;
}
} else {
image.write(0, 0, w, h, "BGR", Magick::CharPixel, buffer);
}
TIA