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

[Bug] array size mismatch updateVTKImageDataWithCornerstoneImage #1746

Open
qianjinfeng opened this issue Jan 13, 2025 · 0 comments
Open

[Bug] array size mismatch updateVTKImageDataWithCornerstoneImage #1746

qianjinfeng opened this issue Jan 13, 2025 · 0 comments
Assignees

Comments

@qianjinfeng
Copy link

Describe the Bug

A potential bug in updateVTKImageDataWithCornerstoneImage of packages/core/src/utilities/updateVTKImageDataWithCornerstoneImage.ts

if the length of pixelData is bigger then the length of scalarData, then the below code aborts.
scalarData.set(pixelData);

Possible solution:
Add lenth check in _checkVTKImageDataMatchesCornerstoneImage of packages/core/src/RenderingEngine/StackViewport.ts

    const pixelData = image.voxelManager.getScalarData();
    const scalarData = imageData.getPointData().getScalars().getData() as PixelDataTypedArray;
    if (pixelData.length > scalarData.length) {
      return false;
     }

Steps to Reproduce

lack this stack of image from the below dicom series
dicomseries.zip

Scroll through all these images, a exception is thrown while new pixel data length is bigger than scalar data's length

The current behavior

the initial scalardata length is 90966 at line 33 while pixel data length is 86900 at line 8.
the scalar can contains the new pixel data
normal

The expected behavior

the initial scalardata length is 90966 at line 33 while pixel data length is 93610 at line 8.
the scalar can't contains the new pixel data, a exception is thrown
exception

OS

Ubuntu 24.04.1 LTS

Node version

v20.17.0

Browser

Version 131.0.6778.139 (Official Build) (64-bit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants