Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added display area to viewport #280

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,27 @@ interface CustomEvent_2<T = any> extends Event {
// @public (undocumented)
const deepMerge: (target?: {}, source?: {}, optionsArgument?: any) => any;

// @public (undocumented)
type DisplayArea = {
imageArea: [number, number];
imageCanvasPoint: {
imagePoint: [number, number];
canvasPoint: [number, number];
};
storeAsInitialCamera: boolean;
};

// @public (undocumented)
type DisplayAreaModifiedEvent = CustomEvent_2<DisplayAreaModifiedEventDetail>;

// @public (undocumented)
type DisplayAreaModifiedEventDetail = {
viewportId: string;
displayArea: DisplayArea;
volumeId?: string;
storeAsInitialCamera?: boolean;
};

// @public (undocumented)
enum DynamicOperatorType {
// (undocumented)
Expand Down Expand Up @@ -577,6 +598,8 @@ export enum EVENTS {
// (undocumented)
CAMERA_RESET = "CORNERSTONE_CAMERA_RESET",
// (undocumented)
DISPLAY_AREA_MODIFIED = "CORNERSTONE_DISPLAY_AREA_MODIFIED",
// (undocumented)
ELEMENT_DISABLED = "CORNERSTONE_ELEMENT_DISABLED",
// (undocumented)
ELEMENT_ENABLED = "CORNERSTONE_ELEMENT_ENABLED",
Expand Down Expand Up @@ -635,6 +658,8 @@ declare namespace EventTypes {
CameraModifiedEvent,
VoiModifiedEvent,
VoiModifiedEventDetail,
DisplayAreaModifiedEvent,
DisplayAreaModifiedEventDetail,
ElementDisabledEvent,
ElementDisabledEventDetail,
ElementEnabledEvent,
Expand Down Expand Up @@ -1592,6 +1617,8 @@ interface IViewport {
// (undocumented)
getDefaultActor(): ActorEntry;
// (undocumented)
getDisplayArea(): DisplayArea | undefined;
// (undocumented)
getFrameOfReferenceUID: () => string;
// (undocumented)
getPan(): Point2;
Expand Down Expand Up @@ -1624,6 +1651,8 @@ interface IViewport {
// (undocumented)
setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void;
// (undocumented)
setDisplayArea(displayArea: DisplayArea, callResetCamera?: boolean, suppressEvents?: boolean): any;
// (undocumented)
setOptions(options: ViewportInputOptions, immediate: boolean): void;
// (undocumented)
setPan(pan: Point2, storeAsInitialCamera?: boolean): any;
Expand Down Expand Up @@ -2277,6 +2306,7 @@ declare namespace Types {
ViewportInputOptions,
VOIRange,
VOI,
DisplayArea,
FlipDirection,
ICachedImage,
ICachedVolume,
Expand Down Expand Up @@ -2408,6 +2438,8 @@ export class Viewport implements IViewport {
// (undocumented)
getDefaultActor(): ActorEntry;
// (undocumented)
getDisplayArea(): DisplayArea | undefined;
// (undocumented)
_getEdges(bounds: Array<number>): Array<[number[], number[]]>;
// (undocumented)
_getFocalPointForResetCamera(centeredFocalPoint: Point3, previousCamera: ICamera, { resetPan, resetToCenter }: {
Expand Down Expand Up @@ -2467,6 +2499,10 @@ export class Viewport implements IViewport {
// (undocumented)
protected setCameraNoEvent(camera: ICamera): void;
// (undocumented)
setDisplayArea(displayArea: DisplayArea, suppressEvents?: boolean): void;
// (undocumented)
protected setFitToCanvasCamera(camera: ICamera): void;
// (undocumented)
protected setInitialCamera(camera: ICamera): void;
// (undocumented)
setOptions(options: ViewportInputOptions, immediate?: boolean): void;
Expand Down Expand Up @@ -2504,6 +2540,7 @@ export class Viewport implements IViewport {
type ViewportInputOptions = {
background?: [number, number, number];
orientation?: OrientationAxis | OrientationVectors;
displayArea?: DisplayArea;
suppressEvents?: boolean;
parallelProjection?: boolean;
};
Expand Down
31 changes: 31 additions & 0 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,27 @@ interface CustomEvent_2<T = any> extends Event {
): void;
}

// @public (undocumented)
type DisplayArea = {
imageArea: [number, number]; // areaX, areaY
imageCanvasPoint: {
imagePoint: [number, number]; // imageX, imageY
canvasPoint: [number, number]; // canvasX, canvasY
};
storeAsInitialCamera: boolean;
};

// @public
type DisplayAreaModifiedEvent = CustomEvent_2<DisplayAreaModifiedEventDetail>;

// @public
type DisplayAreaModifiedEventDetail = {
viewportId: string;
displayArea: DisplayArea;
volumeId?: string;
storeAsInitialCamera?: boolean;
};

// @public
enum DynamicOperatorType {
AVERAGE = 'AVERAGE',
Expand Down Expand Up @@ -436,6 +457,7 @@ enum Events {
CAMERA_MODIFIED = 'CORNERSTONE_CAMERA_MODIFIED',

CAMERA_RESET = 'CORNERSTONE_CAMERA_RESET',
DISPLAY_AREA_MODIFIED = 'CORNERSTONE_DISPLAY_AREA_MODIFIED',
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this should have it's own even - there should be a way to get properties changed, or this should trigger camera modified events. @sedghi - any thoughts about the event? Other properties don't have their own events.

ELEMENT_DISABLED = 'CORNERSTONE_ELEMENT_DISABLED',
ELEMENT_ENABLED = 'CORNERSTONE_ELEMENT_ENABLED',
GEOMETRY_CACHE_GEOMETRY_ADDED = 'CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED',
Expand Down Expand Up @@ -478,6 +500,8 @@ declare namespace EventTypes {
CameraModifiedEvent,
VoiModifiedEvent,
VoiModifiedEventDetail,
DisplayAreaModifiedEvent,
DisplayAreaModifiedEventDetail,
ElementDisabledEvent,
ElementDisabledEventDetail,
ElementEnabledEvent,
Expand Down Expand Up @@ -1078,6 +1102,7 @@ interface IViewport {
// (undocumented)
_getCorners(bounds: Array<number>): Array<number>[];
getDefaultActor(): ActorEntry;
getDisplayArea(): DisplayArea | undefined;
getFrameOfReferenceUID: () => string;
getPan(): Point2;
getRenderer(): void;
Expand All @@ -1094,6 +1119,11 @@ interface IViewport {
reset(immediate: boolean): void;
setActors(actors: Array<ActorEntry>): void;
setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void;
setDisplayArea(
Copy link
Collaborator

Choose a reason for hiding this comment

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

When there are more than one option, the options should go into a typed options property so that the number of arguments doesn't change.

displayArea: DisplayArea,
callResetCamera?: boolean,
suppressEvents?: boolean
);
setOptions(options: ViewportInputOptions, immediate: boolean): void;
setPan(pan: Point2, storeAsInitialCamera?: boolean);
setZoom(zoom: number, storeAsInitialCamera?: boolean);
Expand Down Expand Up @@ -1438,6 +1468,7 @@ type TransformMatrix2D = [number, number, number, number, number, number];
type ViewportInputOptions = {
background?: [number, number, number];
orientation?: OrientationAxis | OrientationVectors;
displayArea?: DisplayArea;
suppressEvents?: boolean;
parallelProjection?: boolean;
};
Expand Down
30 changes: 30 additions & 0 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,27 @@ function destroyToolGroup(toolGroupId: string): void;
// @public (undocumented)
function disable(element: any): void;

// @public (undocumented)
type DisplayArea = {
imageArea: [number, number]; // areaX, areaY
imageCanvasPoint: {
imagePoint: [number, number]; // imageX, imageY
canvasPoint: [number, number]; // canvasX, canvasY
};
storeAsInitialCamera: boolean;
};

// @public
type DisplayAreaModifiedEvent = CustomEvent_2<DisplayAreaModifiedEventDetail>;

// @public
type DisplayAreaModifiedEventDetail = {
viewportId: string;
displayArea: DisplayArea;
volumeId?: string;
storeAsInitialCamera?: boolean;
};

// @public (undocumented)
function distanceToPoint(lineStart: Types_2.Point2, lineEnd: Types_2.Point2, point: Types_2.Point2): number;

Expand Down Expand Up @@ -1790,6 +1811,8 @@ declare namespace EventTypes {
CameraModifiedEvent,
VoiModifiedEvent,
VoiModifiedEventDetail,
DisplayAreaModifiedEvent,
DisplayAreaModifiedEventDetail,
ElementDisabledEvent,
ElementDisabledEventDetail,
ElementEnabledEvent,
Expand Down Expand Up @@ -2939,6 +2962,7 @@ interface IViewport {
// (undocumented)
_getCorners(bounds: Array<number>): Array<number>[];
getDefaultActor(): ActorEntry;
getDisplayArea(): DisplayArea | undefined;
getFrameOfReferenceUID: () => string;
getPan(): Point2;
getRenderer(): void;
Expand All @@ -2955,6 +2979,11 @@ interface IViewport {
reset(immediate: boolean): void;
setActors(actors: Array<ActorEntry>): void;
setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void;
setDisplayArea(
displayArea: DisplayArea,
callResetCamera?: boolean,
suppressEvents?: boolean
);
setOptions(options: ViewportInputOptions, immediate: boolean): void;
setPan(pan: Point2, storeAsInitialCamera?: boolean);
setZoom(zoom: number, storeAsInitialCamera?: boolean);
Expand Down Expand Up @@ -5297,6 +5326,7 @@ declare namespace viewportFilters {
type ViewportInputOptions = {
background?: [number, number, number];
orientation?: OrientationAxis | OrientationVectors;
displayArea?: DisplayArea;
suppressEvents?: boolean;
parallelProjection?: boolean;
};
Expand Down