Skip to content

fix(wsi): render WSIViewport via setDisplaySets by resolving the registered generic dataset#2774

Closed
jbocce wants to merge 2 commits into
cornerstonejs:mainfrom
jbocce:fix/OHIF-2647-wsi
Closed

fix(wsi): render WSIViewport via setDisplaySets by resolving the registered generic dataset#2774
jbocce wants to merge 2 commits into
cornerstonejs:mainfrom
jbocce:fix/OHIF-2647-wsi

Conversation

@jbocce

@jbocce jbocce commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Context

See OHIF/Viewers#6107

Changes & Results

Summary

Adds a setDisplaySets method to the legacy WSIViewport so whole-slide imaging can be mounted through the display-set API (the direction CS3D is moving
with #2738), instead of requiring callers to use the legacy setDataIds.

What it does

setDisplaySets({ displaySetId }) resolves the WSI dataset (imageIds + webClient) via getGenericViewportWSIDataSet(displaySetId) and renders it through
setWSI. The dataset must first be registered with utilities.genericViewportDataSetMetadataProvider, keyed by displaySetId.

Why

This reads from the same registry the GenericViewport WSI data provider uses, so one caller code path drives both the legacy and generic
(useGenericViewport) render paths. It throws clear errors when called without a displaySetId or with an unregistered dataset.

Scope

  • One file: packages/core/src/RenderingEngine/WSIViewport.ts (+28 lines).
  • Adds a method; no behavior change to existing setDataIds/setWSI.

Testing

Load and display a WSI study in OHIF

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

System:
OS: Windows 11 10.0.26200
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
Memory: 8.83 GB / 31.68 GB
Binaries:
Node: 24.15.0 - C:\Users\joebo\AppData\Local\fnm_multishells\50148_1782198425052\node.EXE
Yarn: 1.22.22 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 11.12.1 - C:\Users\joebo\AppData\Local\fnm_multishells\50148_1782198425052\npm.CMD
pnpm: 11.5.2 - C:\Users\joebo\AppData\Local\pnpm\bin\pnpm.CMD
bun: 1.2.23 - C:\Users\joebo.bun\bin\bun.EXE
Browsers:
Chrome: 149.0.7827.115
Edge: Chromium (149.0.4022.80)
Internet Explorer: 11.0.26100.8115

Summary by CodeRabbit

  • New Features

    • Added support for loading WSI views by providing display set IDs to the viewport via a new public method.
    • When a display set is selected, the viewport automatically loads the associated WSI content.
  • Bug Fixes

    • Improved validation and error handling for missing display set IDs and incomplete or unavailable WSI data referenced by a display set.

@coderabbitai

coderabbitai Bot commented Jun 27, 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: 8f9ce7f7-921c-4706-92c8-df00e137246d

📥 Commits

Reviewing files that changed from the base of the PR and between 10b6e76 and e0e67d9.

📒 Files selected for processing (1)
  • packages/core/src/RenderingEngine/WSIViewport.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/RenderingEngine/WSIViewport.ts

📝 Walkthrough

Walkthrough

WSIViewport gains a new public setDisplaySets method. It imports getGenericViewportWSIDataSet, validates the displaySetId, retrieves the registered WSI dataset, checks for required imageIds and webClient, and calls this.setDataIds(imageIds, options).

Changes

WSIViewport.setDisplaySets implementation

Layer / File(s) Summary
setDisplaySets method and import
packages/core/src/RenderingEngine/WSIViewport.ts
Adds getGenericViewportWSIDataSet and a new public setDisplaySets method that validates displaySetId, looks up the dataset, checks required fields, and delegates loading to setDataIds.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 A displaySetId hops in bright,
The viewport checks the dataset is right,
imageIds lined up, options in tow,
Then setDataIds helps the slide show glow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific, concise, and accurately describes the new WSIViewport setDisplaySets behavior.
Description check ✅ Passed The description matches the template with Context, Changes & Results, Testing, and checklist sections filled in.
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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/RenderingEngine/WSIViewport.ts`:
- Around line 647-654: The WSIViewport path is bypassing the existing overlay
handling by calling setWSI directly instead of going through setDataIds. Update
the logic around getGenericViewportWSIDataSet and the subsequent call so the
WSIViewportLegacyAdapter flow preserves the stored miniNavigationOverlay
behavior, including the addWSIMiniNavigationOverlayCss() and
miniNavigationOverlay === false handling already implemented in setDataIds. Use
setDataIds as the integration point for the registered dataset/display set flow
rather than skipping straight to setWSI.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f28e2939-2a90-4a25-97da-de0782ae92fd

📥 Commits

Reviewing files that changed from the base of the PR and between 0cc8f0d and 10b6e76.

📒 Files selected for processing (1)
  • packages/core/src/RenderingEngine/WSIViewport.ts

Comment thread packages/core/src/RenderingEngine/WSIViewport.ts Outdated
@jbocce jbocce changed the title fix(wsi): render WSIViewport via setDisplaySets by resolving the regi…stered generic dataset fix(wsi): render WSIViewport via setDisplaySets by resolving the registered generic dataset Jun 27, 2026
@jbocce jbocce requested review from sedghi and wayfarer3130 June 27, 2026 17:35
* This reads from the same registry as the GenericViewport WSI data provider,
* so the same caller code drives both the legacy and generic render paths.
*/
public async setDisplaySets(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should come with the other set display sets big PR with documentation

@jbocce

jbocce commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

Will be handled by #2738

@jbocce jbocce closed this Jun 29, 2026
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.

2 participants