Skip to content Skip to sidebar Skip to footer

Correct Pixel Processing Logic For Dicom Jpeg(rgb) For Applying Window Width And Level Filter

I am trying to apply widow width and level filter to JPEG Image which I extracted from DICOM file. Here is logic I use to process Each Channel of RGB Image fore example I manipulat

Solution 1:

Your current approach simply truncates the input data to fit the window, which can certainly be useful. However, it doesn't really let you see see the benefit of the window/level, particularly on images greater than 8bpp, because it doesn't enhance any of the details.

You'd typically want to remap the windowed input range (displayMin to displayMax) onto the output range (0 to 1) in some way. I don't think there is a definitive 'correct' approach, although here's a simple linear mapping that I find useful:

if (current.r <= displayMin || displayMin == displayMax)
{
    current.r = 0;
}
elseif (current.r >= displayMax)
{
    current.r = 1;
}
else
{
    current.r = (current.r - displayMin) / (displayMax - displayMin);
}

What that's doing is simply taking your restricted window, and expanding it to use the entire colour-space. You can think of it like zooming-in on the details.

(The displayMin == displayMax condition is simply guarding against division-by-zero.)

Post a Comment for "Correct Pixel Processing Logic For Dicom Jpeg(rgb) For Applying Window Width And Level Filter"