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
573 stars 292 forks source link

CT Image GPU renderer adds lot of white noise #225

Open toropok opened 2 years ago

toropok commented 2 years ago

Hi,

For our custom DICOM viewer we use following libs:

"@cornerstonejs/core": "^0.16.3",
"@kitware/vtk.js": "24.18.7",
"wslink": "^1.8.2",
"gl-matrix": "^3.4.3”,
"cornerstone-wado-image-loader": "^4.2.1"

Unexpetedly cornerstone adds a lot of white to images while rendering (except first image in series):

https://user-images.githubusercontent.com/14867014/192189820-f2121204-16e2-46d6-aac9-f1b9c6cae864.mov

But if you're setting CPU render only - this "white" effect dissappears

cornerstone.setUseCPURendering(true)

https://user-images.githubusercontent.com/14867014/192190164-878fa145-f29c-4782-9235-47687f553efd.mov

What may cause that?

regards, --leo

md-prog commented 1 year ago

@toropok This might have been fixed by 0.16.8

toropok commented 1 year ago

@md-prog Thanks! will try it asap

toropok commented 1 year ago

@md-prog

This might have been fixed by 0.16.8

unfortunately it doesn't help

md-prog commented 1 year ago

@toropok Indeed, it's unfortunate. It resolved mine.

md-prog commented 1 year ago

@toropok Is there any chance you can post the anonymized DICOM file for us to test and fix?

jlopes90 commented 1 year ago

It's really my problem.

image

I tested using cornerstone.setUseCPURendering(true) and it worked.

A very strange thing, I've been testing example "DICOM P10 from local file system" the result was right. I don't see what the difference is.

image

medicalconnections commented 1 year ago

I am having the same issue and could provide an anonymized study that reproduces it. I think it has to do with the way the windowing values are used but unsure. I tried the CPU rendering and the images will render correctly (but breaks some other things so I would like to stick to GPU rendering).

The odd thing is that when I load only 1 canvas, I am able to scroll through the images and it gets rendered correctly. image

NOTE: The thumbnails are bitmaps so they are not cornerstone canvases.

As soon as another canvas comes in play, it will become white like this: image

The cached images (when it was only 1 canvas active and I scrolled through few images) are actually loading fine and only the newly rendered images become white: image

It really feels like one of the group 28 attributes is causing this issue and only for GPU rendering. Hope this can be fixed.

sedghi commented 1 year ago

can you try again now, I moved the canvas rendering to gpu, but the API has changed to accept an object

sgielen commented 1 year ago

For me, two issues were causing problems with window levels. I will file them separately, but for future reference I'll put a summary here:

These issues are filed separately as #887 and #888, and might be related to this issue.

sedghi commented 1 year ago

Could you kindly provide the data if it has been anonymized and you can confirm that there is no patient health information present in any of the headers or embedded within the pixel data?

mivan08 commented 1 year ago

The issues is occurring from me as well. Hope to fix this issue asap.

sedghi commented 1 year ago

Could you kindly provide the data if it has been anonymized and you can confirm that there is no patient health information present in any of the headers or embedded within the pixel data?

mivan08 commented 1 year ago

https://drive.google.com/file/d/1XdpbPhwQQH3_3QiKiVmZ_QevRK2ECyFO/view?usp=sharing

Here is the images that I tried.

mivan08 commented 1 year ago

image image

fafa92 commented 1 year ago

Any solution for this will be appreciated!

sgielen commented 12 months ago

I've filed #887 and #888 as possible root causes for this issue, including reproduction cases and a workaround.

dxhsmwqcwelllee commented 6 months ago

use cpu render

private _resizeUsingCustomResizeHandler( customRenderingViewports: StackViewport[], keepCamera = true, immediate = true ) { // 1. If viewport has a custom resize method, call it here. ... // 3. Reset viewport cameras customRenderingViewports.forEach((vp) => { const prevCamera = vp.getCamera(); vp.resetCamera();

  if (keepCamera) {
    vp.setCamera(prevCamera);
  }
});

// 2. If render is immediate: Render all
if (immediate === true) {
  this.render();
}

}

private getCameraCPU(): Partial { const { metadata, viewport } = this._cpuFallbackEnabledElement; const { direction } = metadata; ... }

there is an error: Cannot read properties of undefined (reading 'direction') @sedghi

dxhsmwqcwelllee commented 6 months ago

use cpu render. Enums.Events.VOI_MODIFIED Will not trigger the first time @sedghi