cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
557 stars 285 forks source link

[Bug] Hounsfield measurements are incorrect when using useNorm16Texture(int16Array) - Volume(MPR Layout) #1397

Closed Enriquez-Johnmark closed 2 months ago

Enriquez-Johnmark commented 2 months ago

Describe the Bug

I have observed some unexpected behavior when using tools that measure Hounsfield units, such as the circle or ellipse tool. In a cone beam scan, the Hounsfield value in air or empty space should be -1000. However, I noticed that when useNorm16Texture is enabled, the value reads -7000. Disabling useNorm16Texture restores the expected value, which I believe should be -1000.

Additional Notes: When I refresh the browser or study, the calculation becomes incorrect again.

Steps to Reproduce

  1. Enabled useNorm16Texture in your config files: useNorm16Texture : true
  2. Then select MPR mode.
  3. Use any tool such as the circle, freehand or ellipse and measure the black space/air/empty space in the scan.

The current behavior

So the current behavior is inaccurate, the value reads -7000. I'm not using preferSizeOverAccuracy in my config file. I only use the following settings in my config file:

useSharedArrayBuffer: true,
useNorm16Texture: true

When useNorm16Texture is enabled, the volume array object is int16Array. When it is disabled, I think it is Float32Array. See image below:

Screenshot 2024-07-18 at 1 08 40 PM

Using int16Array:

image

The expected behavior

It should return a correct Hounsfield value. which I believe should be -1000. This is the correct value, see image below:

Screenshot 2024-07-18 at 1 08 59 PM

FYI: Not just air/black/empty area.. Most of the areas have incorrect Hounsfield unit calculations. First image: useNorm16Texture is enabled Second image: useNorm16Texture is disabled I'm using the default config. I think the value returned is roughly 10 times than the actual value. See images below:

Screenshot 2024-07-23 at 10 48 39 AM useNorm16Texture is enabled

Screenshot 2024-07-23 at 10 49 46 AM useNorm16Texture is disabled

Important Note: We're utilizing useNorm16Texture to manage large volumes for Multi-Planar Reconstruction (MPR) and reduce memory footprints, as our scans are quite large. Set-up: Orthanc + OHIF

OS

OS X 10.15.7

Node version

v22.4.1

Browser

Chrome 126.0.6478.183

sedghi commented 2 months ago

links https://github.com/OHIF/Viewers/issues/4296

Enriquez-Johnmark commented 2 months ago

Hi @sedghi , I wanted to follow up and ask if you had a chance to reproduce the issue with the Hounsfield units. If there's any guidance you can provide, it would be greatly appreciated. Thank you

sedghi commented 2 months ago

I can reproduce this issue and am working on a fix soon.

Enriquez-Johnmark commented 2 months ago

Thank you so much..