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

Update generateLut.js #572

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tapin13
Copy link

@tapin13 tapin13 commented Dec 20, 2021

After issue on bug described in issue #559

On Ipad, Mac (Chrome, FF)
After function vlutfn(mlutfn(storedValue)) we got result like 0.99609375 or 1.9921875. Result must be int (variable lut is Uint8ClampedArray). Most of time we got round 0.99609375 to 1 and 1.9921875 to 2. But sometimes we got 0.99609375 to 0 and 1.9921875 to 1.
Math.round fix this problem.

On Ipad, Mac (Chrome, FF)
After function vlutfn(mlutfn(storedValue)) we got result like 0.99609375 or 1.9921875. Result must be int (variable lut is Uint8ClampedArray). Most of time we got round 0.99609375 to 1 and 1.9921875 to 2. But sometimes we got 0.99609375 to 0 and 1.9921875 to 1.
Math.round fix this problem.
@swederik
Copy link
Member

My issue with this is that generateLUT is called very often (every time window/level is changed, for example), and so if this rounding operation is not necessary it may hurt performance.

What kind of VOI LUTs are you using that is causing this issue? Can you post the VOI LUT and Modality LUTs that are causing this?

@tapin13
Copy link
Author

tapin13 commented Dec 21, 2021

VOI LUT and Modality LUTs I send undefined.
So it use function generateLinearVOILUT.

About performance, anyway function return float. So js engine make implicit cast to int.

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

Successfully merging this pull request may close these issues.

None yet

2 participants