Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/core/src/RenderingEngine/WSIViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
type WSITransformUtilitiesLike,
type WSIViewerLike,
} from '../utilities/WSIUtilities';
import { getGenericViewportWSIDataSet } from './GenericViewport/genericViewportDataSetAccess';

let WSIUtilFunctions: WSITransformUtilitiesLike | null = null;
const EVENT_POSTRENDER = 'postrender';
Expand Down Expand Up @@ -626,6 +627,33 @@ class WSIViewport extends Viewport {
});
}

/**
* Renders a registered whole-slide display set. The dataset (imageIds +
* webClient) must first be registered with
* `utilities.genericViewportDataSetMetadataProvider` keyed by `displaySetId`.
* 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

...entries: Array<{ displaySetId: string; options?: unknown }>
): Promise<void> {
const [entry] = entries;
if (!entry?.displaySetId) {
throw new Error(
'[WSIViewport] setDisplaySets requires a displaySetId to render whole slide imaging'
);
}

const dataSet = getGenericViewportWSIDataSet(entry.displaySetId);
if (!dataSet?.imageIds?.length || !dataSet.options?.webClient) {
throw new Error(
`[WSIViewport] No registered WSI dataset (imageIds + webClient) for display set ${entry.displaySetId}`
);
}

return this.setDataIds(dataSet.imageIds, dataSet.options);
}

public postrender = () => {
this.refreshRenderValues();
triggerEvent(this.element, EVENTS.IMAGE_RENDERED, {
Expand Down
Loading