If we convert a DICOM image to JPEG, what is the way to translate / calculate Image width = 500, Window Level = 2000 of the original DICOM to JPEG's brightness and contrast?
3 Answers
There's no direct answer to your question, since DICOM and JPEG have different ways to define brightness/contrast. JPEG stores true color values (RGB), while DICOM have raw pixel values, uncolored most of the time. A DICOM viewer renders it by reading the Window Level and Width and convert this to color.
That is, you can say that you want your JPEG to have its pixel colors as if it was rendered by a viewer. In your case pixels smaller than 1500 will be rendered as black, and those greater than 2500 as white.
There are other factors, such as the photometric interpretation, to consider when interpreting a DICOM's pixel intensity relative to window level and width.
But, assuming MONOCHROME2 for photometric intepretation, the following is a simple linear equation.
minWindowValue = windowLevel - (windowWidth / 2)
jpegValue = 255 * (dicomValue - minWindowValue) / windowWidth
Cheers, Mike
According to DICOM Standard PS 3.3 section A.1.2.10, "The VOI LUT IE defines the Attributes that describe the transformation of the modality pixel values into pixel values that are meaningful for print, display, etc. This transformation is applied after any Modality LUT."
VOI LUT may be included with the image, or in a presentation state object that references the image. The linear VOI LUT transformation is described by the Window Center (0028, 1050) and Window Width (0028, 1051) and non-linear is described by VOI LUT Sequence (0028,3010). In addition, a non-linear interpretation of Window Center and Window Width could be defined by VOI LUT Function (0028, 1056).
Please not that VOI LUT transformation is applied "after any Modality LUT" transformation. So to achieve the proper output value for VOI LUT transformation, you should apply the Modality LUT transformation when it is included with the image or presentation state that references the image. DICOM standard states "The Modality LUT IE defines the Attributes that describe the transformation of manufacturer dependent pixel values into pixel values which are manufacturer independent (e.g. Hounsfield units for CT, Optical Density for film digitizers, etc.)".
Similar to VOI LUT transformation, Modality LUT can be linear and represented by Rescale Slope (0028,1053) and Rescale Intercept (0028,1052). Whereas non non-linear, Modality LUT is described by Modality LUT Sequence (0028, 3000).
The linear Modality LUT transformation is calculated using following:
Output = m*SV + b.
Where “m” is Rescale Slope (0028, 1053), “b” is Rescale Intercept (0028,1052) and SV is the stored image pixel value in the dataset.