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: Having sop instance in a per-frame or shared attribute breaks load #4560

Merged
merged 14 commits into from
Jan 15, 2025

Conversation

wayfarer3130
Copy link
Contributor

@wayfarer3130 wayfarer3130 commented Nov 29, 2024

Context

requires cornerstonejs/cornerstone3D#1752

Some PACS systems combine single frame into multi-frame and then record the original SOPInstanceUID in the per frame attribute sequence. This PR simply omits such per frame instances.

Changes & Results

Uses a shared object for the parent series/instance data rather than merging, and avoid over-riding anything containing a SOP instance UID.
This addresses #4551
It also addresses the issue from Jagan Vijayaraghavan in slack, for which he provided the study below.
StudyWithSOPInFrameSequence.zip

The issue is that a shared functional groups sequence contains an original SOP instance UID for another object, and that SOP ends up replacing the correct SOP/Series UIDs, causing the wrong UIDs to be used.

Testing

Load the study with the per-frame data from the cornerstone chat

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] OS:
  • [] Node version:
  • [] Browser:

@wayfarer3130 wayfarer3130 requested a review from sedghi November 29, 2024 16:14
Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit 6b9852c
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/6787e6d218750c0009b1fc6d
😎 Deploy Preview https://deploy-preview-4560--ohif-platform-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for ohif-dev failed. Why did it fail? →

Name Link
🔨 Latest commit 6b9852c
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/6787e6d20741440008fc7bdc

// During a resize, the slice index should remain unchanged. This is a temporary fix for
// a larger issue regarding the definition of slice index with slab thickness.
// We need to revisit this to make it more robust and understandable.
delete presentation.viewReference.sliceIndex;
if (presentation?.viewReference) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still an issue entering MPR mode, but at least it doesn't throw

Copy link

cypress bot commented Nov 29, 2024

Viewers    Run #4701

Run Properties:  status check passed Passed #4701  •  git commit 6b9852c265: refactor(combineFrameInstance): Remove outdated comments and improve property as...
Project Viewers
Branch Review fix/sop-instance-in-per-frame
Run status status check passed Passed #4701
Run duration 02m 11s
Commit git commit 6b9852c265: refactor(combineFrameInstance): Remove outdated comments and improve property as...
Committer sedghi
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 44
View all changes introduced in this branch ↗︎

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is broken now after this PR, it does not go MPR, it was working before

datscan upside down.zip

@sedghi
Copy link
Member

sedghi commented Jan 9, 2025

@wayfarer3130 can you upload an anonymized study that does not work right now or bug report issue number

@wayfarer3130
Copy link
Contributor Author

@sedghi - could you check the uploaded study? That study works correctly now, but I don't understand why your MPR issue breaks. I tried looking at that, but if you could help debug that with me sometime I'd appreciate it.

wayfarer3130 and others added 5 commits January 9, 2025 10:36
…t component

- Removed unused SpacingBetweenSlices variable from combineFrameInstance function.
- Enhanced handling of ImagePositionPatient and ImageOrientationPatient by converting values to numbers.
- Updated the way newInstance properties are assigned using Object.defineProperty for better control.
- Cleaned up LayoutPreset component by removing unnecessary debug statement.
Object.entries(item).forEach(([key, value]) => {
newInstance[key] = value;
});
// Note: do not assign directly to newInstance.ImagePositionPatient
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note doesn't seem to apply - I tried with:
objPar = { a: 3, b:4 }
objChild = Object.create(objPar)
objChild.a = 'ay'
objChild.c = 'c'
console.log("obj=", objChild.a, objChild.b, objChild.c, objPar.a)
And I see ay, 4, 'c', 3
which is what I expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the instance is a proxy object and what we are seeing is a proxy assignment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what is happening but it is the issue. The instance.ImagePositionPatient should not change


// merge the shared first then the per frame to override
[...shared].forEach(item => {
if (item.SOPInstanceUID) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we simply avoid overriding any values in the child? I know this tests for the SOPInstanceUID, but I would guess other things could get overridden.

Copy link
Contributor Author

@wayfarer3130 wayfarer3130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow this won't let me approve today - other than the comment about the proxy I think it is fine.

@sedghi sedghi merged commit cded082 into master Jan 15, 2025
16 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants