Skip to content

Class: OrthogonalImageViewer ​

Defined in: src/display/OrthogonalImageViewer.ts:143

OrthogonalImageViewer manages three simultaneous SliceViewers (Axial, Coronal, Sagittal), each displaying a different orientation of the same data. The user can interact with any sub-view to change the shared coordinate, updating the other sub-views in sync.

All the sub-viewers are arranged in a grid layout. The class handles:

  • Creating the DOM elements for each view.
  • Initializing and disposing the sub-viewers.
  • Synchronizing the position (currentCoord) among the sub-viewers.
  • Handling window resize events and re-drawing each view.
  • Reactively updating the sub-viewers if the user adjusts slice indices in any one viewer.

Implements ​

Properties ​

currentCoord ​

ts
currentCoord: number[];

Defined in: src/display/OrthogonalImageViewer.ts:148

The current 3D coordinate shared by all sub-viewers. This is updated whenever one of the SliceViewers changes its currentCoord.

Implementation of ​

ViewerStateInfo.currentCoord

Accessors ​

mouseState ​

Get Signature ​

ts
get mouseState(): object;

Defined in: src/display/OrthogonalImageViewer.ts:1075

Exposes the current mouse state as a computed property for external read-only usage. This includes which sub-view triggered it, the 2D image coordinate, and the 3D volume coordinate.

Returns ​

object

viewName ​
ts
viewName: string | null;
imageCoordinate ​
ts
imageCoordinate: 
  | {
  x: number;
  y: number;
}
  | null;
volumeCoordinate ​
ts
volumeCoordinate: number[] | null;
worldCoordinate ​
ts
worldCoordinate: number[] | null;

Information about the current mouse position and related coordinates. Contains details about which view the mouse is over and coordinates in both 2D (image) and 3D (volume) space.

Implementation of ​

ViewerStateInfo.mouseState


sliceIndices ​

Get Signature ​

ts
get sliceIndices(): Record<ViewName, number>;

Defined in: src/display/OrthogonalImageViewer.ts:1088

Returns an object with slice indices for each view.

Returns ​

Record<ViewName, number>

Information about current slice indices in different orientations. For single-slice viewers, this may have only one relevant property. For orthogonal viewers, it has properties for each orientation.

Implementation of ​

ViewerStateInfo.sliceIndices


totalSlices ​

Get Signature ​

ts
get totalSlices(): Record<ViewName, number>;

Defined in: src/display/OrthogonalImageViewer.ts:1101

Returns the total number of slices available in each view.

Returns ​

Record<ViewName, number>

Information about the total number of slices available in each view. For single-slice viewers, this may have only one property. For orthogonal viewers, it has properties for each orientation.

Implementation of ​

ViewerStateInfo.totalSlices


viewOrientation ​

Get Signature ​

ts
get viewOrientation(): Record<ViewName, any>;

Defined in: src/display/OrthogonalImageViewer.ts:1114

Returns the view orientation information for each view.

Returns ​

Record<ViewName, any>

The axis orientation(s) currently being displayed. For SliceViewer, this is a single AxisSet3D. For OrthogonalImageViewer, this could be a record of orientations by view name.

Implementation of ​

ViewerStateInfo.viewOrientation


scale ​

Get Signature ​

ts
get scale(): Record<ViewName, number>;

Defined in: src/display/OrthogonalImageViewer.ts:1122

Returns the current scale/zoom level for each view.

Returns ​

Record<ViewName, number>

The current scaling/zoom level of the viewer(s). For single-slice viewers, this is a single value. For orthogonal viewers, it may have multiple values by view name.

Implementation of ​

ViewerStateInfo.scale


viewerType ​

Get Signature ​

ts
get viewerType(): string;

Defined in: src/display/OrthogonalImageViewer.ts:1135

Identifies this as an orthogonal viewer.

Returns ​

string

Identifies the type of viewer. Useful for UI components that need to adapt based on viewer type.

Implementation of ​

ViewerStateInfo.viewerType


visibleLayers ​

Get Signature ​

ts
get visibleLayers(): object[];

Defined in: src/display/OrthogonalImageViewer.ts:1143

Returns information about visible layers.

Returns ​

object[]

Information about which layers are currently visible/active. This can include layer IDs, opacity values, etc.

Implementation of ​

ViewerStateInfo.visibleLayers

Methods ​

create() ​

ts
static create(params): Promise<OrthogonalImageViewer>;

Defined in: src/display/OrthogonalImageViewer.ts:257

Creates an OrthogonalImageViewer, asynchronously building its sub-viewers.

Parameters ​

params ​

OrthogonalImageViewerParams

Contains the container HTMLElement, imageLayer, and viewer options.

Returns ​

Promise<OrthogonalImageViewer>

A fully-initialized instance of OrthogonalImageViewer.


setWorldCoord() ​

ts
setWorldCoord(coord): void;

Defined in: src/display/OrthogonalImageViewer.ts:456

Programmatically set the shared world coordinate for all sub-views.

Parameters ​

coord ​

number[]

Returns ​

void


setCrosshairVisible() ​

ts
setCrosshairVisible(visible): void;

Defined in: src/display/OrthogonalImageViewer.ts:577

Toggle crosshair overlay at runtime across all sub-views.

Parameters ​

visible ​

boolean

Returns ​

void


getLegendElement() ​

ts
getLegendElement(): HTMLElement | null;

Defined in: src/display/OrthogonalImageViewer.ts:637

The empty fourth cell of the 'ortho' layout, for a host-supplied legend or readout. Null for other layouts.

Returns ​

HTMLElement | null


setFitBounds() ​

ts
setFitBounds(bounds): void;

Defined in: src/display/OrthogonalImageViewer.ts:647

Fits every view to a 3-D box of reference-grid voxel indices (inclusive), e.g. the head's bounding box, instead of the full field of view. In the 'ortho' layout the tracks follow the box's extents, so all views keep one shared scale. Pass null to fit the whole volume again.

Parameters ​

bounds ​

| { min: number[]; max: number[]; } | null

Returns ​

void


setStackedView() ​

ts
setStackedView(view): void;

Defined in: src/display/OrthogonalImageViewer.ts:699

Chooses the view shown when the 'ortho' layout is stacked in 'single' mode.

Parameters ​

view ​

| ViewName | "axial" | "coronal" | "sagittal"

Returns ​

void


isStacked() ​

ts
isStacked(): boolean;

Defined in: src/display/OrthogonalImageViewer.ts:705

Whether the 'ortho' layout is currently stacked (narrow container).

Returns ​

boolean


setFocusedView() ​

ts
setFocusedView(viewName): void;

Defined in: src/display/OrthogonalImageViewer.ts:809

Sets which view receives keyboard input for slice navigation.

Parameters ​

viewName ​

ViewName | null

The view to focus ('axial', 'coronal', or 'sagittal')

Returns ​

void


setOrientationLabelsVisible() ​

ts
setOrientationLabelsVisible(visible, options?): void;

Defined in: src/display/OrthogonalImageViewer.ts:819

Toggle anatomical orientation labels (L/R/A/P/S/I) across all three views.

Parameters ​

visible ​

boolean

Whether the labels should be shown.

options? ​

OrientationLabelOptions

Optional styling applied to every sub-view.

Returns ​

void


setBackground() ​

ts
setBackground(color, alpha?): void;

Defined in: src/display/OrthogonalImageViewer.ts:831

Changes the canvas clear colour of every view in place (no rebuild).

Parameters ​

color ​

number

PIXI numeric colour.

alpha? ​

number

Optional clear alpha in [0, 1].

Returns ​

void


setCrosshairStyle() ​

ts
setCrosshairStyle(options): void;

Defined in: src/display/OrthogonalImageViewer.ts:840

Restyles the crosshair of every view in place (colour, alpha, halo, width, gap). Omitted fields keep their current value.

Parameters ​

options ​

CrossHairOptions

Returns ​

void


setOrientationLabelStyle() ​

ts
setOrientationLabelStyle(options): void;

Defined in: src/display/OrthogonalImageViewer.ts:849

Restyles the orientation labels of every view in place. Omitted fields keep their current value.

Parameters ​

options ​

OrientationLabelOptions

Returns ​

void


setTheme() ​

ts
setTheme(theme): void;

Defined in: src/display/OrthogonalImageViewer.ts:859

Applies a (partial) theme — background, crosshair and orientation-label colours — to every view without rebuilding the viewer, e.g. when the host switches between a light and a dark ground.

Parameters ​

theme ​

ViewerTheme

Returns ​

void


getImageLayer() ​

ts
getImageLayer(): ImageLayer;

Defined in: src/display/OrthogonalImageViewer.ts:993

Gets the underlying ImageLayer used by these sub-viewers, which provides the actual volume data stack.

Returns ​

ImageLayer


applyToImageLayers() ​

ts
applyToImageLayers(handler): void;

Defined in: src/display/OrthogonalImageViewer.ts:997

Parameters ​

handler ​

(layer) => void

Returns ​

void


getSliceViewer() ​

ts
getSliceViewer(viewName): SliceViewer;

Defined in: src/display/OrthogonalImageViewer.ts:1009

Retrieves the SliceViewer corresponding to one of the standard views.

Parameters ​

viewName ​

"axial" | "coronal" | "sagittal"

e.g. 'axial', 'coronal', or 'sagittal'.

Returns ​

SliceViewer


dispose() ​

ts
dispose(): void;

Defined in: src/display/OrthogonalImageViewer.ts:1017

Cleans up all sub-viewers and DOM elements, removing them from the container, and unsubscribes from MobX reactions.

Returns ​

void

Released under the MIT License.