Skip to content

fix(cornerstone-dicom-sr): handle content-less imaging measurement reports#6139

Open
TFRadicalImaging wants to merge 1 commit into
OHIF:masterfrom
TFRadicalImaging:fix/contentless-imaging-measurement-report
Open

fix(cornerstone-dicom-sr): handle content-less imaging measurement reports#6139
TFRadicalImaging wants to merge 1 commit into
OHIF:masterfrom
TFRadicalImaging:fix/contentless-imaging-measurement-report

Conversation

@TFRadicalImaging

@TFRadicalImaging TFRadicalImaging commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Context

An Imaging Measurement Report can be stored without its report body — the ConceptNameCodeSequence identifies it as an Imaging Measurement Report, but ContentSequence (0040,A730) is absent. We hit this with real reports produced by a third-party system.

OHIF classifies such a report as an Imaging Measurement Report on the concept name alone, then takes the measurement path on content that isn't there:

  • _load_getReferencedImagesList(ContentSequence) and _getMeasurements(ContentSequence) with ContentSequence === undefined.
  • _getMeasurements immediately calls .find on it, which throws.

The exception escapes and takes down the viewer with the generic "Something went wrong" screen — the user can't open the study at all, not just that one report.

Changes & Results

extensions/cornerstone-dicom-sr/src/getSopClassHandlerModule.ts:

  • Split the concept-name test (conceptIsImagingMeasurementReport) from the resulting classification. A report whose concept says Imaging Measurement Report but which carries no ContentSequence is now flagged isContentlessImagingMeasurementReport and classified as a plain SR (isImagingMeasurementReport: false).
  • Because both the loader (_load, which gates the measurement parsing on isImagingMeasurementReport) and the viewport (OHIFCornerstoneSRViewport, which routes on the same flag) already branch on that flag, downgrading it is enough to keep both off the measurement path that assumes content exists. No changes to the parsing code itself.

extensions/cornerstone-dicom-sr/src/components/OHIFCornerstoneSRTextViewport.tsx:

  • The downgraded report now renders in the plain-SR text viewport, which would otherwise show an empty panel with no explanation. Show a warning notification when such a report is opened.
  • The notification fires from the viewport (i.e. when the user actually opens the report) rather than at display-set creation, so a study containing one of these reports doesn't throw a notification at load time for a report the user may never open.

Before: opening a study containing a content-less Imaging Measurement Report crashes the viewer with "Something went wrong".
After: the report opens as an empty plain SR with a "This report has no readable content and cannot be displayed." warning; the rest of the study is unaffected. Healthy SRs — any report that has a ContentSequence — are untouched and still take the full measurement path.

Testing

To reproduce, you need an SR whose ConceptNameCodeSequence.CodeValue is 126000 (Imaging Measurement Report) and which has no ContentSequence (0040,A730).

  1. Load a study containing such a report.
  2. Open the SR from the study panel.
  3. Before this change: the viewer crashes to the "Something went wrong" screen.
  4. After this change: the report opens as an empty SR with a warning notification, and the rest of the study remains usable.

Regression check — a healthy Imaging Measurement Report (one with a ContentSequence) still loads its measurements and renders in the measurement viewport, unchanged.

This fix has been running in a downstream production deployment against the real reports that triggered the crash.

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 15 (Darwin 25.5.0)
  • Node version: 22.17.1
  • Browser: Chrome 138

This fix is contributed by the University of Calgary, who are donating it back to OHIF. It was co-authored with Ron Leisti.

Summary by CodeRabbit

  • Bug Fixes
    • Added a warning when an imaging measurement report contains no readable content.
    • Improved handling of contentless structured reports to prevent incorrect parsing and display behavior.
    • Preserved existing rendering for structured reports that contain valid content.

…ports

An Imaging Measurement Report can be stored without its report body: the
ConceptNameCodeSequence identifies it as one, but ContentSequence
(0040,A730) is absent. Such a report was classified on the concept name
alone, so the loader called _getReferencedImagesList and _getMeasurements
on the missing content. _getMeasurements calls .find on it and throws,
taking the whole viewer down with "Something went wrong" — the study
could not be opened at all.

Classify a report that has no ContentSequence as a plain SR. Both the
loader and the SR viewport already branch on isImagingMeasurementReport,
so this keeps them off the measurement path that assumes content exists.
The report opens empty in the SR text viewport, which now warns that it
has no readable content. Reports that do have a ContentSequence are
unaffected.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit 0826001
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/6a5505c03064a70008603d4c
😎 Deploy Preview https://deploy-preview-6139--ohif-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@TFRadicalImaging

Copy link
Copy Markdown
Contributor Author

@wayfarer3130 @jbocce could one of you take a look? This is a small classification fix in the SR SOP class handler: an Imaging Measurement Report stored without its ContentSequence currently crashes the viewer outright ("Something went wrong"), because the measurement path calls .find on the missing content. Downgrading it to a plain SR keeps both the loader and the viewport off that path.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b50995d2-fbb2-4f52-9ce0-59558800b7df

📥 Commits

Reviewing files that changed from the base of the PR and between 110b293 and 0826001.

📒 Files selected for processing (2)
  • extensions/cornerstone-dicom-sr/src/components/OHIFCornerstoneSRTextViewport.tsx
  • extensions/cornerstone-dicom-sr/src/getSopClassHandlerModule.ts

📝 Walkthrough

Walkthrough

The SR handler now identifies Imaging Measurement Reports without ContentSequence and records that state on the display set. The text viewport detects the state and shows a warning notification while preserving existing rendering logic.

Changes

Contentless SR handling

Layer / File(s) Summary
Classify contentless Imaging Measurement Reports
extensions/cornerstone-dicom-sr/src/getSopClassHandlerModule.ts
The handler distinguishes contentless Imaging Measurement Reports, updates isImagingMeasurementReport, and stores the contentless state on the display set.
Notify from the SR text viewport
extensions/cornerstone-dicom-sr/src/components/OHIFCornerstoneSRTextViewport.tsx
A React effect displays a warning through uiNotificationService when the display set has no readable report content.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: wayfarer3130

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, accurate, and matches the main change in the PR.
Description check ✅ Passed The description includes Context, Changes & Results, Testing, and a completed Checklist per the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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