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

feat: Add range support for key image tool #1743

Merged
merged 18 commits into from
Jan 21, 2025
Merged

feat: Add range support for key image tool #1743

merged 18 commits into from
Jan 21, 2025

Conversation

wayfarer3130
Copy link
Collaborator

@wayfarer3130 wayfarer3130 commented Jan 9, 2025

Context

Key images can be used to identify several different things within a series. They might identify specific points as a Fiducial, or they might be a series label or a range, or a selection of several images within the same series. This change adds the ability to select various parts of a series within an annotation.

Also, the performance of the isReferenceViewable was very poor and the results were inconsistent. This PR addresses the performance by adding a map of image id to location and caching additional test locations where needed.

The API is nearly the same - there are a couple of small internal changes in the view references, but unless there are previously stored view references with ranges, those should not affect this PR.

The range references are not supported yet for volume viewports, but the existing view references are supported.

Changes & Results

Testing

Run the stackRange and videoRange examples
Note the consistsency between range value settings between both viewport types.

Checklist

PR

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

Code

Public Documentation Updates

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

Tested Environment

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

Copy link

stackblitz bot commented Jan 9, 2025

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Jan 9, 2025

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 1165577
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/678fcccb0ff70f0008eb0d0f
😎 Deploy Preview https://deploy-preview-1743--cornerstone-3d-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.

@wayfarer3130 wayfarer3130 changed the title [WIP] fix: Start moving adapters to shared base file to allow for updates [WIP] feat: Add range support for key image tool Jan 13, 2025
@wayfarer3130 wayfarer3130 changed the title [WIP] feat: Add range support for key image tool feat: Add range support for key image tool Jan 15, 2025
@wayfarer3130 wayfarer3130 requested a review from sedghi January 15, 2025 13:29
/**
* The end index - this requires sliceIndex to be specified.
*/
sliceRangeEnd?: number;
Copy link
Member

Choose a reason for hiding this comment

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

does it makes sense to have

sliceIndex?: number -> for single index
sliceRange?: [number, number] -> for range

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, I'm trying to get away from sliceIndex at all since it really isn't deterministic between different display sets contain the same set of images. I would have liked to get rid of it in this PR, but that was more of an API change than I was willing to contemplate here, whereas the simple change to have two different values instead of number | [number,number] is much more internally consistent with the current API, even though it is a small change.

* where the sliceIndex is the first point. This is a positive value if defined,
* so can be tested for `sliceRangeEnd`.
*/
sliceRangeEnd?: number;
Copy link
Member

Choose a reason for hiding this comment

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

same

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd rather have a separate numberr here - this one will be left as indices as it actually refers to specific slices in a consistent fashion, but even with that, the use of sliceIndex is consistent between single and ranges, so I think I'd like to leave it as a separate value.

Copy link
Member

Choose a reason for hiding this comment

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

As discussed we will move off number and do a referencedEndId or something

* An internal URI version of hte referencedImageId, used for performance
* while checking the referenced image id.
*/
referencedImageUri?: string;
Copy link
Member

Choose a reason for hiding this comment

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

we have FrameOfReferenceUID above, so is this referencedImageURI ?

I don't see anywhere else in the code we have referencedImageUri but i see 16 occurences of referencedImageURI

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the docs to explain it - there is no relationship to FrameOfReferenceUID

Copy link
Member

Choose a reason for hiding this comment

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

we don't have referencedImageUri at all in the codebase and have 16 referencedImageURI already, that is my point

return false;
}
const {
Copy link
Member

Choose a reason for hiding this comment

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

We should start writing tests for the isReferenceViewable feature. Consider adding some for this PR; if not, we should do it in the future.

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.

see my comments, thanks

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.

just a minor renaming proposal

@sedghi
Copy link
Member

sedghi commented Jan 21, 2025

can you rename endRangeImageURI to rangeEndImageURI as well?

@wayfarer3130 wayfarer3130 requested a review from sedghi January 21, 2025 16:36
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.

Thanks, looks great

@sedghi sedghi merged commit 6dff931 into main Jan 21, 2025
29 checks passed
@wayfarer3130 wayfarer3130 deleted the feat/key-image-range branch January 22, 2025 16:51
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