Skip to main content

Interface: IGenericViewport

Public surface of a direct Generic ("next") viewport (PLANAR_NEXT, VOLUME_3D_NEXT, VIDEO_NEXT, ECG_NEXT, WHOLE_SLIDE_NEXT).

This is the type to narrow to (via isGenericViewport) when application code needs the native data, presentation, and view-state APIs rather than the legacy stack/volume method surface. Signatures are intentionally permissive (unknown) because the concrete view-state and data-presentation shapes are viewport-family specific; use getViewState/getDisplaySetPresentation generics on the concrete class when the family is known.

Extends

Properties

_actors

_actors: Map<string, ActorEntry>

a Map containing the actor uid and actors

Inherited from

IViewport._actors

Defined in

packages/core/src/RenderingEngine/Viewport.ts:135


_displaySets

protected _displaySets: object[] = []

Records the display sets currently mounted on the viewport. Populated by the type-specific setDisplaySets overrides (via mountDisplaySets) and cleared whenever raw data is set directly (e.g. setStack), so that getDisplaySets reflects only display-set-driven content.

Inherited from

IViewport._displaySets

Defined in

packages/core/src/RenderingEngine/Viewport.ts:142


_suppressCameraModifiedEvents

_suppressCameraModifiedEvents: boolean = false

informs if a new actor was added before a resetCameraClippingRange phase

Inherited from

IViewport._suppressCameraModifiedEvents

Defined in

packages/core/src/RenderingEngine/Viewport.ts:149


calibration

protected calibration: IImageCalibration

Inherited from

IViewport.calibration

Defined in

packages/core/src/RenderingEngine/Viewport.ts:153


canvas

readonly canvas: HTMLCanvasElement

an internal canvas that is created on the provided HTML element

Inherited from

IViewport.canvas

Defined in

packages/core/src/RenderingEngine/Viewport.ts:97


canvasToWorld()

canvasToWorld: (canvasPos) => Point3

Parameters

canvasPos: Point2

Returns

Point3

Inherited from

IViewport.canvasToWorld

Defined in

packages/core/src/RenderingEngine/Viewport.ts:191


customRenderViewportToCanvas()

customRenderViewportToCanvas: () => unknown

Returns

unknown

Inherited from

IViewport.customRenderViewportToCanvas

Defined in

packages/core/src/RenderingEngine/Viewport.ts:193


defaultOptions

readonly defaultOptions: ViewportInputOptions

Default options for the viewport which includes orientation, viewPlaneNormal and backgroundColor

Inherited from

IViewport.defaultOptions

Defined in

packages/core/src/RenderingEngine/Viewport.ts:145


element

readonly element: HTMLDivElement

HTML element in DOM that is used for rendering the viewport

Inherited from

IViewport.element

Defined in

packages/core/src/RenderingEngine/Viewport.ts:95


fitToCanvasCamera

protected fitToCanvasCamera: ICamera<number>

The camera that is defined for resetting displayArea to ensure absolute displayArea settings

Inherited from

IViewport.fitToCanvasCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:161


flipHorizontal

protected flipHorizontal: boolean = false

Inherited from

IViewport.flipHorizontal

Defined in

packages/core/src/RenderingEngine/Viewport.ts:118


flipVertical

protected flipVertical: boolean = false

Inherited from

IViewport.flipVertical

Defined in

packages/core/src/RenderingEngine/Viewport.ts:119


getFrameOfReferenceUID()

getFrameOfReferenceUID: () => string

Returns

string

Inherited from

IViewport.getFrameOfReferenceUID

Defined in

packages/core/src/RenderingEngine/Viewport.ts:190


getNumberOfSlices()

getNumberOfSlices: () => number

Returns

number

Inherited from

IViewport.getNumberOfSlices

Defined in

packages/core/src/RenderingEngine/Viewport.ts:197


getProperties()

getProperties: () => ViewportProperties

Returns

ViewportProperties

Inherited from

IViewport.getProperties

Defined in

packages/core/src/RenderingEngine/Viewport.ts:195


getRotation()

getRotation: () => number

Returns

number

Inherited from

IViewport.getRotation

Defined in

packages/core/src/RenderingEngine/Viewport.ts:189


hasPixelSpacing

protected hasPixelSpacing: boolean = true

Inherited from

IViewport.hasPixelSpacing

Defined in

packages/core/src/RenderingEngine/Viewport.ts:152


id

readonly id: string

unique identifier for the viewport

Inherited from

IViewport.id

Defined in

packages/core/src/RenderingEngine/Viewport.ts:93


initialCamera

protected initialCamera: ICamera<number>

The camera that is initially defined on the reset for the relative pan/zoom

Inherited from

IViewport.initialCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:157


insetImageMultiplier

protected insetImageMultiplier: number

The amount by which the images are inset in a viewport by default.

Inherited from

IViewport.insetImageMultiplier

Defined in

packages/core/src/RenderingEngine/Viewport.ts:113


isDisabled

isDisabled: boolean

Inherited from

IViewport.isDisabled

Defined in

packages/core/src/RenderingEngine/Viewport.ts:120


options

options: ViewportInputOptions

options for the viewport which includes orientation axis, backgroundColor and displayArea

Inherited from

IViewport.options

Defined in

packages/core/src/RenderingEngine/Viewport.ts:147


renderingEngineId

readonly renderingEngineId: string

RenderingEngine id that the viewport belongs to

Inherited from

IViewport.renderingEngineId

Defined in

packages/core/src/RenderingEngine/Viewport.ts:99


requestedType?

optional requestedType: ViewportType

The viewport type originally requested by the caller, before any internal compatibility remap (e.g. STACK/ORTHOGRAPHIC requested as PLANAR_NEXT when rendering.useGenericViewport is enabled). Equals type when not remapped. Set by the rendering engine at creation. Use this when branching on the legacy viewport type so the branch is transparent across compat adapters.

Inherited from

IViewport.requestedType

Defined in

packages/core/src/RenderingEngine/Viewport.ts:109


resize()

resize: () => void

Returns

void

Inherited from

IViewport.resize

Defined in

packages/core/src/RenderingEngine/Viewport.ts:194


sHeight

sHeight: number

sHeight of viewport on the offscreen canvas

Inherited from

IViewport.sHeight

Defined in

packages/core/src/RenderingEngine/Viewport.ts:133


suppressEvents

readonly suppressEvents: boolean

A flag representing if viewport methods should fire events or not

Inherited from

IViewport.suppressEvents

Defined in

packages/core/src/RenderingEngine/Viewport.ts:151


sWidth

sWidth: number

sWidth of viewport on the offscreen canvas

Inherited from

IViewport.sWidth

Defined in

packages/core/src/RenderingEngine/Viewport.ts:131


sx

sx: number

sx of viewport on the offscreen canvas

Inherited from

IViewport.sx

Defined in

packages/core/src/RenderingEngine/Viewport.ts:127


sy

sy: number

sy of viewport on the offscreen canvas

Inherited from

IViewport.sy

Defined in

packages/core/src/RenderingEngine/Viewport.ts:129


type

readonly type: ViewportType

Type of viewport

Inherited from

IViewport.type

Defined in

packages/core/src/RenderingEngine/Viewport.ts:101


updateRenderingPipeline()

updateRenderingPipeline: () => void

Returns

void

Inherited from

IViewport.updateRenderingPipeline

Defined in

packages/core/src/RenderingEngine/Viewport.ts:196


viewportStatus

viewportStatus: ViewportStatus = ViewportStatus.NO_DATA

Record the rendering status, mostly for testing purposes, but can also be useful for knowing things like whether the viewport is initialized

Inherited from

IViewport.viewportStatus

Defined in

packages/core/src/RenderingEngine/Viewport.ts:124


worldToCanvas()

worldToCanvas: (worldPos) => Point2

Parameters

worldPos: Point3

Returns

Point2

Inherited from

IViewport.worldToCanvas

Defined in

packages/core/src/RenderingEngine/Viewport.ts:192

Methods

_getCorners()

_getCorners(bounds): number[][]

Parameters

bounds: number[]

Returns

number[][]

Inherited from

IViewport._getCorners

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2281


_getEdges()

_getEdges(bounds): [number[], number[]][]

Returns a list of edges for the imageData bounds, which are the cube edges in the case of volumeViewport edges. p1: front, bottom, left p2: front, top, left p3: back, bottom, left p4: back, top, left p5: front, bottom, right p6: front, top, right p7: back, bottom, right p8: back, top, right

Parameters

bounds: number[]

Bounds of the renderer

Returns

[number[], number[]][]

Edges of the containing bounds

Inherited from

IViewport._getEdges

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2377


_getFocalPointForResetCamera()

_getFocalPointForResetCamera(centeredFocalPoint, previousCamera, __namedParameters): Point3

Parameters

centeredFocalPoint: Point3

previousCamera: ICamera<number>

__namedParameters

__namedParameters.resetPan: boolean = true

__namedParameters.resetToCenter: boolean = true

Returns

Point3

Inherited from

IViewport._getFocalPointForResetCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2294


_isInBounds()

_isInBounds(point, bounds): boolean

Determines whether or not the 3D point position is inside the boundaries of the 3D imageData.

Parameters

point: Point3

3D coordinate

bounds: number[]

Bounds of the image

Returns

boolean

boolean

Inherited from

IViewport._isInBounds

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2354


_removeActor()

_removeActor(actorUID): ActorEntry

Remove the actor from the viewport

Parameters

actorUID: string

The unique identifier for the actor.

Returns

ActorEntry

The removed actor entry or undefined if it didn't exist

Inherited from

IViewport._removeActor

Defined in

packages/core/src/RenderingEngine/Viewport.ts:658


addActor()

addActor(actorEntry): void

Add an actor to the viewport including its id, its actor and slabThickness if defined

Parameters

actorEntry: ActorEntry

ActorEntry

  • actorEntry.uid - The unique identifier for the actor.
  • actorEntry.actor - The volume actor.
  • actorEntry.slabThickness - The slab thickness.

Returns

void

Inherited from

IViewport.addActor

Defined in

packages/core/src/RenderingEngine/Viewport.ts:753


addActors()

addActors(actors, options): void

Add a list of actors (actor entries) to the viewport

Parameters

actors: ActorEntry[]

An array of ActorEntry objects.

options = {}

options.resetCamera?: boolean

Returns

void

Inherited from

IViewport.addActors

Defined in

packages/core/src/RenderingEngine/Viewport.ts:704


addDisplaySet()

addDisplaySet(displaySetId, options): Promise<void>

Parameters

displaySetId: string

options: unknown

Returns

Promise<void>

Defined in

packages/core/src/types/IGenericViewport.ts:53


addWidget()

addWidget(widgetId, widget): void

Parameters

widgetId: any

widget: any

Returns

void

Inherited from

IViewport.addWidget

Defined in

packages/core/src/RenderingEngine/Viewport.ts:242


clearDisplaySets()

protected clearDisplaySets(): void

Clears the recorded display sets. Native data setters call this so that setting raw data without setDisplaySets resets the stored list. mountDisplaySets relies on this ordering: it runs the native data setter first (which clears) and then records the mounted entries.

Returns

void

Inherited from

IViewport.clearDisplaySets

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2509


destroy()

destroy(): void

Returns

void

Inherited from

IViewport.destroy

Defined in

packages/core/src/RenderingEngine/Viewport.ts:284


dispose()

dispose(): void

Returns

void

Inherited from

IViewport.dispose

Defined in

packages/core/src/RenderingEngine/Viewport.ts:279


flip()

protected flip(flipOptions): void

Flip the viewport on horizontal or vertical axis, this method works with vtk-js backed rendering pipeline.

Parameters

flipOptions: FlipDirection

Flip options specifying the axis of flip

  • flipOptions.flipHorizontal - Flip the viewport on horizontal axis
  • flipOptions.flipVertical - Flip the viewport on vertical axis

Returns

void

Inherited from

IViewport.flip

Defined in

packages/core/src/RenderingEngine/Viewport.ts:427


getActor()

getActor(actorUID): ActorEntry

Get an actor by its UID

Parameters

actorUID: string

The unique ID of the actor.

Returns

ActorEntry

An ActorEntry object.

Inherited from

IViewport.getActor

Defined in

packages/core/src/RenderingEngine/Viewport.ts:587


getActorByIndex()

getActorByIndex(index): ActorEntry

Get an actor by its index

Parameters

index: number

array index.

Returns

ActorEntry

actorUID

Inherited from

IViewport.getActorByIndex

Defined in

packages/core/src/RenderingEngine/Viewport.ts:630


getActors()

getActors(): ActorEntry[]

Get all the actors in the viewport

Returns

ActorEntry[]

An array of ActorEntry objects.

Inherited from

IViewport.getActors

Defined in

packages/core/src/RenderingEngine/Viewport.ts:570


getActorUIDByIndex()

getActorUIDByIndex(index): string

Get an actor UID by its index

Parameters

index: number

array index.

Returns

string

actorUID

Inherited from

IViewport.getActorUIDByIndex

Defined in

packages/core/src/RenderingEngine/Viewport.ts:618


getActorUIDs()

getActorUIDs(): string[]

Returns an array of unique identifiers for all the actors in the viewport.

Returns

string[]

An array of strings

Inherited from

IViewport.getActorUIDs

Defined in

packages/core/src/RenderingEngine/Viewport.ts:578


getAspectRatio()

getAspectRatio(): Point2

Returns the current aspect ratio of the viewport as a 2D point [widthRatio, heightRatio].

Returns

Point2

The current aspect ratio [widthRatio, heightRatio] based on the active camera settings.

Inherited from

IViewport.getAspectRatio

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1459


getCamera()

getCamera(): ICamera<number>

Get the camera's current state

Returns

ICamera<number>

The camera object.

Inherited from

IViewport.getCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1612


getCameraNoRotation()

protected getCameraNoRotation(): ICamera<number>

Returns

ICamera<number>

Inherited from

IViewport.getCameraNoRotation

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1568


getCanvas()

getCanvas(): HTMLCanvasElement

Gets the target output canvas for the Viewport.

Returns

HTMLCanvasElement

an HTMLCanvasElement.

Inherited from

IViewport.getCanvas

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1549


getClippingPlanesForActor()

getClippingPlanesForActor(actorEntry?): vtkPlane[]

Method to get the clipping planes of a given actor

Parameters

actorEntry?: ActorEntry

The actor entry (a specific type you'll define dependent on your code)

Returns

vtkPlane[]

vtkPlanes - An array of vtkPlane objects associated with the given actor

Inherited from

IViewport.getClippingPlanesForActor

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1966


getCurrentImageId()

getCurrentImageId(): string

Resolves the currently referenced image id from the active view state, when the bound source data can be expressed as an image id (stack / vtkImage content and axially aligned volume slices). Returns undefined for content with no single source image (e.g. oblique/orthogonal volume reslices).

Returns

string

Defined in

packages/core/src/types/IGenericViewport.ts:87


getCurrentImageIdIndex()

getCurrentImageIdIndex(): number

Returns

number

Inherited from

IViewport.getCurrentImageIdIndex

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1360


getCurrentMode()

getCurrentMode(): ViewportContentMode

Content-true classification of the bound source data; see ViewportContentMode.

Returns

ViewportContentMode

Defined in

packages/core/src/types/IGenericViewport.ts:67


getDefaultActor()

getDefaultActor(): ActorEntry

Get the default actor

Returns

ActorEntry

An actor entry.

Inherited from

IViewport.getDefaultActor

Defined in

packages/core/src/RenderingEngine/Viewport.ts:562


getDisplayArea()

getDisplayArea(): DisplayArea

Returns

DisplayArea

Inherited from

IViewport.getDisplayArea

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1111


getDisplaySetPresentation()

getDisplaySetPresentation(displaySetId): unknown

Parameters

displaySetId: string

Returns

unknown

Defined in

packages/core/src/types/IGenericViewport.ts:61


getDisplaySets()

getDisplaySets(): object[]

Returns the display sets currently recorded as mounted on the viewport. Empty when the viewport was driven by a raw data setter instead of setDisplaySets.

Returns

object[]

Inherited from

IViewport.getDisplaySets

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2499


getImageActor()

getImageActor(volumeId?): vtkImageSlice

Retrieves an image actor from the viewport actors.

Parameters

volumeId?: string

Optional. The ID of the volume to find the corresponding image actor.

Returns

vtkImageSlice

The image actor if found, otherwise null.

Inherited from

IViewport.getImageActor

Defined in

packages/core/src/RenderingEngine/Viewport.ts:597


getImageData()

getImageData(): any

Returns

any

Inherited from

IViewport.getImageData

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1369


getPan()

getPan(initialCamera): Point2

Helper function to return the current canvas pan value.

Parameters

initialCamera: ICamera<number> = ...

Returns

Point2

a Point2 containing the current pan values on the canvas, computed from the current camera, where the initial pan value is [0,0].

Inherited from

IViewport.getPan

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1337


getRenderer()

getRenderer(): vtkRenderer

Returns the vtkRenderer responsible for rendering the Viewport.

Returns

vtkRenderer

The vtkRenderer for the Viewport.

Inherited from

IViewport.getRenderer

Defined in

packages/core/src/RenderingEngine/Viewport.ts:354


getRenderingEngine()

getRenderingEngine(): RenderingEngine

Returns the rendering engine driving the Viewport.

Returns

RenderingEngine

The RenderingEngine instance.

Inherited from

IViewport.getRenderingEngine

Defined in

packages/core/src/RenderingEngine/Viewport.ts:345


getRenderPasses()

getRenderPasses(): any

Get render passes for this viewport. Viewports can override this to provide custom render passes (e.g., for sharpening).

Returns

any

Array of VTK render passes or null if no custom passes are needed

Inherited from

IViewport.getRenderPasses

Defined in

packages/core/src/RenderingEngine/Viewport.ts:259


getResolvedView()

getResolvedView(): ResolvedViewportView<unknown, ICamera<unknown>>

The resolved semantic view (camera + spatial basis) the viewport derives from its bound data and view state. Native viewports have no legacy getCamera(); callers bridge through this (see getViewportICamera).

Returns

ResolvedViewportView<unknown, ICamera<unknown>>

Defined in

packages/core/src/types/IGenericViewport.ts:78


getSliceIndex()

getSliceIndex(): number

Returns

number

Inherited from

IViewport.getSliceIndex

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1364


getSliceViewInfo()

getSliceViewInfo(): object

Returns

object

height

height: number

indexToSliceMatrix

indexToSliceMatrix: mat4

sliceIndex

sliceIndex: number

slicePlane

slicePlane: number

sliceToIndexMatrix

sliceToIndexMatrix: mat4

width

width: number

Inherited from

IViewport.getSliceViewInfo

Defined in

packages/core/src/RenderingEngine/Viewport.ts:408


getUseCustomRenderingPipeline()

getUseCustomRenderingPipeline(): boolean

Returns

boolean

Inherited from

IViewport.getUseCustomRenderingPipeline

Defined in

packages/core/src/RenderingEngine/Viewport.ts:206


getViewPresentation()

getViewPresentation(viewPresSel): ViewPresentation

Gets a view presentation information specifying HOW a viewport displays something, but not what is being displayed. See getViewReference to get information on WHAT is being displayed.

This is intended to have information on how an image is presented to the user, without specifying what image s displayed. All of this information is available externally, but this method combines the parts of this that are appropriate for remember or applying to other views, without necessarily needing to know what all the attributes are. That differs from methods like getCamera which fetch exact view details that are not likely to be identical between viewports as they change sizes or apply to different images.

Note that the results of this can be used on different viewports, for example, the pan values can be applied to a volume viewport showing a CT, and a stack viewport showing an ultrasound.

The selector allows choosing which view presentation attributes to return. Some default values are available from Viewport.CameraViewPresentation and Viewport.TransferViewPresentation

Parameters

viewPresSel: ViewPresentationSelector = ...

select which attributes to display.

Returns

ViewPresentation

Inherited from

IViewport.getViewPresentation

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2176


getViewReference()

getViewReference(viewRefSpecifier?): ViewReference

Gets a view target specifying WHAT a view is displaying, allowing for checking if a given image is displayed or could be displayed in a given viewport. See getViewPresentation for HOW a view is displayed.

Parameters

viewRefSpecifier?: ViewReferenceSpecifier

choose an alternate view to be specified, typically a different slice index in the same set of images.

Returns

ViewReference

Inherited from

IViewport.getViewReference

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2049


getViewReferenceId()

getViewReferenceId(_specifier?): string

Gets a referenced image url of some sort - could be a real image id, or could be a URL with parameters. Regardless it refers to the currently displaying image as a string value.

Parameters

_specifier?: ViewReferenceSpecifier

Returns

string

Inherited from

IViewport.getViewReferenceId

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1378


getViewState()

getViewState(): unknown

Returns

unknown

Defined in

packages/core/src/types/IGenericViewport.ts:63


getVtkActiveCamera()

protected getVtkActiveCamera(): vtkCamera | vtkSlabCamera

Gets the active vtkCamera for the viewport.

Returns

vtkCamera | vtkSlabCamera

vtk driven camera

Inherited from

IViewport.getVtkActiveCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1557


getWidget()

getWidget(id): any

Parameters

id: any

Returns

any

Inherited from

IViewport.getWidget

Defined in

packages/core/src/RenderingEngine/Viewport.ts:246


getWidgets()

getWidgets(): any[]

Returns

any[]

Inherited from

IViewport.getWidgets

Defined in

packages/core/src/RenderingEngine/Viewport.ts:250


getZoom()

getZoom(compareCamera): number

Returns a current zoom level relative to the initial parallel scale originally applied to the image. That is, on initial display, the zoom level is 1. Computed as a function of the camera.

Parameters

compareCamera: ICamera<number> = ...

Returns

number

Inherited from

IViewport.getZoom

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1420


isOrientationChangeable()

isOrientationChangeable(): boolean

Returns whether the viewport supports changing orientation (e.g. via setCamera with viewPlaneNormal/viewUp). Used by tools like OrientationControllerTool to decide where to show interactive orientation markers.

Returns

boolean

Inherited from

IViewport.isOrientationChangeable

Defined in

packages/core/src/RenderingEngine/Viewport.ts:235


isPlaneViewable()

isPlaneViewable(planeRestriction, options?): boolean

Parameters

planeRestriction: PlaneRestriction

options?: ReferenceCompatibleOptions

Returns

boolean

Inherited from

IViewport.isPlaneViewable

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2082


isReferenceViewable()

isReferenceViewable(viewRef, options?): boolean

Find out if this viewport does or could show this view reference.

Parameters

viewRef: ViewReference

options?: ReferenceCompatibleOptions

allows specifying whether the view COULD display this with some modification - either navigation or displaying as volume.

Returns

boolean

true if the viewport could show this view reference

Inherited from

IViewport.isReferenceViewable

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2123


mountDisplaySets()

protected mountDisplaySets<TEntry>(entries, load): Promise<void>

Shared template for the type-specific setDisplaySets overrides. It keeps the clear-then-record ordering invariant in exactly one place instead of being copy-pasted per viewport:

  1. Validate that a source display set (the first entry) was provided.
  2. Run load, which resolves the entry to renderable data and hands it to the viewport's native data setter (setStack / setVolumes / setVideo / setWSI / setEcg). That native setter calls clearDisplaySets, wiping any previously recorded entries.
  3. Record the mounted entries - only after load resolves - so getDisplaySets reflects exactly what was mounted.

Because recording always happens last, a new viewport cannot accidentally record before loading (which the native setter would then wipe) or forget to record at all; both failure modes the previous copy-pasted sequence was prone to are handled here once.

Overlays: the variadic signature already accepts overlay entries (index 1+), matching the generic viewport setDisplaySets. Legacy viewports do not yet render overlays, so only the source (first) entry is loaded and recorded - getDisplaySets stays honest about what is actually shown. Adding overlay support later is purely additive: load the extra entries here and record them, with no change to the public signature.

Type Parameters

TEntry extends object

Parameters

entries: TEntry[]

the display set entries passed to setDisplaySets; the first is the source and any subsequent entries are overlays.

load

resolves the source entry to renderable data and loads it via the viewport's native data setter. Receives the validated source entry.

Returns

Promise<void>

Inherited from

IViewport.mountDisplaySets

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2473


removeActors()

removeActors(actorUIDs): void

Remove the actors with the given UIDs from the viewport

Parameters

actorUIDs: string[]

An array of actor UIDs to remove.

Returns

void

Inherited from

IViewport.removeActors

Defined in

packages/core/src/RenderingEngine/Viewport.ts:679


removeAllActors()

removeAllActors(): void

Remove all actors from the renderer

Returns

void

Inherited from

IViewport.removeAllActors

Defined in

packages/core/src/RenderingEngine/Viewport.ts:793


removeData()

removeData(displaySetId): void

Parameters

displaySetId: string

Returns

void

Defined in

packages/core/src/types/IGenericViewport.ts:54


removeWidgets()

removeWidgets(): void

Returns

void

Inherited from

IViewport.removeWidgets

Defined in

packages/core/src/RenderingEngine/Viewport.ts:263


render()

render(): void

Renders the Viewport using the RenderingEngine.

Returns

void

Inherited from

IViewport.render

Defined in

packages/core/src/RenderingEngine/Viewport.ts:367


reset()

reset(immediate): void

Resets the options the Viewport's defaultOptions

Parameters

immediate: boolean = false

If true, renders the viewport after the options are reset.

Returns

void

Inherited from

IViewport.reset

Defined in

packages/core/src/RenderingEngine/Viewport.ts:397


resetCamera()

resetCamera(options?): boolean

Resets the camera based on the rendering volume(s) bounds. If resetPan and resetZoom are true it places the focal point at the center of the volume (or slice); otherwise, only the camera zoom and camera Pan or Zoom is reset for the current view.

Parameters

options?

The reset options

options.resetAspectRatio?: boolean

options.resetPan?: boolean

If true, the camera focal point is reset to the center of the volume (slice)

options.resetToCenter?: boolean

If true, the camera is reset to the center of the volume (slice)

options.resetZoom?: boolean

If true, the camera zoom is reset to the default zoom

options.storeAsInitialCamera?: boolean

If true, reset camera is stored as the initial camera (to allow differences to be detected for pan/zoom values)

Returns

boolean

boolean

Inherited from

IViewport.resetCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1128


resetCameraNoEvent()

protected resetCameraNoEvent(): void

Reset the camera to the default viewport camera without firing events

Returns

void

Inherited from

IViewport.resetCameraNoEvent

Defined in

packages/core/src/RenderingEngine/Viewport.ts:812


resetViewState()

resetViewState(options?): boolean

Parameters

options?: unknown

Returns

boolean

Defined in

packages/core/src/types/IGenericViewport.ts:65


resizeForRenderingEngine()

resizeForRenderingEngine(__namedParameters): void

RenderingEngine-owned resize hook for custom-pipeline viewports. Legacy viewports keep the previous camera-preserving behavior by default.

Parameters

__namedParameters: RenderingEngineResizeOptions = {}

Returns

void

Inherited from

IViewport.resizeForRenderingEngine

Defined in

packages/core/src/RenderingEngine/Viewport.ts:214


setActors()

setActors(actors): void

It removes all actors from the viewport and then adds the actors from the array.

Parameters

actors: ActorEntry[]

An array of ActorEntry objects.

Returns

void

Inherited from

IViewport.setActors

Defined in

packages/core/src/RenderingEngine/Viewport.ts:638


setAspectRatio()

setAspectRatio(value, isFitViewportAfterStretch, storeAsInitialCamera): void

Sets the aspect ratio of the viewport (canvas) using the provided 2D point [widthRatio, heightRatio].

This updates the VTK camera's projection matrix to apply axis-based stretching during rendering.

As a result:

  • World-to-canvas mapping is updated via the camera projection.
  • Canvas-to-world mapping is also updated and remains consistent, as VTK utilizes the inverse of the same projection matrix for picking and coordinate transformations.

Note:

  • The camera pose and orientation (position, focal point, and viewPlaneNormal) remain unchanged.
  • Image data, spacing, and world coordinates are not modified.

Parameters

value: Point2

The aspect ratio to set as [widthRatio, heightRatio].

isFitViewportAfterStretch: boolean = true

storeAsInitialCamera: boolean = false

Whether to store the updated camera state as the initial camera. Defaults to false.

Returns

void

Inherited from

IViewport.setAspectRatio

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1486


setCamera()

setCamera(cameraInterface, storeAsInitialCamera): void

Set the camera parameters

Parameters

cameraInterface: ICamera<number>

ICamera

storeAsInitialCamera: boolean = false

to set the provided camera as the initial one, used to compute differences for things like pan and zoom.

Returns

void

Inherited from

IViewport.setCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1704


setCameraNoEvent()

protected setCameraNoEvent(camera): void

Sets the camera to the default viewport camera without firing events

Parameters

camera: ICamera<number>

The camera to use for the viewport.

Returns

void

Inherited from

IViewport.setCameraNoEvent

Defined in

packages/core/src/RenderingEngine/Viewport.ts:823


setColorTransform()

protected setColorTransform(voiRange, averageWhite): any

This applies a color transform as an svg filter to the output image.

Parameters

voiRange: any

averageWhite: any

Returns

any

Inherited from

IViewport.setColorTransform

Defined in

packages/core/src/RenderingEngine/Viewport.ts:315


setDataList()

setDataList(_entries): void

Sets one or more datasets on the viewport. Legacy viewports should override this to delegate to their specific data setter.

Parameters

_entries: object[]

Returns

void

Inherited from

IViewport.setDataList

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2415


setDisplayArea()

setDisplayArea(displayArea, suppressEvents): void

Sets the camera to an initial bounds. If resetPan and resetZoom are true it places the focal point at the center of the volume (or slice); otherwise, only the camera zoom and camera Pan or Zoom is reset for the current view.

Parameters

displayArea: DisplayArea

The display area of interest.

suppressEvents: boolean = false

If true, don't fire displayArea event.

Returns

void

Inherited from

IViewport.setDisplayArea

Defined in

packages/core/src/RenderingEngine/Viewport.ts:893


setDisplayAreaFit()

protected setDisplayAreaFit(displayArea): void

This applies a display area with a fit of the provided area to the available area. The zoom level is controlled by the imageArea parameter, which is a pair of percentage width in the horizontal and vertical dimension is scaled to fit the displayable area. Both values are taken into account, and the scaling is set so that both fractions of the image area are visible.

The panning is controlled by the imageCanvasPoint, which has two values, teh imagePoint and the canvasPoint. They are fractional values of the image and canvas respectively, with the panning set to display the image pixel at the given fraction on top of the canvas at the given percentage. The default points are 0.5.

For example, if the zoom level is [2,1], then the image is displayed such that at least twice the width is visible, and the height is visible. That will result in the image width being black, divided up on the left and right according to the imageCanvasPoint

Then, if the imagePoint is [1,0] and the canvas point is [1,0], then the right most edge of the image, at the top of the image, will be displayed at the right most edge of the canvas, at the top.

Parameters

displayArea: DisplayArea

Returns

void

Inherited from

IViewport.setDisplayAreaFit

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1030


setDisplayAreaScale()

protected setDisplayAreaScale(displayArea): void

Sets the viewport to pixel scaling mode. Pixel scaling displays 1 image pixel as 1 (or scale) physical screen pixels. That is, a 1024x512 image will be displayed with scale=2, as 2048x1024 physical image pixels.

Parameters

displayArea: DisplayArea

display area to set

  • displayArea.scale - the number of physical pixels to display each image pixel in. Values < 1 mean smaller than physical, while values > 1 mean more than one pixel. Default is 1 Suggest using whole numbers or integer fractions (eg 1/3)

Returns

void

Inherited from

IViewport.setDisplayAreaScale

Defined in

packages/core/src/RenderingEngine/Viewport.ts:957


setDisplaySetPresentation()

setDisplaySetPresentation(props)

setDisplaySetPresentation(props): void

Parameters

props: unknown

Returns

void

Defined in

packages/core/src/types/IGenericViewport.ts:55

setDisplaySetPresentation(dataId, props)

setDisplaySetPresentation(dataId, props): void

Overload targeting a specific bound dataId (multi-volume / fusion); the single-argument form targets the viewport's default binding.

Parameters

dataId: string

props: unknown

Returns

void

Defined in

packages/core/src/types/IGenericViewport.ts:60


setDisplaySets()

setDisplaySets(...entries): Promise<void>

Records the display sets currently shown on the viewport. The base implementation only stores the entries so that getDisplaySets can report them; type-specific viewports override this to actually load the data (via their native setter such as setStack/setVolumes/setVideo), delegating to mountDisplaySets so the clear-then-record ordering is applied consistently.

Because the native data setters clear the recorded list (see clearDisplaySets), driving a viewport with a raw data setter - without going through setDisplaySets - leaves getDisplaySets() empty, correctly reflecting that the viewport is not display-set driven.

Parameters

• ...entries: object[]

the display set entries that were mounted; the first entry is the source and any subsequent entries are overlays.

Returns

Promise<void>

Overrides

IViewport.setDisplaySets

Defined in

packages/core/src/types/IGenericViewport.ts:50


setFitToCanvasCamera()

protected setFitToCanvasCamera(camera): void

Sets the provided camera as the displayArea camera. This allows computing differences applied later as compared to the initial position, for things like zoom and pan.

Parameters

camera: ICamera<number>

to store as the initial value.

Returns

void

Inherited from

IViewport.setFitToCanvasCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1325


setInitialCamera()

protected setInitialCamera(camera): void

Sets the provided camera as the initial camera. This allows computing differences applied later as compared to the initial position, for things like zoom and pan.

Parameters

camera: ICamera<number>

to store as the initial value.

Returns

void

Inherited from

IViewport.setInitialCamera

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1315


setInterpolationType()

protected setInterpolationType(_interpolationType, _arg?): void

Sets the interpolation type. No-op in the base.

Parameters

_interpolationType: InterpolationType

_arg?: any

Returns

void

Inherited from

IViewport.setInterpolationType

Defined in

packages/core/src/RenderingEngine/Viewport.ts:881


setNeedsRender()

setNeedsRender(): void

Mark the viewport as needing a render pass (e.g. after external display-set / segmentation updates). Does not queue a render; the rendering engine’s normal RAF cycle will pick this up.

Returns

void

Inherited from

IViewport.setNeedsRender

Defined in

packages/core/src/RenderingEngine/Viewport.ts:308


setOptions()

setOptions(options, immediate): void

Sets new options and (TODO) applies them.

Parameters

options: ViewportInputOptions

The viewport options to set.

immediate: boolean = false

If true, renders the viewport after the options are set.

Returns

void

Inherited from

IViewport.setOptions

Defined in

packages/core/src/RenderingEngine/Viewport.ts:379


setOrientationOfClippingPlanes()

setOrientationOfClippingPlanes(vtkPlanes, slabThickness, viewPlaneNormal, focalPoint): void

Parameters

vtkPlanes: vtkPlane[]

slabThickness: number

viewPlaneNormal: Point3

focalPoint: Point3

Returns

void

Inherited from

IViewport.setOrientationOfClippingPlanes

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1929


setPan()

setPan(pan, storeAsInitialCamera): void

Sets the canvas pan value relative to the initial view position of 0,0 Modifies the camera to perform the pan.

Parameters

pan: Point2

storeAsInitialCamera: boolean = false

Returns

void

Inherited from

IViewport.setPan

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1386


setRendered()

setRendered(): void

Indicate that the image has been rendered. This will set the viewportStatus to RENDERED if there is image data available to actually be rendered - otherwise, the rendering simply showed the background image.

Returns

void

Inherited from

IViewport.setRendered

Defined in

packages/core/src/RenderingEngine/Viewport.ts:294


setRotation()

protected setRotation(_rotation): void

Parameters

_rotation: number

Returns

void

Inherited from

IViewport.setRotation

Defined in

packages/core/src/RenderingEngine/Viewport.ts:198


setViewPresentation()

setViewPresentation(viewPres): void

Applies the display area, zoom, pan and rotation from the view presentation. No-op is viewPres isn't defined.

Parameters

viewPres: ViewPresentation

Returns

void

Inherited from

IViewport.setViewPresentation

Defined in

packages/core/src/RenderingEngine/Viewport.ts:2240


setViewReference()

setViewReference(viewReference): void

Applies a spatial reference (frame of reference + plane) to the current view state. Implemented across all Generic families via the base GenericViewport.

Parameters

viewReference: ViewReference

Returns

void

Overrides

IViewport.setViewReference

Defined in

packages/core/src/types/IGenericViewport.ts:72


setViewState()

setViewState(viewStatePatch): void

Parameters

viewStatePatch: unknown

Returns

void

Defined in

packages/core/src/types/IGenericViewport.ts:62


setZoom()

setZoom(value, storeAsInitialCamera): void

Zooms the image using parallel scale by updating the camera value.

Parameters

value: number

The relative parallel scale to apply. It is relative to the initial offsets value.

storeAsInitialCamera: boolean = false

can be set to true to reset the camera after applying this zoom as the initial camera. A subsequent getZoom call will return "1", but the zoom will have been applied.

Returns

void

Inherited from

IViewport.setZoom

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1437


triggerCameraModifiedEventIfNecessary()

triggerCameraModifiedEventIfNecessary(previousCamera, updatedCamera): void

Trigger camera modified event

Parameters

previousCamera: ICamera<number>

updatedCamera: ICamera<number>

Returns

void

Inherited from

IViewport.triggerCameraModifiedEventIfNecessary

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1851


updateCameraClippingPlanesAndRange()

updateCameraClippingPlanesAndRange(): void

Updates the camera's clipping planes and range.

Returns

void

Inherited from

IViewport.updateCameraClippingPlanesAndRange

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1871


updateClippingPlanesForActors()

protected updateClippingPlanesForActors(updatedCamera): Promise<void>

Updates the actors clipping planes orientation from the camera properties

Parameters

updatedCamera: ICamera<number>

ICamera

Returns

Promise<void>

Inherited from

IViewport.updateClippingPlanesForActors

Defined in

packages/core/src/RenderingEngine/Viewport.ts:1881


updateViewState()

updateViewState(updater): void

Parameters

updater: unknown

Returns

void

Defined in

packages/core/src/types/IGenericViewport.ts:64