Skip to content

Conversation

@GhadeerAlbattarni
Copy link
Contributor

Context

Fixes #5634

When an SR series is viewed/opened for the second time (via double-click or drag-and-drop), it causes a crash with TypeError: getAllVolumeIds is not a function because the cine service assumes all viewports are volume viewports.

Changes

  • Added a guard in initCineService.ts to return early when getAllVolumeIds is not available.

Results

The viewer no longer crashes when you reopen the SR series

Before:
Reopening an SR series causes OHIF to crash with getAllVolumeIds is not a function.

Screenshot 2026-01-17 at 9 54 05 AM

After:
SR series can be reopened without causing any crash or errors.

Testing

  1. Open the study with StudyInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.7310.5101.860473186348887719777907797922
  2. Hydrate the SR series.
  3. Use the measurements panel to navigate between measurements.
  4. Attempt to view the SR series again
  5. Verify no crash happens

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: macOS 10.15.4
  • Node version: v22.12.0
  • Browser: Chrome 83.0.4103.116

@netlify
Copy link

netlify bot commented Jan 17, 2026

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 51de68b
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/697a504b5255bc00088d0533

@GhadeerAlbattarni GhadeerAlbattarni changed the title fix(cine): prevent crash on second view/hydration of SR series #5634 fix(cine): prevent crash on second view/hydration of SR series Jan 17, 2026
@jbocce jbocce self-requested a review January 23, 2026 21:20

function _getVolumeFromViewport(viewport: Types.IBaseVolumeViewport) {
// Handle non-volume viewports that don't have getAllVolumeIds
if (!viewport || !viewport.getAllVolumeIds) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider changing this to if(!viewport?.getAllVolumeIds) {

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much. The change looks great - one small comment to address. Also let's add a playwright test to make sure this does not happen again. See https://docs.ohif.org/development/playwright-testing/ for more information.

@jbocce
Copy link
Collaborator

jbocce commented Jan 26, 2026

Please update your branch with master. Thanks.

@GhadeerAlbattarni
Copy link
Contributor Author

Sure, thanks for your comments!

@GhadeerAlbattarni GhadeerAlbattarni force-pushed the fix/5634-sr-viewport-crash branch from 9c14c59 to 9936d9a Compare January 26, 2026 17:45
Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this! I am approving the PR but will not merge until we release 3.12. It will be in for 3.13.

@jbocce
Copy link
Collaborator

jbocce commented Jan 28, 2026

The changes to the OHIF docs look good.

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] OHIF crashes on second view/hydration of SR series

2 participants