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

OHIF with Cornerstone3D 2.0 #4347

Merged
merged 134 commits into from
Nov 6, 2024
Merged

OHIF with Cornerstone3D 2.0 #4347

merged 134 commits into from
Nov 6, 2024

Conversation

sedghi
Copy link
Member

@sedghi sedghi commented Aug 26, 2024

chore: Enable stack context prefetch on new stack events

chore: Update measurement unit properties to match new naming conventions

chore: Update TypeScript dependency to version 5.5.4

chore: Update TypeScript dependency to version 5.5.4

chore: Fix typo in SegmentationService.ts
Copy link

netlify bot commented Aug 26, 2024

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

Name Link
🔨 Latest commit def787c
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/672b06c18990070008fc9f0e

Copy link

netlify bot commented Aug 26, 2024

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit def787c
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/672b06c1d9ab93000801fdb1
😎 Deploy Preview https://deploy-preview-4347--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

cypress bot commented Aug 26, 2024

Viewers    Run #4393

Run Properties:  status check failed Failed #4393  •  git commit f8b74cd105: fix
Project Viewers
Branch Review feat/cs3d-2
Run status status check failed Failed #4393
Run duration 03m 17s
Commit git commit f8b74cd105: fix
Committer Alireza
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
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 43
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/integration/measurement-tracking/OHIFMeasurementPanel.spec.js • 1 failed test

View Output Video

Test Artifacts
OHIF Measurement Panel > checks if measurement item can be Relabeled under Measurements panel Test Replay Screenshots Video

	•	Update Segmentation Service to support labelmap and contour representations
	•	Update Hanging Protocol to support segmentation overlay
	•	Add presentation id providers for lut, position, and segmentation
	•	Update ViewportGridService to use presentation id providers
	•	Update types for DisplaySet, HangingProtocol, and ViewportGrid
	•	Update utils for toNumber and presentationUtils
	•	Update platform/ui to use new ViewportGridContext
	•	Update yarn.lock to use [email protected]
	•	Update getPanelModule to use modeCustomization for segmentation panel
	•	Remove console.debug statement in PanelSegmentation
	•	Decrease timeout in init function from 1000 to 100
	•	Update ExtensionManager to log errors instead of general messages
	•	Update CineService and ViewportGridService to use queueMicrotask for event broadcasting
…elated functionality

-  Remove VolumeRotateMouseWheelTool from initCornerstoneTools
-  Update VolumeRotateMouseWheelTool references in initToolGroups
-  Update imageLoader.createAndCacheDerivedSegmentationImages to imageLoader.createAndCacheDerivedLabelmapImages
-  Remove unused code in updateViewportsForSegmentationRendering
-  Update SegmentationService to use derivedLabelmapImages
…omponents**

This commit updates the Segmentation Service and related components to improve the functionality of segmentation representation management.

-  The `addSegmentationRepresentationToViewport` method in the Segmentation Service now accepts an object with optional parameters, allowing for more flexibility in adding segmentation representations.
-  The `createNewRepresentation` method is introduced to create a new segmentation representation when an existing one is not found.
-  The `updateSegmentProperties` method is updated to handle segment opacity and visibility changes.
-  The `getLabelmapVolume` and `getLabelmapReferencedVolume` methods are updated to retrieve the correct volume IDs.
-  The `thresholdSegmentationByRectangleROITool` command is updated to handle the creation of a new segmentation representation.
-  The `calculateSuvPeak` command is updated to use the correct volume and voxel manager.
-  The `getLesionStats` command is updated to use the correct volume and voxel manager.
-  The `handleROIThresholding` utility function is updated to use the correct segmentation and volume IDs.
-  The `calculateTMTV` utility function is updated to use the correct voxel manager.
-  The `hpViewports` utility function is updated to use the correct overlay ID.
-  The `HPMatcher` class is updated to handle custom attribute resolution.
-  The `HangingProtocolService` class is updated to provide the overlay rule for a viewport.
-  The `ViewportGridService` class is updated to publish the grid state changed event.

These changes improve the functionality and usability of the Segmentation Service and related components, making it easier to manage segmentation representations and perform tasks such as thresholding and calculating SUV peak values.
…ction and related calls

	•	Update removeSegmentationRepresentationFromViewport function to accept optional segmentationId and segmentationRepresentationUIDsIds parameters
	•	Update related function calls to pass viewportId as an object property
	•	Update logic to handle cases where segmentationId or segmentationRepresentationUIDsIds are provided
	•	Enhance debugging with added debugger statement
	•	Enhance caching by storing stack image IDs for display sets and retrieving them when needed
	•	Update segmentation service to handle missing segmentation representations and frame of reference UIDs
	•	Filter out non-image modalities when displaying thumbnails in the study browser
	•	Add checks for segmentation existence before retrieving labelmap volume data
	•	Remove unused debugger statements and redundant code
-  Update OHIFCornerstoneSEGViewport to use viewportOptions.viewportType
-  Fix areEqual function in OHIFCornerstoneViewport to handle null viewportOptions.viewportType
-  Add null check for volume in CustomizableViewportOverlay
-  Update CornerstoneCacheService to handle SEG display sets
-  Update SegmentationService to handle labelmap volumes
-  Update CornerstoneViewportService to load overlay reference volumes for SEG display sets
-  Update getImageId function in DicomWebDataSource to handle instance.imageId
-  Add support for video viewport by introducing new evaluate function 'evaluate.action.not.video'
-  Introduce overlay selectors for 'appLabelmap' in hanging protocols 'fourUp' and 'only3D'
-  Update 'getToolbarModule' to handle video viewport and overlay selectors
-  Update 'init' function to handle overlay selectors
-  Update 'SegmentationService' to handle segment info
-  Update 'calculateSUVPeakWorker' to use 'cstUtils' for bounding box calculation
-  Update 'moreTools' to handle video viewport and overlay selectors
-  Update 'HangingProtocolService' to return overlay selectors with matching rules
…roxy settings in webpack

-  Upgrade `docker-compose` to `docker compose` in package.json and dockerfile
-  Add proxy settings for path rewriting in webpack.pwa.js
-  Update `dev:orthanc` and `dev:orthanc:no:cache` scripts to include proxy path rewriting
-  Update OpenIdConnectRoutes to use `code` scope for NextClient and LegacyClient
-  Extracted and reused disabled state logic in getToolbarModule
-  Simplified and improved segmentation deletion logic in SegmentationService
-  Removed unused code and imports in various files
-  Improved handling of viewport types and segmentation representations in SegmentationService
-  Updated CornerstoneViewportDownloadForm to use withAppTypes and removed PropTypes
-  Added evaluate.not.sm to toolbar buttons in longitudinal mode
-  Updated SegmentationGroupTable to conditionally show delete segment based on disableEditing
…COM local data source

-  Update segmentation generation to handle labelmaps with multiple images
-  Change labelmap generation to iterate over segment images and referenced images
-  Add check for instance imageId in DICOM local data source
-  Enhance DICOM local data source to return instance imageId if available
…ponent

-  Refactor SegmentationService to improve performance, simplify code, and fix bugs
-  Update ViewportWindowLevel component to handle image volume loading completion and update histograms
-  Remove unused code and functions in SegmentationService and ViewportWindowLevel component
-  Improve code readability and maintainability by following best practices and coding standards
Copy link
Contributor

@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.

There are a number of comments on things, but generally the changes look pretty good.

…ions

-  Upgrade @cornerstonejs/adapters, @cornerstonejs/core, and @cornerstonejs/tools to version 2.1.5 for enhanced performance and stability.
-  Refactor dynamic volume calculations to reduce redundant data processing, improving efficiency.
-  Streamline data extraction from segmentations to minimize processing time and memory usage.
-  Introduce new utility hooks for managing segmentations across components, improving code reusability and maintainability.
-  Update related documentation to reflect changes in functionality and dependencies.
…lume controls

-  Modify slider range to start from 0 and end at framesLength - 1 for accurate indexing
-  Update frame controls to reflect the new maximum frame value
-  Ensure time points range initialization starts from 0 for consistency
-  Adjust frame number generation logic to account for zero-based indexing
-  Enhance UI by ensuring overflow handling for label display in progress item detail
…e viewport management

-  Update segmentation data retrieval to use labelmap volume IDs for dynamic volumes
-  Optimize segmentation representation addition by targeting the first viewport only
-  Enhance window level management with a new hook for active viewport display sets
-  Introduce utility functions for volume opacity checks and histogram data retrieval
-  Adjust opacity settings for the fusion viewports and improve UI components for segmentation
-  Clean up unused code and comments to streamline the codebase
-  Extract sync group definitions into constants for better maintainability
-  Replace inline sync group definitions with constants in the MPR protocol
-  Ensure consistent sync group configuration across multiple viewports in TMTV extension
-  Add new commands for managing segmentations, including creating labelmaps, setting active segmentations, and toggling visibility.
-  Refactor segmentation interactions in the PanelSegmentation component to utilize new command structure.
-  Improve documentation and comments for clarity on command usage
…wport updates

-  Simplify `loadSegmentationsForViewport` by removing the `updateViewportsForSegmentationRendering` utility function and directly handling viewport updates within the command.
-  Introduce a new structure for segmentations, replacing the previous format with `segmentationId`, `representation`, and `config`.
-  Update the
…r header

-  Add a new `HeaderPatientInfo` component to display patient details.
-  Integrate the component into the `ViewerHeader` for better patient context.
-  Create a custom hook `usePatientInfo` to manage patient data and mixed patient states.
-  Refactor the `Header` component to accept a `PatientInfo` prop instead of `showPatientInfo`.
-  Update icon components for better visual representation of patient information.
-  Install Bun in CircleCI jobs
-  Replace Yarn install commands with Bun install commands
-  Update JavaScript test commands to use Bun
-  Remove the event emitter limit increase script
-  Update dependencies for cornerstone extensions to version 2.1.8
…ort export

-  Simplify the `addOrUpdateSegmentation` method in `SegmentationService` by removing the segmentationId parameter.
-  Update all calls to `addOrUpdateSegmentation` across the codebase to reflect the new method signature.
-  Modify `exportTMTVReportCSV` to handle asynchronous operations correctly.
-  Adjust the opacity values in `hpViewports` for better visual representation.
-  Enhance UI components in `SegmentationHeader` with consistent padding for better alignment.
-  Updated "@cornerstonejs/adapters", "@cornerstonejs/core", "@cornerstonejs/tools", and "@cornerstonejs/dicom-image-loader" dependencies to version "^2.1.11" across multiple package.json files.
-  Removed unused import `csUtils` from `ViewportOrientationMarkers.tsx`.
-  Refactored `ViewportOrientationMarkers.tsx` to fix variable shadowing and improved destructuring.
-  Changed Cypress test selectors from `measurement-item` to `data-row` to align with updated component data attributes.
-  Adjusted Cypress test expectations to reflect the updated number of viewports and wait times.
-  Deleted `index.test.js` from `platform/core/src` and updated `StudyPrefetcherService.ts` to include an internal `RequestType` enum.
-  Modified UI components to ensure consistent data attributes and alignment in dropdown menus.
…ments

-  Updated "@cornerstonejs/adapters" and "@cornerstonejs/core" dependencies to version "^2.1.13" across multiple extensions including cornerstone-dicom-pmap, cornerstone-dicom-seg, cornerstone-dicom-sr, cornerstone-dynamic-volume, cornerstone, measurement-tracking, and platform/app.
-  Updated "@cornerstonejs/tools" and "@cornerstonejs/dicom-image-loader" to version "^2.1.13" in relevant extensions.
-  Improved the Thumbnail component by adding conditional styling to highlight active items with 'bg-popover' class.
-  Removed unused variable 'seriesDate' from ThumbnailList component.
-  Updated yarn.lock file to reflect the changes in package versions.
…ol group

-  Modify pixel data processing by scaling values and using a new TypedArrayConstructor in `getSopClassHandlerModule.ts`
-  Remove `initPMAPToolGroup.ts` and related PMAP tool group management from `OHIFCornerstonePMAPViewport.tsx`
-  Update colormap configuration and VOI settings in `OHIFCornerstonePMAPViewport.tsx`

Cornerstone: Add null check for viewport in ColorbarService

-  Ensure `addColorbar` method in `ColorbarService.ts` handles non-existent viewports gracefully

Cornerstone: Correct display set loading in CornerstoneCacheService

-  Change `displaySet.load` to `overlayDisplaySet.load` in `CornerstoneCacheService.ts`

TMTV: Add stage1 to protocol stages in getHangingProtocolModule

-  Include `stage1` in the `ptCT` protocol stages array in `getHangingProtocolModule.ts`

Docs: Update segmentation service migration guide

-  Clarify distinction between `VolumeId` and `SegmentationId` in the migration guide from 3p8 to 3p9
-  Provide guidance on updating code to use `getLabelmapVolume` method

UI-Next: Refactor StudyBrowser component structure

-  Replace `React.Fragment` with `div` in `StudyBrowser.tsx` to wrap component content
@sedghi sedghi merged commit 7ce7127 into master Nov 6, 2024
7 of 14 checks passed
@sedghi sedghi mentioned this pull request Nov 6, 2024
17 tasks
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