fix(seg): use buffer-based loader when PerFrameFunctionalGroupsSequence missing - #148
Merged
Merged
Conversation
When a SEG frame is missing SegmentIdentificationSequence in both per-frame and shared functional groups, the code now logs a warning and skips that frame instead of throwing an error that aborts the entire segmentation loading. This follows the same pattern already used for missing imageIds (lines 587-589) and makes SEG loading more resilient to non-standard or incomplete DICOM SEG files. Per DICOM PS3.3 C.8.20.3.1, SegmentIdentificationSequence is required for LABELMAP segmentations, but graceful degradation is preferred over hard failure when encountering non-compliant files.
…ce missing OHIF 3.13 changed SEG loading from createFromDICOMSegBuffer (fetches full DICOM file) to createFromDicomSegImageId (relies on metadata provider). This broke SEG loading for DICOMweb servers like IDC's static WADO that omit PerFrameFunctionalGroupsSequence from JSON metadata to save space (this sequence can be huge for SEGs with thousands of frames). The fix detects when PerFrameFunctionalGroupsSequence is missing and falls back to the buffer-based loader which parses complete metadata directly from the DICOM binary - restoring the behavior from OHIF 3.12. Also includes two backported patches from cornerstone3D: - VOI LUT function validation (PR OHIF#2856) - Segment index by SegmentNumber for LABELMAP support (PR OHIF#2882)
igoroctaviano
requested a deployment
to
fork-pr-approval
October 6, 2026 10:53 — with
GitHub Actions
Queued
This branch is being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes SEG loading failures for DICOMweb servers that omit
PerFrameFunctionalGroupsSequencefrom JSON metadata (like IDC's static WADO).Root Cause Analysis
OHIF 3.13 changed SEG loading from:
createFromDICOMSegBuffer- fetches full DICOM file, parses complete metadatacreateFromDicomSegImageId- relies on metadata provider (DICOMweb JSON)IDC's static WADO omits
PerFrameFunctionalGroupsSequencefrom JSON metadata to save bandwidth (this sequence can be huge for SEGs with thousands of frames). The new loader fails because it expects this sequence.Solution
Detect when
PerFrameFunctionalGroupsSequenceis missing and fall back to the buffer-based loader:This restores the behavior from OHIF 3.12 while keeping the optimized path for servers with complete metadata.
Upstream PRs
The fix and related improvements have been submitted upstream:
Patches Included
Also includes two backported patches from cornerstone3D that are still needed:
VOI LUT function validation (PR #2856)
Segment index by SegmentNumber for LABELMAP (PR #2882)
Closed Upstream PRs/Issues
The following were opened during investigation but are no longer needed since the fix is in OHIF:
Issue OHIF V3 MPR OHIF/Viewers#2962- Closed: checkOrientation null check (not needed)PR support for CSRF OHIF/Viewers#2963- Closed: PerFrameFunctionalGroupsSequence null checks (not needed)Testing