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(segmentation): Refactor segmentation and style handling #1449

Merged
merged 38 commits into from
Sep 12, 2024

Commits on Aug 26, 2024

  1. try to not publish source maps

    sedghi committed Aug 26, 2024
    Configuration menu
    Copy the full SHA
    f2bd87c View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2024

  1. wip for ohif changes

    sedghi committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    1981388 View commit details
    Browse the repository at this point in the history
  2. annotation fix

    sedghi committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    c439fbf View commit details
    Browse the repository at this point in the history
  3. fix camera sync

    sedghi committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    269f210 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Configuration menu
    Copy the full SHA
    23cc6d0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9c39713 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2024

  1. fix stuff

    sedghi committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    2b567db View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2024

  1. wip

    sedghi committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    b55e060 View commit details
    Browse the repository at this point in the history
  2. • Update StackViewport to use targetOverlayImageId instead of referen…

    …cedImageId for better overlay matching
    
    	•	Improve VideoViewport rendering by applying device pixel ratio scaling and clearing the canvas before drawing
    	•	Update WSIViewport to use getViewReferenceId instead of getReferenceId for consistency
    	•	Update MetadataModuleTypes to use numbers for rows, columns, sliceThickness, and sliceLocation
    	•	Add preset property to ViewportProperties for future use
    	•	Introduce deepClone utility function for deep cloning objects
    	•	Update SegmentationStateManager to handle labelmap image references and remove color LUTs when representations are removed
    sedghi committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    f8d5fe8 View commit details
    Browse the repository at this point in the history
  3. CornerstoneJS: Refactor and improve code quality in various modules

    	•	Add null check for image in Cache class to prevent undefined errors
    	•	Update imagePlaneModule to use numeric values for rows and columns
    	•	Import and use utilities from @cornerstonejs/core in addColorLUT and ToolGroup
    	•	Replace deepClone with utilities.deepClone in ToolGroup
    	•	Update BrushTool to dispatch a custom error event instead of throwing an error when no active segmentation is detected
    sedghi committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    c46496e View commit details
    Browse the repository at this point in the history
  4. **Rendering Engine: Refactor Camera Clipping Range**

    -  Introduce `setCameraClippingRange` method in `BaseVolumeViewport` and implement it in `VolumeViewport`, `VolumeViewport3D`, and `Viewport` classes
    -  Move camera clipping range logic from `setCamera` method to `setCameraClippingRange` method to improve code organization and reusability
    -  Update `setCamera` method to call `setCameraClippingRange` method for consistency across classes
    sedghi committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    7876635 View commit details
    Browse the repository at this point in the history
  5. **Feature: Remove VolumeRotateMouseWheelTool and Replace with StackSc…

    …rollTool**
    
    -  Remove VolumeRotateMouseWheelTool from cornerstoneTools
    -  Update various examples to use StackScrollTool instead of VolumeRotateMouseWheelTool
    -  StackScrollTool now has an additional configuration option to enable rotation
    -  The rotation functionality is implemented in the mouseWheelCallback function of StackScrollTool
    -  The rotation functionality uses the gl-matrix library for 3D transformations
    sedghi committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    c886c5c View commit details
    Browse the repository at this point in the history
  6. Labelmap: Replace Segmentation with Labelmap in Core and Tools

    This commit replaces segmentation with labelmap in various parts of the codebase, including core and tools. It updates function names, types, and logic to reflect the change from segmentation to labelmap.
    
    Changes include:
    -  Renaming functions from segmentation to labelmap (e.g., `createAndCacheDerivedSegmentationImage` to `createAndCacheDerivedLabelmapImage`)
    -  Updating types and interfaces to reflect the change from segmentation to labelmap
    -  Changing logic and implementation to work with labelmaps instead of segmentations
    -  Updating tests and examples to reflect the change from segmentation to labelmap
    sedghi committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    83f5a20 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2024

  1. Segmentation Tools: Refactor Volume Segmentations for BaseVolumeViewport

    	•	Update Viewport.ts to use BaseVolumeViewport instead of VolumeViewport
    	•	Update loaders/index.ts to register cornerstoneStreamingImageVolumeLoader as unknown as VolumeLoaderFn
    	•	Update convertLabelmapToSurface.ts to remove isVolume check and handle volumeId directly
    	•	Update surfaceComputationStrategies.ts to remove isVolumeSegmentation check
    	•	Update addLabelmapToElement.ts to handle missing volume and create a new volume if necessary
    	•	Update labelmapDisplay.ts to use BaseVolumeViewport instead of VolumeViewport
    	•	Update BrushTool.ts, CircleScissorsTool.ts, PaintFillTool.ts, RectangleScissorsTool.ts, SphereScissorsTool.ts, getStrategyData.ts, and utilities/segmentation/*.ts to use BaseVolumeViewport instead of VolumeViewport
    	•	Remove stackVolumeCheck.ts file as it is no longer needed
    sedghi committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    92608a7 View commit details
    Browse the repository at this point in the history
  2. Feature: Update Labelmap Tool for Volume ID Handling

    Update Labelmap tool to handle volume ID correctly and prevent errors when volume ID is missing
    
    -  Update addLabelmapToElement function to set volumeId property on LabelmapSegmentationDataVolume object
    -  Update getStrategyData function to check for missing volumeId and dispatch an error event if found
    -  Improve error handling and logging for segmentation-related issues
    sedghi committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    5b7038a View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. Segmentation: Refactor Segmentation Rendering Engine and State Manager

    	•	Refactored SegmentationRenderingEngine to handle viewport cases where the enabled element is not found
    	•	Simplified SegmentationStateManager to remove redundant imageIdReferenceMap lookups
    	•	Added addSegmentationRepresentationUIDToViewport function to associate a segmentation representation with a given viewport
    	•	Updated utilities/index.ts to include pointInSurroundingSphereCallback function
    	•	Implemented pointInSurroundingSphereCallback function to run a callback for each point of imageData within a sphere defined by great circle points
    	•	Updated labelmapDisplay.ts to include removeRepresentation function and _needsTransferFunctionUpdate function
    	•	Updated addLabelmapToElement.ts to trigger segmentation modified event when adding a labelmap to an element
    sedghi committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    3f26147 View commit details
    Browse the repository at this point in the history
  2. Segmentation: Remove segmentation representations from state and view…

    …ports
    
    -  Remove segmentation representation from state and all viewports
    -  Update segmentation representation removal functions
    -  Remove obsolete functions and imports
    -  Update segmentation state management and display tools
    -  Fix issues with contour, labelmap, and surface display tools
    sedghi committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    c8f9d3b View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2024

  1. Core: Refactor VideoViewport and VolumeViewport3D for improved functi…

    …onality and performance
    
    -  Extracted and refactored common logic in VideoViewport and VolumeViewport3D
    -  Improved voxelManager.forEach method for efficient point iteration
    -  Added resetCameraForResize method to VolumeViewport3D
    -  Enhanced generateVolumePropsFromImageIds utility function
    -  Introduced pointInShapeCallback for efficient shape-based point iteration
    -  Removed deprecated methods and improved code organization
    sedghi committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    3f8b8b5 View commit details
    Browse the repository at this point in the history
  2. SegmentationStateManager: Refactor SegmentationStateManager to improv…

    …e code organization and modularity
    
    -  Extracted internal functions internalComputeVolumeSegmentationFromStack and internalConvertStackToVolumeSegmentation from SegmentationStateManager
    -  Moved external functions computeVolumeSegmentationFromStack and convertStackToVolumeSegmentation to separate files
    -  Updated imports and exports to reflect new file structure
    -  Removed unused function updateSegmentationState and modified internalConvertStackToVolumeSegmentation to directly update segmentation state
    sedghi committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    c010437 View commit details
    Browse the repository at this point in the history
  3. Core: Migrate voxelManager to new system and refactor pointInShapeCal…

    …lback
    
    -  Migrate voxelManager to new system in WSIViewport
    -  Refactor pointInShapeCallback to support new system
    -  Update type imports and usage in pointInShapeCallback
    -  Update type imports in labelmapComputationStrategies and convertLabelmapToSurface
    sedghi committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    4c37a4f View commit details
    Browse the repository at this point in the history
  4. StackViewport: Refactor camera and viewport properties handling

    -  Initialize globalDefaultProperties with an empty object
    -  Update globalDefaultProperties with new values instead of overwriting them
    -  Remove unused cameraFocalPointOnRender property
    -  Simplify _setPropertiesFromCache method by removing unused variables
    -  Update camera event triggering to use the current camera state
    -  Remove _restoreCameraProps method as it is no longer needed
    -  Refactor _getVOIFromCache method to return the voiRange
    -  Update setVOI method to use the returned voiRange
    -  Remove console.log statements and unused code
    -  Improve code readability and consistency
    sedghi committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    12e8372 View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2024

  1. Cornerstone Tools: Refactor VoxelManager and Segmentation Tools

    -  Change boundsIJK to private and add getDefaultBounds method in VoxelManager
    -  Add clearSegmentValue function to clear specified segment value from a segmentation
    -  Update segmentation helpers and index
    -  Update Labelmap display to use perSegment labelmap config
    -  Update BrushStrategy to include isInObject and isInObjectBoundsIJK in InitializedOperationData
    -  Update various segmentation strategies to use operationData.isInObject and operationData.isInObjectBoundsIJK
    sedghi committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    7aa7301 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2024

  1. Core: Refactor image ID handling and segmentation rendering

    -  Extract imageIdToURI function to handle image ID to URI conversion
    -  Update imageLoader to store referencedImageId in localImage
    -  Simplify imageChangeEventListener and remove unnecessary logic for segmentation actor updates
    sedghi committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    56ce4df View commit details
    Browse the repository at this point in the history
  2. fix overlay

    sedghi committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    2ee988b View commit details
    Browse the repository at this point in the history
  3. fix remove render

    sedghi committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    111de8c View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2024

  1. fix

    sedghi committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    ae98c4f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3031f25 View commit details
    Browse the repository at this point in the history
  3. fix more build issues

    sedghi committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    6bd9085 View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2024

  1. fix various build issues

    fix all examples based on new segmentation
    sedghi committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    5968bf8 View commit details
    Browse the repository at this point in the history
  2. fix polyseg stuff

    sedghi committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    986f8bc View commit details
    Browse the repository at this point in the history
  3. finalized

    sedghi committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    3ea66df View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2024

  1. apply review comments

    sedghi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    e25bcba View commit details
    Browse the repository at this point in the history
  2. api

    sedghi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    c187f0c View commit details
    Browse the repository at this point in the history
  3. Volume Viewport: Enhance volume handling and utilities

    -  Introduce `hasVolumeURI` method to `BaseVolumeViewport` to check if a volume with a given URI exists
    -  Update `getViewportsWithImageURI` and `getViewportsWithVolumeId` to use `getRenderingEngines` instead of `getRenderingEngine`
    -  Introduce `getViewportsWithVolumeURI` utility
    -  Update various tools to use `getTargetImageData` instead of `getTargetIdImage` and remove `renderingEngine` dependency
    -  Remove `getTargetVolumeId` method from `BaseTool` and update tools to use `getVolumeId` directly from `viewport` instance
    -  Update segmentation tools to use `getTargetImageData` instead of `getTargetIdImage` and remove `renderingEngine` dependency
    sedghi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    ebd40c1 View commit details
    Browse the repository at this point in the history
  4. Tools: Remove renderingEngineId from getViewportsWithVolumeId and get…

    …ViewportsWithImageURI
    
    -  Remove renderingEngineId from getViewportsWithVolumeId in WindowLevelTool
    -  Remove renderingEngineId from getViewportsWithImageURI in ProbeTool
    -  Remove renderingEngineId from getViewportsWithVolumeId in ViewportColorbar
    sedghi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    57410be View commit details
    Browse the repository at this point in the history
  5. fix tests

    sedghi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    fd54eb1 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    125a7a0 View commit details
    Browse the repository at this point in the history
  7. fix deploy

    sedghi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    193bfac View commit details
    Browse the repository at this point in the history