cornerstone3D icon indicating copy to clipboard operation
cornerstone3D copied to clipboard

CT Image GPU renderer adds lot of white noise

Open toropok opened this issue 2 years ago • 18 comments

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

toropok avatar Sep 26 '22 03:09 toropok

@toropok This might have been fixed by 0.16.8

md-prog avatar Nov 14 '22 12:11 md-prog

@md-prog Thanks! will try it asap

toropok avatar Nov 16 '22 05:11 toropok

@md-prog

This might have been fixed by 0.16.8

unfortunately it doesn't help

toropok avatar Nov 22 '22 08:11 toropok

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

md-prog avatar Nov 22 '22 13:11 md-prog

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

md-prog avatar Nov 22 '22 17:11 md-prog

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

jlopes90 avatar Mar 01 '23 10:03 jlopes90

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.

medicalconnections avatar Apr 26 '23 13:04 medicalconnections

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

sedghi avatar May 05 '23 15:05 sedghi

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:

  • As @sedghi suggested in #832, while loading the image using cornerstoneDICOMImageLoader.wadouri.loadImage(), I had to pass preScale: { enabled: true }
  • Also, in a test case, I found out that the window level breaks when I call cornerstoneDICOMImageLoader.webWorkerManager.initialize() during initialization, and not when I don't. Here's my exact call causing issues:
  cornerstoneDICOMImageLoader.webWorkerManager.initialize({
    maxWebWorkers: concurrency,
    startWebWorkersOnDemand: true,
    taskConfiguration: {
      decodeTask: {
        initializeCodecsOnStartup: false,
      },
    },
  });

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

sgielen avatar Oct 17 '23 10:10 sgielen

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?

sedghi avatar Oct 18 '23 14:10 sedghi

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

mivan08 avatar Nov 06 '23 20:11 mivan08

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?

sedghi avatar Nov 06 '23 20:11 sedghi

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

Here is the images that I tried.

mivan08 avatar Nov 06 '23 21:11 mivan08

image image

mivan08 avatar Nov 06 '23 21:11 mivan08

Any solution for this will be appreciated!

fafa92 avatar Nov 07 '23 06:11 fafa92

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

sgielen avatar Nov 14 '23 16:11 sgielen

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<ICamera> { const { metadata, viewport } = this._cpuFallbackEnabledElement; const { direction } = metadata; ... }

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

dxhsmwqcwelllee avatar May 13 '24 05:05 dxhsmwqcwelllee

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

dxhsmwqcwelllee avatar May 13 '24 06:05 dxhsmwqcwelllee