Skip to content

Conversation

@Devu-trenser
Copy link
Contributor

@Devu-trenser Devu-trenser commented Nov 5, 2025

Context

This PR addresses the issue where, after clicking on segments and adjusting the segmentation's fill, the opacity of the clicked segments doesn't update as expected. The root cause was that the fillAlpha value was being applied at the per-segment level during highlighting, but the corresponding per-segment entry in the config was not being cleared afterward. As a result, the global-level opacity (fillAlpha) setting was not taking effect correctly.

Fixes: OHIF/Viewers#4977

Dependent PR : OHIF/Viewers#4978

Changes & Results

  • Added a new style restoration mechanism for segmentation configurations.
  • Implemented createRestoreFunction to capture and restore style values for specific keys.
  • Added internal helpers:
    - _removeStyleFromHigherLevels — Removes higher-level overrides before restoration.
    - _applyStyleValueAtLevel — Reapplies captured style values at their original configuration level.
    - _getCurrentValueForRestore — Determines current style value and its hierarchy level.
    - _getViewportLevelValue, _getSegmentationLevelValue, _getGlobalLevelValue — Level-specific lookup helpers.

Before

  • Clicking on a segment applied highlight at the per-segment level, but opacity was applied at the global level.
  • This caused mismatches where opacity updates were not reflected correctly after interaction.

After

  • Highlight and opacity changes now behave consistently across interactions.
  • Temporary style overrides (e.g., during highlight) are cleaned up when restored.

Testing

  1. Locally link the OHIF abhijith-trenser:fix/segmentation-fill-not-working-after-loading-seg-and-click-segments branch with the cornerstone3D branch Devu-trenser:fix/seg-fill-not-working-after-segment-click.
  2. Launch the study that contains segmentation and load it or draw new segmentation.
  3. Click on some segments.
  4. Adjust the Fill in the segmentation settings.
  5. Verify that the opacity of the clicked segment is correctly changing.

Checklist

PR

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

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

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

Tested Environment

  • "OS: Linux 6.11 Ubuntu 24.10 24.10 (Oracular Oriole)
  • "Node version: 22.16.0
  • "Browser: Chrome: 139.0.7258.154

@Devu-trenser Devu-trenser marked this pull request as draft November 5, 2025 13:23
@Devu-trenser Devu-trenser marked this pull request as ready for review November 6, 2025 08:36
@sedghi sedghi requested a review from jbocce November 6, 2025 13:05
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.

[Bug] Segmentation Fill is not working after loading seg file and clicking on the segments - OSS 3.10

1 participant