Skip to content

fix: expand adapters patch to fix more PerFrameFunctionalGroupsSequen… - #146

Merged
igoroctaviano merged 1 commit into
masterfrom
fix/seg-orientation-crash
Oct 6, 2026
Merged

igoroctaviano merged 1 commit into
masterfrom
fix/seg-orientation-crash

Conversation

@igoroctaviano

@igoroctaviano igoroctaviano commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Adds null checks and optional chaining for DICOM SEG loading to handle missing/undefined PerFrameFunctionalGroupsSequence gracefully.

Changes in labelmapImagesFromBuffer.js:

Null checks for PerFrameFunctionalGroupsSequence

  • insertPixelDataPlanar (lines 555, 557, 558, 568)
  • insertOverlappingPixelDataPlanar (line 821)
  • getSegmentData (lines 914, 926, 929)

Graceful error handling for missing segment index

  • Convert throw new Error to console.warn with continue (line 580)
  • Follows the same pattern used for missing imageIds

Changes in checkOrientation.js:

  • Check both SharedFunctionalGroupsSequence and PerFrameFunctionalGroupsSequence for ImageOrientationPatient
  • Default to 'Planar' when no orientation found

Errors fixed:

  • "Cannot read properties of undefined (reading 'length')"
  • "Cannot read properties of undefined (reading '0')"
  • "Could not retrieve the segment index. Aborting segmentation loading."

DICOM Compliance:

Per DICOM PS3.3 C.7.6.16 and C.8.20.3.1, these functional groups are required but graceful degradation is preferred over hard failure when encountering non-compliant files.

Related Upstream PR:

cornerstonejs/cornerstone3D#2963


…ce crashes

Adds null checks and optional chaining for PerFrameFunctionalGroupsSequence in:
- insertPixelDataPlanar (lines 555, 557, 558, 568)
- insertOverlappingPixelDataPlanar (line 821)
- getSegmentData (lines 914, 926, 929)

Fixes "Cannot read properties of undefined (reading 'length')" errors
when loading SEG files without PerFrameFunctionalGroupsSequence.
@igoroctaviano
igoroctaviano merged commit c7fcd2e into master Oct 6, 2026
0 of 2 checks passed

This branch is being deployed

1 queued deployment
fork-pr-approval — 8f39e126 Deployed Oct 5, 2026 by igoroctaviano via playwright-tests (24.15.0) #124
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.

1 participant