-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix jump to measurement #4867
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 jump to measurement #4867
Conversation
✅ Deploy Preview for ohif-dev canceled.
|
❌ Deploy Preview for ohif-platform-docs failed. Why did it fail? →
|
Viewers
|
Project |
Viewers
|
Branch Review |
fix/jump-to-measurements-mpr
|
Run status |
|
Run duration | 02m 07s |
Commit |
|
Committer | sedghi |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
1
|
|
0
|
|
2
|
|
0
|
|
42
|
View all changes introduced in this branch ↗︎ |
Tests for review
cypress/integration/volume/MPR.spec.js • 1 failed test
Test | Artifacts | |
---|---|---|
OHIF MPR > should correctly render Crosshairs for MPR |
Test Replay
Screenshots
Video
|
…easurement handling - Added `options` parameter to `commandsModule` for better measurement context. - Implemented `isReferenceViewable` utility to determine viewport visibility based on measurement metadata. - Updated `ViewportGrid` to handle measurement events more effectively, ensuring viewports can respond to reference viewability. - Refactored measurement subscription logic to improve performance and clarity. - Introduced `getClosestOrientationFromIOP` utility for better orientation handling in measurements.
- Changed active tool from Length to WindowLevel in default tool groups. - Added Length tool to passive tool groups for better accessibility. - Updated right panel configuration to include segmentation alongside measurements. - Enabled right panel closure for improved user experience. - Introduced isReferenceViewable method in ViewportGridState for enhanced reference viewability checks.
…t options - Updated `isReferenceViewable` to include `displaySetService` for improved reference image checks. - Adjusted viewport options handling in `ViewportGrid` to ensure proper configuration is passed. - Added logic to check for stack viewport types and retrieve image IDs accordingly.
…unction - Moved the jump to measurement logic from the main component to a dedicated helper function for improved readability and maintainability. - Simplified the viewport display check logic in `ViewportGrid` to enhance clarity and performance. - Updated the handling of measurement metadata to streamline the reference viewability checks.
…measurement interactions - Introduced a new test suite for the Jump to Measurement MPR feature using Playwright. - Implemented tests to validate hydration, measurement tracking, and viewport interactions. - Added multiple screenshot paths to capture the state during various test scenarios. - Included new screenshot assets for initial draw, scrolling away, jumping to measurement stack, and changing series in MPR.
elementRef, | ||
viewportId, | ||
servicesManager | ||
const { unsubscribe } = measurementService.subscribe( |
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 we call it jumpToViewReference? It just feels like there should be uses of it for things other than measurements - I'm thinking segmentation changes or remembering previously displayed layouts on layout change?
if (!displaysUIDs?.length) { | ||
// Helper function to handle jumping to measurements | ||
function handleJumpToMeasurement(event, elementRef, viewportId, cornerstoneViewportService) { | ||
const { measurement, isConsumed } = event; |
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 we get rid of the isConsumed and perform the action in a single application, adding the ability to apply directly on view?
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.
I don't think we can... The data loads into the viewports much later. What I've done is:
- Try the layout in
viewportGrid
. If someone already has thatdisplaySet
, bail out quickly and let the viewport handle the jump. - Try the layout in
viewportGrid
. If no one has thatdisplaySet
, set the viewports with thatDS
on the grid based on theHP
. Meanwhile, write down theviewReference
in the ZustandpositionPresentation
store so that it gets picked up later in thecornerstoneViewportService
to get applied after the data loads.
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.
If you have written it out to the position presentation in Zustand, then you don't need the consume piece - it is already stored/available for that position, so it should get retored automatically exactly the same way as remembered positions get loaded.
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.
Pull Request Overview
This PR refactors the measurement jumping logic in the cornerstone extension and related modules to fix issues with outdated methods and improve viewport management. Key changes include refactoring the measurement event subscriptions to remove caching, integrating a new isReferenceViewable utility function across viewports, and updating the viewport service and commands to support these changes.
Reviewed Changes
Copilot reviewed 31 out of 38 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
extensions/measurement-tracking/src/getViewportModule.tsx | Integrated isReferenceViewable utility for tracked viewports |
extensions/measurement-tracking/src/contexts/TrackedMeasurementsContext/measurementTrackingMachine.js | Removed unused/commented code regarding SR hydration |
extensions/measurement-tracking/src/contexts/TrackedMeasurementsContext/TrackedMeasurementsContext.tsx | Updated measurement event logic with confirmation bypass based on appConfig |
extensions/default/src/getViewportModule.tsx | Added isReferenceViewable function returning false for the chart viewport |
extensions/default/src/ViewerLayout/index.tsx | Adjusted returned object structure to include isReferenceViewable from the entry |
extensions/cornerstone/src/utils/isReferenceViewable.ts | Added a new utility to determine reference viewability from orientation data |
extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts | Introduced getViewportDisplaySets method and changed WITH_NAVIGATION configuration |
extensions/cornerstone/src/init.tsx | Updated measurement service subscriptions to include both viewport and layout events |
extensions/cornerstone/src/index.tsx | Integrated isReferenceViewable callback into the cornerstone viewport module |
extensions/cornerstone/src/commandsModule.ts | Modified jump-to-measurement presentation data to include additional options |
extensions/cornerstone/src/Viewport/OHIFCornerstoneViewport.tsx | Refactored measurement jump handling by removing caching and updating event subscriptions |
extensions/cornerstone-dicom-sr/src/init.ts | Removed deprecated measurement service subscription for layout jumps |
Files not reviewed (7)
- extensions/cornerstone-dicom-pmap/package.json: Language not supported
- extensions/cornerstone-dicom-seg/package.json: Language not supported
- extensions/cornerstone-dicom-sr/package.json: Language not supported
- extensions/cornerstone-dynamic-volume/package.json: Language not supported
- extensions/cornerstone/package.json: Language not supported
- extensions/measurement-tracking/package.json: Language not supported
- platform/app/package.json: Language not supported
Comments suppressed due to low confidence (2)
extensions/default/src/ViewerLayout/index.tsx:85
- The removal of the 'content' property (previously returned as entry.component) may break downstream components that rely on it. Please verify that this change is intentional and update consumers accordingly.
return { entry };
extensions/cornerstone/src/utils/isReferenceViewable.ts:59
- Returning undefined here may lead to unintended behavior in consumers expecting an OrientationAxis; consider handling this case explicitly by returning a default value or throwing an error.
if (imageOrientationPatient?.length !== 6) { return; }
Fixes #4798
Fixes #4751
This pull request involves significant changes to the
cornerstone
extension, primarily focused on refactoring the codebase to improve the handling of measurement jumps and viewport management. The most important changes include the removal of deprecated methods, the addition of new utility functions, and updates to the viewport service.Refactoring and code cleanup:
extensions/cornerstone-dicom-sr/src/init.ts
: Commented out the subscription toMeasurementService.EVENTS.JUMP_TO_MEASUREMENT_LAYOUT
to clean up the initialization code.extensions/cornerstone/src/Viewport/OHIFCornerstoneViewport.tsx
: Removed deprecated cache-based jump to measurement logic and replaced it with a direct subscription toMeasurementService.EVENTS.JUMP_TO_MEASUREMENT_VIEWPORT
. [1] [2] [3] [4] [5]Enhancements to viewport service:
extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts
: Added a new methodgetViewportDisplaySets
to retrieve display sets for a given viewport and updated theWITH_NAVIGATION
constant to disable orientation. [1] [2] [3]Utility functions:
extensions/cornerstone/src/utils/index.ts
: Added theisReferenceViewable
utility function to determine if a reference is viewable in a given viewport. [1] [2]Viewport module updates:
extensions/cornerstone/src/index.tsx
: Updated the viewport module to include theisReferenceViewable
function for checking reference viewability. [1] [2]extensions/measurement-tracking/src/getViewportModule.tsx
: Integrated theisReferenceViewable
function into the tracked cornerstone viewport module. [1] [2]