Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
muddasar-de opened this issue Mar 9, 2023 · 11 comments
Closed
Labels
Awaiting Reproduction Can we reproduce the reported bug?

Comments

@muddasar-de
Copy link

muddasar-de commented Mar 9, 2023

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.

@muddasar-de muddasar-de added Awaiting Reproduction Can we reproduce the reported bug? Community: Report 🐛 labels Mar 9, 2023
@pieper
Copy link
Member

pieper commented Mar 9, 2023

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
Copy link
Author

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
Copy link
Member

pieper commented Mar 9, 2023

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
Copy link
Author

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
Copy link
Member

sedghi commented Mar 9, 2023

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
Copy link
Contributor

Ouwen commented Mar 13, 2023

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:

cornerstonejs/cornerstone3D#420

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

@Ouwen
Copy link
Contributor

Ouwen commented Mar 13, 2023

@muddasar-de see this PR: #3235

@JeffersonCurveBeam
Copy link

JeffersonCurveBeam commented May 5, 2023

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:

  • Foot CT
  • 533 slices
  • 950 x 950
  • 35D x 20H

Browser: Chrome

Machine:

  • Dell XPS
  • RAM: 32GB
  • GPU: NVIDIA RTX 3050 Ti GPU

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
Copy link
Member

sedghi commented May 5, 2023

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

@JeffersonCurveBeam
Copy link

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

Thank you, this helped

@sedghi
Copy link
Member

sedghi commented Oct 13, 2023

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

@sedghi sedghi closed this as completed Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Reproduction Can we reproduce the reported bug?
Projects
None yet
Development

No branches or pull requests

5 participants