Skip to content

Commit

Permalink
fix(invert): Resetting the stack viewport properties should revert to…
Browse files Browse the repository at this point in the history
… the image's original invert setting (#786)
  • Loading branch information
jbocce authored Sep 18, 2023
1 parent 29e627c commit 027a737
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 027a737

Please sign in to comment.