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

fix(ColorbarCanvas): Fix colorbar rendering issue on small window widths #1649

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions packages/tools/src/utilities/voi/colorbar/ColorbarCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ class ColorbarCanvas {
const { _voiRange: voiRange } = this;
const range = this._showFullImageRange ? this._imageRange : { ...voiRange };

const { windowWidth } = utilities.windowLevel.toWindowLevel(
voiRange.lower,
voiRange.upper
);

let previousColorPoint = undefined;
let currentColorPoint = getColorPoint(0);

Expand All @@ -231,7 +226,9 @@ class ColorbarCanvas {
let rawPixelValue = range.lower;

for (let i = 0; i < maxValue; i++) {
const tVoiRange = (rawPixelValue - voiRange.lower) / windowWidth;
const tVoiRange =
(rawPixelValue - voiRange.lower) /
Math.abs(voiRange.upper - voiRange.lower);

// Find the color in a linear way (O(n) complexity).
// currentColorPoint shall move to the next color until tVoiRange is smaller
Expand Down
Loading