cornerstone3D
cornerstone3D copied to clipboard
[Bug] Image does not rendered in proper way (GPU rendering)
Describe the Bug
In case if we are using CPU rendering it works fine, but in case GPU this image inverted. Please see attached anonimized file DICOM sample Issue with Invertion.zip
Steps to Reproduce
run GPU rendering
run CPU rendering
The current behavior
Image inverted and not rendered in proper way
The expected behavior
Image should be rendered in the correct way and the result should not depend on the rendering type.
OS
Windows 10, Mac os
Node version
v18.14.1
Browser
Chrome 120.0.6099.131
old cornerstone was rendering it correctly in and OHIF v2
@sedghi any updates?
No not yet
Hi @sedghi , Our customer is facing this issue, Would your team please help to check that or any clue we can address?
@sedghi
could this issue related to function toLowHighRange(
windowWidth: number,
windowCenter: number
): {
lower: number;
upper: number;
} {
const delta = 0.001; // small value to prevent zero width
const lower = windowCenter - 0.5 - (windowWidth - 1) / 2;
let upper = windowCenter - 0.5 + (windowWidth - 1) / 2;
// upper and lower should be non equal (upper should be bigger than lower)
if (upper - lower < delta) {
upper = lower + delta;
}
return { lower, upper };
}
export { toWindowLevel, toLowHighRange };
Upper and lower should be non equal (upper should be bigger than lower). and for this image we have Window Width: 1 Window Center: -2
so as a result lower === upper === -2.5
The display is still not perfect with the change suggested by @Max-Kharitonov, but it is a lot better. The issue is that the vtk colorTransferFunction doesn't seem to correctly deal with the case when the window width is set to 1 (threshold value) or we are encountering a rounding issue.
@s2ramana I fixed some issue with window level recently can you check again?
@sedghi which PR was this changed made in?
@sedghi still reproducible
@sedghi could you please take a look? https://github.com/cornerstonejs/cornerstone3D/pull/1135