Skip to content

Class: SliceController

Defined in: src/display/SliceController.ts:18

The SliceController handles user input events related to slice navigation.

  • We track mouse movement to update mouse coordinates (image, voxel, world).
  • We handle mouse clicks to update the model's crosshair coordinate, causing the slice to re-center or reslice as appropriate.

Implements

Constructors

Constructor

ts
new SliceController(
   model, 
   view, 
   neuroSpace, 
   viewAxes): SliceController;

Defined in: src/display/SliceController.ts:58

Parameters

model

SliceModel

view

SliceView

neuroSpace

NeuroSpace

viewAxes

AxisSet3D

Returns

SliceController

Properties

mouseImagePosition

ts
mouseImagePosition: 
  | {
  x: number;
  y: number;
}
  | null = null;

Defined in: src/display/SliceController.ts:28

(1) The local 2D slice coordinate [x, y], in the "slice" plane (pixels).

Implementation of

ISliceController.mouseImagePosition


mouseVolumeCoordinate

ts
mouseVolumeCoordinate: number[] | null = null;

Defined in: src/display/SliceController.ts:35

(2) The pinned-volume coordinate [i, j, k] in voxel space, as returned by sliceToVolumeCoord(...). This might be fractional if partial pixels are selected.

Implementation of

ISliceController.mouseVolumeCoordinate


mouseWorldCoordinate

ts
mouseWorldCoordinate: number[] | null = null;

Defined in: src/display/SliceController.ts:41

(3) The original "world" coordinate [X, Y, Z] in real-world mm, i.e. un-pinned "raw" NeuroSpace.

Implementation of

ISliceController.mouseWorldCoordinate

Methods

setEnabled()

ts
setEnabled(enabled): void;

Defined in: src/display/SliceController.ts:253

Enable or disable the controller

Parameters

enabled

boolean

Returns

void

Implementation of

ISliceController.setEnabled


isEnabled()

ts
isEnabled(): boolean;

Defined in: src/display/SliceController.ts:260

Check if the controller is enabled

Returns

boolean

Implementation of

ISliceController.isEnabled


dispose()

ts
dispose(): void;

Defined in: src/display/SliceController.ts:267

Cleans up event listeners.

Returns

void

Implementation of

ISliceController.dispose

Released under the MIT License.