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 manipulate Red Channel Like below code in Render-Script in android
Example code where I shown how I manipulate Red Channel of Image. (I do same for Green and Blue Channels)
It does manipulate the JPEG Image Widow Width and Level but not sure if its correct way to manipulate DICOM JPEGS if some body know correct way to manipulate RGB JPEGS Window Width and Level with correct pixel processing math please help me as Its result some what (20%) differs from Windows Based DicomViewers ( I know Window Level and Width is for Monochrome Images Only but Some DicomViewers Such as "ShowCase" they do apply such filters on RGB )
displayMin = (windowLevel- windowWidth/2);
displayMax = (windowLevel+ windowWidth/2);
/*Manipulate Red Channel */
if(current.r < displayMin)
{
current.r = 0;
}
else if(current.r > displayMax)
{
current.r = 1;
}