Skip to content

Commit

Permalink
fix(monochrome1): fix bug for monochrom1 inverted color (#668)
Browse files Browse the repository at this point in the history
* fix(monochrome1): fix bug for monochrom1 inverted color

* fix web image loader bug where it does not have imageFrame

* remove
  • Loading branch information
sedghi authored Jun 27, 2023
1 parent 4b9c08e commit 0864049
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,10 @@ class StackViewport extends Viewport implements IStackViewport {
}

//If Photometric Interpretation is not the same for the next image we are trying to load, invalidate the stack to recreate the VTK imageData
if (this.csImage?.imageFrame.photometricInterpretation !== image.imageFrame.photometricInterpretation) {
if (
this.csImage?.imageFrame?.photometricInterpretation !==
image.imageFrame?.photometricInterpretation
) {
this.stackInvalidated = true;
}

Expand Down Expand Up @@ -2098,10 +2101,13 @@ class StackViewport extends Viewport implements IStackViewport {
// @ts-ignore: vtkjs incorrect typing
activeCamera.setFreezeFocalPoint(true);

this.setVOI(this._getInitialVOIRange(image));
this.setInvertColor(
imagePixelModule.photometricInterpretation === 'MONOCHROME1'
);
const monochrome1 =
imagePixelModule.photometricInterpretation === 'MONOCHROME1';

this.setVOI(this._getInitialVOIRange(image), {
forceRecreateLUTFunction: !!monochrome1,
});
this.setInvertColor(!!monochrome1);

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

0 comments on commit 0864049

Please sign in to comment.