Skip to content

fix(RTStruct): RTSTRUCT contours rendered on first slice for multi-frame images without IPP - #5811

Merged
wayfarer3130 merged 4 commits into
OHIF:masterfrom
arul-trenser:fix-rtstruct-multi-frame
Feb 23, 2026
Merged

fix(RTStruct): RTSTRUCT contours rendered on first slice for multi-frame images without IPP#5811
wayfarer3130 merged 4 commits into
OHIF:masterfrom
arul-trenser:fix-rtstruct-multi-frame

Conversation

@arul-trenser

@arul-trenser arul-trenser commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Context

Changes & Results

When a multi-frame DICOM dataset does not contain ImagePositionPatient (IPP) in any of the expected locations (PerFrameFunctionalGroupsSequence, SharedFunctionalGroupsSequence, or DetectorInformationSequence), the RTSTRUCT contour mapping logic is unable to resolve the correct referenced image per contour. As a result, all contours are rendered on the first slice.

This PR reintroduces and applies a fallback mechanism that assigns a synthetic IPP based on frame index ([0, 0, frameNumber]) when no valid IPP is available anywhere in the dataset. This allows contour-to-frame resolution to behave deterministically and prevents all contours from collapsing onto the first slice.

Before:
https://github.com/user-attachments/assets/c9a26b76-d9bf-46cd-8afd-9a50b7fd23ea

After:
https://github.com/user-attachments/assets/266ccc80-628f-4298-be90-10fa9425995e

Testing

Load a multi-frame
Drag and drop RTSTRUCT.
Scroll through slices.

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: Windows 11
  • Node version: v22.19.0
  • Browser: Version 144.0.7559.133

Greptile Overview

Greptile Summary

This PR fixes RTSTRUCT contour rendering for multi-frame DICOM images that lack ImagePositionPatient (IPP) metadata. Previously, when IPP was absent from PerFrameFunctionalGroupsSequence, SharedFunctionalGroupsSequence, and DetectorInformationSequence, contours would collapse onto the first slice.

The fix adds || NumberOfFrames > 1 to the condition at combineFrameInstance.ts:35, ensuring all multi-frame datasets enter the code block that provides the synthetic IPP fallback [0, 0, frameNumber] at line 100. This guarantees deterministic contour-to-frame mapping based on frame index when no real IPP is available.

The change is minimal, well-targeted, and directly addresses the reported issue without affecting single-frame images or multi-frame images with proper IPP metadata.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a one-line addition that extends an existing conditional to ensure multi-frame images without IPP metadata receive synthetic position values. The logic is sound, well-documented, and addresses a specific rendering bug. The fallback mechanism already exists (line 100); this PR just ensures it's reached for all multi-frame cases. No breaking changes or new dependencies introduced.
  • No files require special attention

Important Files Changed

Filename Overview
platform/core/src/utils/combineFrameInstance.ts Added condition to ensure all multi-frame images enter the IPP fallback logic, fixing RTSTRUCT contour mapping for images without IPP metadata

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@netlify

netlify Bot commented Feb 11, 2026

Copy link
Copy Markdown

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit c9ccd03
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/699298d03f7685000828c114
😎 Deploy Preview https://deploy-preview-5811--ohif-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@arul-trenser

Copy link
Copy Markdown
Contributor Author

Sample data: US multi-frame data download from https://nbia.cancerimagingarchive.net/ and removed the PerFrameFunctionalGroupsSequence and SharedFunctionalGroupsSequence

https://drive.google.com/file/d/1yBfsNprgm50lKony_Ytcbf_haruTUdEP/view?usp=sharing

@arul-trenser

Copy link
Copy Markdown
Contributor Author

@sedghi Could you please review and share your feedback for this PR?

@wayfarer3130
wayfarer3130 merged commit b5573ca into OHIF:master Feb 23, 2026
7 checks passed
wayfarer3130 pushed a commit that referenced this pull request Apr 10, 2026
…ame images without IPP (#5811)

Fix RTSTRUCT contours rendered on first slice for multi-frame images without IPP
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] RTSTRUCT contours rendered on first slice for multi-frame images without IPP

2 participants