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 invalidate stack if the next image is different PI #631

Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,11 @@ class StackViewport extends Viewport implements IStackViewport {
return;
}

//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) {
this.stackInvalidated = true;
}

this._setCSImage(image);

const eventDetail: EventTypes.StackNewImageEventDetail = {
Expand Down
3 changes: 3 additions & 0 deletions utils/test/testUtilsImageLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const fakeImageLoader = (imageId) => {
getPixelData: () => pixelData,
sizeInBytes: rows * columns * 1, // 1 byte for now
FrameOfReferenceUID: 'Stack_Frame_Of_Reference',
imageFrame: {
photometricInterpretation: rgb ? 'RGB' : 'MONOCHROME2',
},
};

return {
Expand Down