Skip to content

fix: patch checkOrientation to handle missing PerFrameFunctionalGroupsSequence - #144

Merged
igoroctaviano merged 1 commit into
masterfrom
fix/seg-orientation-crash
Oct 5, 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

Summary

  • Adds a patch for @cornerstonejs/adapters to fix SEG loading crash
  • Fixes "Cannot read properties of undefined (reading '0')" error in checkOrientation

Problem

The checkOrientation function crashes when loading SEG files where PerFrameFunctionalGroupsSequence is undefined or empty. The function was accessing PerFrameFunctionalGroupsSequence[0] without checking if the array exists.

Solution

The patch:

  • Adds optional chaining for SharedFunctionalGroupsSequence
  • Only accesses PerFrameFunctionalGroupsSequence if it exists and has items
  • Falls back to 'Planar' if no orientation data is found

Upstream Issue

cornerstonejs/cornerstone3D#2962

Test plan

  • Load a SEG study that was previously failing with the orientation error
  • Verify the segmentation loads without crashing

…sSequence

The checkOrientation function in @cornerstonejs/adapters would crash with
"Cannot read properties of undefined (reading '0')" when loading SEG files
where PerFrameFunctionalGroupsSequence is undefined or empty.

The fix:
- Adds optional chaining for SharedFunctionalGroupsSequence
- Only accesses PerFrameFunctionalGroupsSequence if it exists and has items
- Falls back to 'Planar' if no orientation data is found
@igoroctaviano
igoroctaviano merged commit c7a4343 into master Oct 5, 2026
2 of 3 checks passed

This branch was successfully deployed

No deployments
fork-pr-approval — 352eacf8 Deployed Oct 5, 2026 by igoroctaviano via playwright-tests (24.15.0) #122
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