Skip to content

Commit

Permalink
fix wsi test
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 committed Jun 12, 2024
1 parent c97f02c commit a66abb6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 22 deletions.
21 changes: 11 additions & 10 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,13 @@ interface CustomEvent_2<T = any> extends Event {
initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T): void;
}

// @public (undocumented)
type DataSetOptions = {
groupId?: string;
viewSelector?: ViewPresentationSelector;
viewReference?: ViewReferenceSpecifier;
};

// @public (undocumented)
function decimate(list: Array<unknown>, interleave: number, offset?: number): number[];

Expand Down Expand Up @@ -1815,12 +1822,6 @@ const imageRetrieveMetadataProvider: {
get: (type: string, ...queries: string[]) => any;
};

// @public (undocumented)
type ImageSetOptions = {
viewSelector?: ViewPresentationSelector;
viewReference?: ViewReferenceSpecifier;
};

// @public (undocumented)
type ImageSliceData = {
numberOfSlices: number;
Expand Down Expand Up @@ -2268,7 +2269,7 @@ interface IViewport {
// (undocumented)
setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void;
// (undocumented)
setDataIds(dataIds: string[], options?: ImageSetOptions): void;
setDataIds(dataIds: string[], options?: DataSetOptions): void;
// (undocumented)
setDisplayArea(displayArea: DisplayArea, callResetCamera?: boolean, suppressEvents?: boolean): any;
// (undocumented)
Expand Down Expand Up @@ -3384,7 +3385,7 @@ declare namespace Types {
IStreamingVolumeProperties,
IViewport,
ViewReference,
ImageSetOptions,
DataSetOptions as ImageSetOptions,
ViewPresentation,
ViewPresentationSelector,
ReferenceCompatibleOptions,
Expand Down Expand Up @@ -3699,7 +3700,7 @@ export class VideoViewport extends Viewport implements IVideoViewport {
// (undocumented)
protected setColorTransform(): void;
// (undocumented)
setDataIds(imageIds: string[], options?: ImageSetOptions): void;
setDataIds(imageIds: string[], options?: DataSetOptions): void;
// (undocumented)
setFrameNumber(frame: number): Promise<void>;
// (undocumented)
Expand Down Expand Up @@ -3896,7 +3897,7 @@ export class Viewport implements IViewport {
// (undocumented)
protected setCameraNoEvent(camera: ICamera): void;
// (undocumented)
setDataIds(_imageIds: string[], _options?: ImageSetOptions): void;
setDataIds(_imageIds: string[], _options?: DataSetOptions): void;
// (undocumented)
setDisplayArea(displayArea: DisplayArea, suppressEvents?: boolean): void;
// (undocumented)
Expand Down
8 changes: 3 additions & 5 deletions packages/core/examples/wsi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ console.warn(
'Click on index.ts to open source code for this example --------->'
);

const { ToolGroupManager, Enums: csToolsEnums } = cornerstoneTools;

const { MouseBindings, KeyboardBindings } = csToolsEnums;
const { ToolGroupManager } = cornerstoneTools;

const { wadors } = dicomImageLoader;

const { ViewportType, Events } = Enums;
const { ViewportType } = Enums;

// ======== Constants ======= //
const renderingEngineId = 'myRenderingEngine';
Expand Down Expand Up @@ -102,7 +100,7 @@ async function run() {

const viewportInput = {
viewportId,
type: ViewportType.WSI,
type: ViewportType.WholeSlide,
element,
defaultOptions: {
background: <Types.Point3>[0.2, 0, 0.2],
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/RenderingEngine/Viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import type {
ViewReferenceSpecifier,
ReferenceCompatibleOptions,
ViewPresentationSelector,
ImageSetOptions,
DataSetOptions,
} from '../types/IViewport';
import type { vtkSlabCamera } from './vtkClasses/vtkSlabCamera';
import { getConfiguration } from '../init';
Expand Down Expand Up @@ -1874,7 +1874,7 @@ class Viewport implements IViewport {
/**
* This is a wrapper for setStack/setVideo/etc
*/
public setDataIds(_imageIds: string[], _options?: ImageSetOptions) {
public setDataIds(_imageIds: string[], _options?: DataSetOptions) {
throw new Error('Unsupported operatoin setDataIds');
}
}
Expand Down
12 changes: 10 additions & 2 deletions packages/core/src/types/IViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,18 @@ export type ViewPresentationSelector = {
paletteLut?: boolean;
};

export type ImageSetOptions = {
export type DataSetOptions = {
/**
* The group id is a volume, display set or other identification for the
* overall set of data. If set, then two sets of images can be compared for
* equality by comparing the group id.
* For volumes, if set, the groupId must be the primary volumeId.
*/
groupId?: string;
viewSelector?: ViewPresentationSelector;
viewReference?: ViewReferenceSpecifier;
};

/**
* Viewport interface for cornerstone viewports
*/
Expand Down Expand Up @@ -418,7 +426,7 @@ interface IViewport {
* @param dataIds - a set of data ids that make up the data viewport
* @param options - an optional object with view reference/specifier
*/
setDataIds(dataIds: string[], options?: ImageSetOptions): void;
setDataIds(dataIds: string[], options?: DataSetOptions): void;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {
IViewport,
PublicViewportInput,
ViewReferenceSpecifier,
ImageSetOptions,
DataSetOptions,
ReferenceCompatibleOptions,
ViewReference,
ViewPresentation,
Expand Down Expand Up @@ -168,7 +168,7 @@ export type {
IStreamingVolumeProperties,
IViewport,
ViewReference,
ImageSetOptions,
DataSetOptions as ImageSetOptions,
ViewPresentation,
ViewPresentationSelector,
ReferenceCompatibleOptions,
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/examples/wsiAnnotationTools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async function run() {

const viewportInput = {
viewportId,
type: ViewportType.WSI,
type: ViewportType.WholeSlide,
element,
defaultOptions: {
background: <Types.Point3>[0.1, 0.1, 0.1],
Expand Down

0 comments on commit a66abb6

Please sign in to comment.