fix(examples): fix the stack and volume segmentation adapters example #1680
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #1679
fixes #1661
fixes #664
fixes #1188
This pull request introduces several new functions and refactors existing ones to improve the handling of DICOM files and segmentation in the Cornerstone library. The changes include adding new utility functions for reading, loading, and exporting DICOM and segmentation files, as well as refactoring the
generateToolState
function to use more descriptive parameter names.New Utility Functions:
packages/adapters/examples/segmentationVolume/utils.ts
: Added functionsreadDicom
,readSegmentation
,loadSegmentation
,exportSegmentation
,restart
,getSegmentationIds
,handleFileSelect
, andhandleDragOver
to handle DICOM file operations and segmentation processes.Refactoring:
packages/adapters/src/adapters/Cornerstone/Segmentation_4X.js
: Refactored thegenerateToolState
function to replaceimageIds
withreferencedImageIds
for better clarity and consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9]Event Handling Improvements:
packages/tools/src/eventListeners/mouse/mouseMoveListener.ts
: Added a check to ensureenabledElement
is not null before proceeding with the mouse move event handling.packages/tools/src/eventListeners/segmentation/imageChangeEventListener.ts
: Added checks to ensureelement
andenabledElement
are not null before enabling segmentation.Utility Enhancements:
packages/tools/src/utilities/planar/filterAnnotationsForDisplay.ts
: Added a check to ensureimageId
is not null before proceeding with filtering annotations for display.