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(invert): Resetting the stack viewport properties should revert to the image's original invert setting #786

Merged
merged 1 commit into from
Sep 18, 2023
Merged
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
8 changes: 6 additions & 2 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ class StackViewport extends Viewport implements IStackViewport {
private VOILUTFunction: VOILUTFunctionType;
//
private invert = false;
// The initial invert of the image loaded as opposed to the invert status of the viewport itself (see above).
private initialInvert = false;
private interpolationType: InterpolationType;

// Helpers
Expand Down Expand Up @@ -730,7 +732,7 @@ class StackViewport extends Viewport implements IStackViewport {
this.setRotation(0);
}
this.setInterpolationType(InterpolationType.LINEAR);
this.setInvertColor(false);
this.setInvertColor(this.initialInvert);
}

private _setPropertiesFromCache(): void {
Expand Down Expand Up @@ -2066,8 +2068,10 @@ class StackViewport extends Viewport implements IStackViewport {
forceRecreateLUTFunction: !!monochrome1,
});

this.initialInvert = !!monochrome1;

// should carry over the invert color from the previous image if has been applied
this.setInvertColor(this.invert || !!monochrome1);
this.setInvertColor(this.invert || this.initialInvert);

// Saving position of camera on render, to cache the panning
this.cameraFocalPointOnRender = this.getCamera().focalPoint;
Expand Down