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] Prescale should be enabled by default #887

Closed
sgielen opened this issue Nov 14, 2023 · 6 comments
Closed

[Bug] Prescale should be enabled by default #887

sgielen opened this issue Nov 14, 2023 · 6 comments

Comments

@sgielen
Copy link
Contributor

sgielen commented Nov 14, 2023

Describe the Bug

As suggested in #832 by @sedghi, enabling prescaling fixed window level issues when loading a stack of images through wadouri. Their comment also mentions that it would make sense to have this enabled by default. I am not sure what the consequences of this would be so I'm hesitant to create the PR myself, but didn't want this to be forgotten, hence this issue.

Steps to Reproduce

A reproduction is available here: https://sjorsgielen.nl/cs3d.zip. It's pretty large since it contains a 90MB volume, so Github doesn't allow me to upload it directly. For future record, here is a zip file containing everything except the volume:
cs3d.zip

First, disable SharedArrayBuffer in the variables at the top of src/main.ts because of #886.

Run yarn install and yarn dev to start the webserver, then browse to the indicated port.

The current behavior

In the default window level, the image is rendered incorrectly. The window level must be set exceedingly high for the image to render normally.

By setting preScale: { enabled: true } in the call to cornerstoneDICOMImageLoader.wadouri.loadImage, the image is rendered normally if no explicit window level is set.

The expected behavior

No specific flags need to be passed for the image to render normally.

OS

macOS 14.0

Node version

20.8.1

Browser

Safari 17.0

@sedghi
Copy link
Member

sedghi commented Nov 15, 2023

would you mind creating a PR for this?

@sedghi
Copy link
Member

sedghi commented Jan 10, 2024

I think this has been fixed in the main branch, we have preScale to true always by default in the wadouri as well, can you check please

@sgielen
Copy link
Contributor Author

sgielen commented Jan 12, 2024

I think this has been fixed in the main branch, we have preScale to true always by default in the wadouri as well, can you check please

I would like to try - but since #990 unfortunately loading images through wadouri does not seem to be possible anymore. I will try on the last release before #990 (1.44.2) for reference. But if I need to run on main (or latest release), I'm afraid I need either a new way to load a cornerstone Image from an ArrayBuffer or the loader option to wadouri should be restored.

@sgielen
Copy link
Contributor Author

sgielen commented Jan 12, 2024

@sedghi I have just tried on 1.44.2 but the issue remains there if preScale.enabled: true is not explicitly passed to cornerstoneImageLoader.wadouri.loadImage(). As mentioned, on 1.44.3 / main I cannot test it, because I need the loader option to load my images, and it has been removed.

@sgielen
Copy link
Contributor Author

sgielen commented Jan 12, 2024

@sedghi I can look into this one and #886 further now that I'm almost on the latest release again. I could use some additional guidance, though, in particular on two topics:

  • could you give me a small overview of how scaling is performed throughout the various components (and why there), perhaps with references to source code?
  • could you share your current method of quickly testing local changes? I've tried various ways to build my test application against local clones of cornerstone3d (e.g. yarn link), and the best way I found is to remove cornerstone3d from my test application's node_modules and symlink the cornerstone3d source directory into it manually. Then, every time I make a source code change to cornerstone3d I rebuild its dist directory, remove my test application's vite cache and restart vite, then reload the page. This works, but is somewhat cumbersome. Any suggestions from your experience for more rapid testing would be welcome here.

@sgielen
Copy link
Contributor Author

sgielen commented Nov 1, 2024

This is now enabled automatically on main, and I can confirm this issue is resolved in Cornerstone3D 2.0.

@sgielen sgielen closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants