Skip to content

Conversation

@arul-trenser
Copy link
Contributor

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

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
Copy link

netlify bot commented Feb 11, 2026

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit 90bd043
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/698d52db9cbb4e0008d337a7
😎 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.

Copy link

@greptile-apps greptile-apps bot left a comment

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
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

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

1 participant