We’ve encountered an issue with how OHIF Viewer come up with the initial window level for DICOM images (issues reported here and here). Users are reporting that our rendering is either too dark or too bright. I’ve provided one example DICOM files for reference:
This update broke our rendering (now overly dark or bright). Other tools like 3D Slicer, Weasis, and VolView render the same files better. My hypothesis is that they may apply some kind of fallback for smaller or invalid values, but this is unconfirmed.
Question:
Should we adjust our formula to handle edge cases or revert to the simpler approach?
I’ve drafted a PR here, but I’m seeking advice on how to handle these cases properly.
This is addressed in DICOM by the LINEAR_EXACT method, which provides the appropriate calculation. For the history of this, see CP1264.
When the VOILUTFunction value is not present to signal the use of the exact function, you can give the user control of the selection of function to apply, and/or make up some heuristic based on the range of actual values of window center and width to select one or the other method by default.
Note that part of the problem is the abuse of the Rescale Slope and Intercept data elements that are applied to produce small values before windowing in the first place - the VOI LUT Module and the Rescale Slope and Intercept attributes are NOT part of the MR IOD and IMHO should be avoided, but the vendors do it anyway (Philips actually has a configuration in their scanner to turn this off).
Take care not to screw up you PET rendering if you apply this in the general case (again, heuristics may be needed, this time to check whether the window center and width as supplied are intended to apply to the stored pixel values or the rescaled pixel values).
You can test whether or not the exact function will work for a particular image using my PixelMed DicomImageViewer tool here.
Thanks David for your prompt answer.
I updated the PR to correctly implement the LINEAR_EXACT, which solves the issue for one of the files that already specifies LINEAR_EXACT, and i’m getting correct VOI (see below)
I tried your DICOMImageViewer Tool (i had a lot of issues with new apple macbooks, so for future people reading, you need to install https://openwebstart.com/ and then run the jnlp with openwebstart) , but anyway both are not rendered in your viewer at least default settings, but when I change window calculation to exact they render correctly
So my question is the file does not specify LINEAR_EXACT, so is it fine to assume LINEAR_EXACT for windowWidth that are small (let’s say < 2) ?
It is hard to say what the best heuristic for this would be, but there aren’t many situations in which such a narrow window would have applicability. Alternatively, you can use the size of RescaleSlope to predict what images are likely to have this problem if windowing is applied after rescaling.
I don’t have enough real-world data on which to base a more precise recommendation.
As long as the user can select the alternative mechanism, whatever the default selection is will not be the ned of the world.