-
Notifications
You must be signed in to change notification settings - Fork 290
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: Annotations showing up on incorrect images #1460
base: main
Are you sure you want to change the base?
fix: Annotations showing up on incorrect images #1460
Conversation
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
eec641f
to
f267d7c
Compare
const endsWith = referencedImageId?.endsWith(imageURI); | ||
if (endsWith) { | ||
return endsWith; | ||
const referenceColonIndex = referencedImageId.indexOf(':'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use this one packages/core/src/utilities/imageIdToURI.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure can, updated this check as well as the check above it (and fixed some redundancy there)
12e5cc8
to
c7c51fe
Compare
if (endsWith) { | ||
return endsWith; | ||
imageURI = imageIdToURI(referencedImageId); | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why return true here? I don't understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just removes a redundant check
before when it looked like:
if (!imageURI) {
imageURI = imageIdToURI(referencedImageId);
}
if (imageIdToURI(referencedImageId) === imageURI) {
return true;
}
if the first if (!imageURI)
was true then the second would always be true, so simplifying it to
if (!imageURI) {
imageURI = imageIdToURI(referencedImageId);
return true;
} else if (imageIdToURI(referencedImageId) === imageURI) {
return true;
}
saves a call to imageIdToURI(referencedImageId)
and an extra equivalency check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you do this instead
const { imageURI } = options;
// Direct URI match check
const currentImageURI = imageIdToURI(referencedImageId);
if (!imageURI || currentImageURI === imageURI) {
return true;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to use that instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR and patience
Context
Fixes issue described here: #1455
Changes & Results
Modified the image URI check in the
isReferenceViewable
function inStackViewport
from anendsWith
match to an exact match. This stops annotations on images with IDs likedicom:126
(which is the format used by the wadoURI filemanager) from displaying on the imagesdicom:26
anddicom:6
as well.Testing
The repro provided in the linked issue demonstrates the bug, replacing the UMD build of
@cornerstonejs/core
with one containing this change will fix the bug.Checklist
PR
semantic-release format and guidelines.
Code
My code has been well-documented (function documentation, inline comments,
etc.)
I have run the
yarn build:update-api
to update the API documentation, and havecommitted the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api)
Public Documentation Updates
additions or removals.
Tested Environment