OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.3k stars 3.34k forks source link

2D MPR crashes on some CTs with RangeError: Array buffer allocation failed. #3229

Closed muddasar-de closed 1 year ago

muddasar-de commented 1 year ago

We have the CTs with the following details, Dimensions: 512 x 512 Number of slices: 2500 to 3500 OS: Windows Browsers: Google Chrome and Firefox System RAM: 16GB

This problem is for both Local and Cloud environment(AWS) as well.

pieper commented 1 year ago

Please provide details about the CT data that fails, like the slice dimensions, number of slices, and what clinical procedure this comes from. Also describe your environment, like what OS, browser, how much memory your machine has, etc.

muddasar-de commented 1 year ago

Please provide details about the CT data that fails, like the slice dimensions, number of slices, and what clinical procedure this comes from. Also describe your environment, like what OS, browser, how much memory your machine has, etc.

We have the CTs with the following details, Dimensions: 512 x 512 Number of slices: 2500 to 3500 OS: Windows Browsers: Google Chrome and Firefox System RAM: 16GB

This problem is for both Local and Cloud environment(AWS) as well.

pieper commented 1 year ago

Thanks for the extra details. I have also seen array buffer allocation fail for a scan with 2000 slices. I'm not sure there's a planned work around. @sedghi has may be able to comment.

muddasar-de commented 1 year ago

Thanks for the extra details. I have also seen array buffer allocation fail for a scan with 2000 slices. I'm not sure there's a planned work around. @sedghi has may be able to comment.

Appreciate for the response and help. Looking for the @sedghi response.

sedghi commented 1 year ago

There are some plans for this. @Ouwen has written a POC for how to split the slices into different sections and let the user see the first sectoin, until it scrolls to the bottom and it automatically triggers going to next section, maybe he can talk about that. In addition to these kinds of tricks, we are working on the INT_16 texture size which reduces the memory in half, but seems like it has some bugs in Chromium and Safari, more on that here

Ouwen commented 1 year ago

Hi @muddasar-de for desktop use you can increase the memory limit from 1GB to 2GB and it should work with this PR into cornerstone3D-beta:

https://github.com/cornerstonejs/cornerstone3D-beta/pull/420

There is also a partial load PR I am working on which is based on invalidating the displaySetUID

Ouwen commented 1 year ago

@muddasar-de see this PR: https://github.com/OHIF/Viewers/pull/3235

JeffersonCurveBeam commented 1 year ago

Hi we are facing a similar issue. Wondering if there was any progress on this issue.

Issue description

Clicking the 2D MPR button will consume the entire machine's RAM, temporarily crash the browser and then render blank images on the DICOM Viewer.

Our image:

Browser: Chrome

Machine:

Mysteriously we have been able to succeed in using the 2D MPR feature for the same scan with several different machines (Macbook Air M1 with 8GB RAM, Macbook Pro with 16GB RAM, and Lenovo Legion with 32GB RAM and RTX 3060 GPU).

Screenshots

image

image

Browser console

macro.js:64 Error compiling shader '#version 300 es
#define attribute in
#define textureCube texture
#define texture2D texture
#define textureCubeLod textureLod
#define texture2DLod textureLod

#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
precision highp int;
#else
precision mediump float;
precision mediump int;
#endif

/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyDataVS.glsl

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

attribute vec4 vertexDC;

out vec3 vertexVCVSOutput;
uniform mat4 DCVCMatrix;

uniform float dcxmin;
uniform float dcxmax;
uniform float dcymin;
uniform float dcymax;

void main()
{
  // dcsmall is the device coords reduced to the
  // x y area covered by the volume
  vec4 dcsmall = vec4(
    dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),
    dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),
    vertexDC.z,
    vertexDC.w);
  vec4 vcpos = DCVCMatrix * dcsmall;
  vertexVCVSOutput = [vcpos.xyz/vcpos.w](http://vcpos.xyz/vcpos.w);
  gl_Position = dcsmall;
}
': 
h @ macro.js:64
macro.js:64 

0: #version 300 es
1: #define attribute in
2: #define textureCube texture
3: #define texture2D texture
4: #define textureCubeLod textureLod
5: #define texture2DLod textureLod
6: 
7: 
8: #ifdef GL_FRAGMENT_PRECISION_HIGH
9: precision highp float;
10: precision highp int;
11: #else
12: precision mediump float;
13: precision mediump int;
14: #endif
15: 
16: /*=========================================================================
17: 
18:   Program:   Visualization Toolkit
19:   Module:    vtkPolyDataVS.glsl
20: 
21:   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
22:   All rights reserved.
23:   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
24: 
25:      This software is distributed WITHOUT ANY WARRANTY; without even
26:      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
27:      PURPOSE.  See the above copyright notice for more information.
28: 
29: =========================================================================*/
30: 
31: attribute vec4 vertexDC;
32: 
33: out vec3 vertexVCVSOutput;
34: uniform mat4 DCVCMatrix;
35: 
36: uniform float dcxmin;
37: uniform float dcxmax;
38: uniform float dcymin;
39: uniform float dcymax;
40: 
41: void main()
42: {
43:   // dcsmall is the device coords reduced to the
44:   // x y area covered by the volume
45:   vec4 dcsmall = vec4(
46:     dcxmin + 0.5 * (vertexDC.x + 1.0) * (dcxmax - dcxmin),
47:     dcymin + 0.5 * (vertexDC.y + 1.0) * (dcymax - dcymin),
48:     vertexDC.z,
49:     vertexDC.w);
50:   vec4 vcpos = DCVCMatrix * dcsmall;
51:   vertexVCVSOutput = [vcpos.xyz/vcpos.w](http://vcpos.xyz/vcpos.w);
52:   gl_Position = dcsmall;
53: }
54: 

react-dom.production.min.js:196 TypeError: Cannot read properties of null (reading 'isAttributeUsed')
    at Yt.e.setMapperShaderParameters (index.js:383:19)
    at Yt.e.updateShaders (index.js:367:15)
    at Yt.e.renderPieceDraw (index.js:918:15)
    at Yt.e.renderPiece (index.js:1037:15)
    at Yt.e.volumePass (index.js:74:17)
    at e.apply (index.js:44:7)
    at e.traverse (index.js:32:15)
    at Ot.e.traverseVolumePass (index.js:49:23)
    at e.traverse (index.js:27:7)
    at e.traverse (index.js:35:29)
sedghi commented 1 year ago

also for some systems the notes here is helpful https://github.com/cornerstonejs/cornerstone3D-beta/issues/453

JeffersonCurveBeam commented 1 year ago

also for some systems the notes here is helpful cornerstonejs/cornerstone3D-beta#453

Thank you, this helped

sedghi commented 1 year ago

Please review the latest code in the master branch. I am confident that this issue has been resolved. If it persists, kindly reopen the issue with updated details.

Try viewer-dev.ohif.org instead of viewer.ohif.org Our viewer.ohif.org is deployed from release branch while viewer-dev.ohif.org is our master branch Read more about branch explanations here https://docs.ohif.org/development/getting-started#developing