Support for 16 bit grayscale Images



  • I am designing a dicom viewer for a major company for displaying an medical images..and medical images need more image clarity and better depth.So does QT support 1 bit gray scale images?
    Earlier when i wanted gray scale images i simply used RGB32 format with same values applied to all channels..
    So can anyone clarify is there a way to display 16 bit grayscale images in QT
    and yes i cannot reduce 16 bit image to 8 bit image for display as better clarity is d most important need for medical images.

    For 8 bit gray scale image i used

    char *image
    image->setpixel(*imagebuffer,*imagebuffer,*imagebuffer);

    it worked well for gray scale images


  • Moderators

    Hi, welcome to devnet.

    There is no direct support for 16bit/channel formats in Qt.

    You say you can't reduce it to 8bit but why not exactly? The monitor that displays the image will most probably be 8bit/channel anyway (even the most hi-end monitors display up to only 10bit/channel color), so it will get downscaled. The question is just where. If there was a 16bit format in Qt either Qt would have to do that or the OS graphics api it uses would.

    So you might just as well do it yourself. This way you'll get at least greater control over how it's done eg. apply some transformation like brightness, contrast etc. to get that clarity you need.



  • yes it is a nice idea.
    i jst make sure about monitor and come back to QT,i changed my platform just because no support of 16 bit image

    Thanks for reply :)


  • Lifetime Qt Champion

    Hi,

    To add to Chris Kawa, you could use OpenCV for all the 16bit image processing part and then Qt at the end for the presentation part.

    Hope it helps



  • I am doing something similar. First, remember that except for specialized high-end medical grade displays, you will always be displaying 8bit data, so the question is how do you map the native data to the display.

    I use OpenCV to read my native 16bit grayscale medical images (Actually 11bit stored in a 16bit container) and then calculate a lookup table (based on user supplied settings) which remaps the appropriate window within the 16bit data to 8bit for display.

    Then you can use QPixmap or QImage as needed.

    edit: you wrote "i cannot reduce 16 bit image to 8 bit image for display as better clarity is d most important need for medical images."

    Herein is your primary source of confusion. Not only can you, but you MUST unless you know you will always be using displays capable of showing more than 8 bit. This does NOT imply that you are going to lose clarity in your images. What it does imply is that you must map your raw image to 8bits, and this is where the user defined lookup table (LUT) comes into play. Your user will provide values for window level, brightness/contrast/threshold etc.. These settings do not apply directly to pixels, rather, they are used to calculate a lookup table which is then used to quickly transform the image for display (non-destructively)

    last edit: I'd recommend you get a book like this: "Digital Image Processing for Medical Applications":http://www.cambridge.org/us/academic/subjects/engineering/biomedical-engineering/digital-image-processing-medical-applications


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.