Skip to main content

Class: VoxelManager<T>

This is a simple, standard interface to values associated with a voxel.

Type Parameters

T

Constructors

new VoxelManager()

new VoxelManager<T>(dimensions, _get, _set?): VoxelManager<T>

Creates a generic voxel value accessor, with access to the values provided by the _get and optionally _set values.

Parameters

dimensions: any

for the voxel volume

_get

called to get a value by index

_set?

called when setting a value

Returns

VoxelManager<T>

Defined in

packages/core/src/utilities/VoxelManager.ts:70

Properties

_get()

_get: (index) => T

Parameters

index: number

Returns

T

Defined in

packages/core/src/utilities/VoxelManager.ts:53


_getConstructor()?

optional _getConstructor: () => (length) => PixelDataTypedArray

Returns

Function

Parameters

length: number

Returns

PixelDataTypedArray

Defined in

packages/core/src/utilities/VoxelManager.ts:55


_getScalarData()?

optional _getScalarData: () => PixelDataTypedArray

Returns

PixelDataTypedArray

Defined in

packages/core/src/utilities/VoxelManager.ts:57


_getScalarDataLength()?

optional _getScalarDataLength: () => number

Returns

number

Defined in

packages/core/src/utilities/VoxelManager.ts:56


_getSliceData()

_getSliceData: (args) => PixelDataTypedArray

Parameters

args

args.sliceIndex: number

args.slicePlane: number

Returns

PixelDataTypedArray

Defined in

packages/core/src/utilities/VoxelManager.ts:58


_set()

_set: (index, v) => boolean

Parameters

index: number

v: T

Returns

boolean

Defined in

packages/core/src/utilities/VoxelManager.ts:54


dimensions

readonly dimensions: Point3

Defined in

packages/core/src/utilities/VoxelManager.ts:38


frameSize

frameSize: number

Defined in

packages/core/src/utilities/VoxelManager.ts:52


getCompleteScalarDataArray()?

optional getCompleteScalarDataArray: () => ArrayLike<number>

Returns

ArrayLike<number>

Defined in

packages/core/src/utilities/VoxelManager.ts:40


getRange()

getRange: () => [number, number]

Returns

[number, number]

Defined in

packages/core/src/utilities/VoxelManager.ts:43


isInObject()

isInObject: (pointLPS, pointIJK) => boolean

Parameters

pointLPS: any

pointIJK: any

Returns

boolean

Defined in

packages/core/src/utilities/VoxelManager.ts:37


map

map: Map<number, T> | IRLEVoxelMap<T>

Defined in

packages/core/src/utilities/VoxelManager.ts:35


modifiedSlices

modifiedSlices: Set<number>

Defined in

packages/core/src/utilities/VoxelManager.ts:28


numberOfComponents

numberOfComponents: number = 1

Defined in

packages/core/src/utilities/VoxelManager.ts:39


points

points: Set<number>

Defined in

packages/core/src/utilities/VoxelManager.ts:50


setCompleteScalarDataArray()?

optional setCompleteScalarDataArray: (scalarData) => void

Parameters

scalarData: ArrayLike<number>

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:41


sourceVoxelManager

sourceVoxelManager: IVoxelManager<T>

Defined in

packages/core/src/utilities/VoxelManager.ts:36


static

static: any

Defined in

packages/core/src/utilities/VoxelManager.ts:1241


width

width: number

Defined in

packages/core/src/utilities/VoxelManager.ts:51

Accessors

bytePerVoxel

get bytePerVoxel(): number

Returns

number

Defined in

packages/core/src/utilities/VoxelManager.ts:411


sizeInBytes

get sizeInBytes(): number

Returns

number

Defined in

packages/core/src/utilities/VoxelManager.ts:407

Methods

addPoint()

addPoint(point): void

Adds a point as an array or an index value to the set of points associated with this voxel value. Can be used for tracking clicked points or other modified values.

Parameters

point: number | Point3

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:500


clear()

clear(): void

Clears any map specific data, as well as the modified slices, points and bounds.

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:425


forEach()

forEach(callback, options): any[]

Iterates over the voxels in the VoxelManager and applies a callback function to each voxel. It can operate on IJK and LPS coordinate systems, and it can be limited to a specific region of the data if the isInObject function is provided.

For the LPS calculations, both direction and spacing should be provided.

If the boundsIJK is not provided, the iteration will be over the entire volume/data

If the VoxelManager is backed by a Map, it will only iterate over the stored values. Otherwise, it will iterate over all voxels within the specified or default bounds.

Parameters

callback

options = {}

options.boundsIJK?: BoundsIJK

options.imageData?: vtkImageData | CPUImageData

options.isInObject?

options.returnPoints?: boolean

Returns

any[]

Defined in

packages/core/src/utilities/VoxelManager.ts:193


getArrayOfModifiedSlices()

getArrayOfModifiedSlices(): number[]

Returns

number[]

The array of modified k indices

Defined in

packages/core/src/utilities/VoxelManager.ts:461


getAtIJK()

getAtIJK(i, j, k): T

Gets the voxel value at position i,j,k. This method should be used in favor of getAtIJKPoint when performance is a concern.

Parameters

i: any

j: any

k: any

Returns

T

Defined in

packages/core/src/utilities/VoxelManager.ts:86


getAtIJKPoint()

getAtIJKPoint(__namedParameters): T

Gets the voxel value at the given Point3 location.

Parameters

__namedParameters: [any, any, any]

Returns

T

Defined in

packages/core/src/utilities/VoxelManager.ts:111


getAtIndex()

getAtIndex(index): T

Gets the value at the given index.

Parameters

index: any

Returns

T

Defined in

packages/core/src/utilities/VoxelManager.ts:125


getBoundsIJK()

getBoundsIJK(): BoundsIJK

Gets the bounds for the modified set of values.

Returns

BoundsIJK

Defined in

packages/core/src/utilities/VoxelManager.ts:173


getConstructor()

getConstructor(): (length) => PixelDataTypedArray

Returns

Function

Parameters

length: number

Returns

PixelDataTypedArray

Defined in

packages/core/src/utilities/VoxelManager.ts:437


getDefaultBounds()

getDefaultBounds(): BoundsIJK

Returns

BoundsIJK

Defined in

packages/core/src/utilities/VoxelManager.ts:166


getMiddleSliceData()

getMiddleSliceData(): PixelDataTypedArray

Returns

PixelDataTypedArray

Defined in

packages/core/src/utilities/VoxelManager.ts:151


getPoints()

getPoints(): Point3[]

Gets the list of added points as an array of Point3 values

Returns

Point3[]

Defined in

packages/core/src/utilities/VoxelManager.ts:513


getScalarData()

getScalarData(): PixelDataTypedArray

Retrieves the scalar data. If the scalar data is already available, it will be returned. Otherwise, if the _getScalarData method is defined, it will be called to retrieve the scalar data. If neither the scalar data nor the _getScalarData method is available, an error will be thrown.

Returns

PixelDataTypedArray

The scalar data.

Throws

If no scalar data is available.

Defined in

packages/core/src/utilities/VoxelManager.ts:373


getScalarDataLength()

getScalarDataLength(): number

Gets the length of the scalar data.

Returns

number

The length of the scalar data.

Throws

If no scalar data is available.

Defined in

packages/core/src/utilities/VoxelManager.ts:395


getSliceData()

getSliceData(sliceViewInfo): PixelDataTypedArray

Retrieves the slice data for a given slice view.

Parameters

sliceViewInfo

An object containing information about the slice view.

sliceViewInfo.sliceIndex: number

The index of the slice.

sliceViewInfo.slicePlane: number

The axis of the slice (0 for YZ plane, 1 for XZ plane, 2 for XY plane).

Returns

PixelDataTypedArray

A typed array containing the pixel data for the specified slice.

Throws

Error if an invalid slice axis is provided.

Defined in

packages/core/src/utilities/VoxelManager.ts:528


resetModifiedSlices()

resetModifiedSlices(): void

Resets the set of modified slices. This method clears all entries from the modifiedSlices set, effectively marking all slices as unmodified.

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:470


setAtIJK()

setAtIJK(i, j, k, v): boolean

Sets the voxel value at position i,j,k and records the slice that was modified.

This method should be used in favor of setAtIJKPoint when performance is a concern.

Parameters

i: number

j: number

k: number

v: any

Returns

boolean

Defined in

packages/core/src/utilities/VoxelManager.ts:97


setAtIJKPoint()

setAtIJKPoint(__namedParameters, v): void

Sets the voxel value at the given point3 location to the specified value. Records the z index modified. Will record the index value if the VoxelManager is backed by a map.

Parameters

__namedParameters: Point3

v: any

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:118


setAtIndex()

setAtIndex(index, v): boolean

Sets the value at the given index

Parameters

index: any

v: any

Returns

boolean

Defined in

packages/core/src/utilities/VoxelManager.ts:130


setScalarData()

setScalarData(newScalarData): void

Parameters

newScalarData: PixelDataTypedArray

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:385


toIJK()

toIJK(index): Point3

Converts an index value to a Point3 IJK value

Parameters

index: number

Returns

Point3

Defined in

packages/core/src/utilities/VoxelManager.ts:143


toIndex()

toIndex(ijk): number

Converts an IJK Point3 value to an index value

Parameters

ijk: Point3

Returns

number

Defined in

packages/core/src/utilities/VoxelManager.ts:162


addBounds()

static addBounds(bounds, point): void

Extends the bounds of this object to include the specified point

Parameters

bounds: BoundsIJK

point: Point3

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:477


addInstanceToImage()

static addInstanceToImage(image): void

This method adds a voxelManager instance to the image object where the object added is of type:

  1. RLE map if the scalar data is missing or too small (dummy data)
  2. Volume VoxelManager scalar data representations

Parameters

image: IImage

Returns

void

Defined in

packages/core/src/utilities/VoxelManager.ts:1210


createHistoryVoxelManager()

static createHistoryVoxelManager<T>(__namedParameters): VoxelManager<T>

Creates a history remembering voxel manager. This will remember the original values in the voxels, and will apply the update to the underlying source voxel manager.

Type Parameters

T

Parameters

__namedParameters

__namedParameters.sourceVoxelManager: VoxelManager<T>

Returns

VoxelManager<T>

Defined in

packages/core/src/utilities/VoxelManager.ts:1114


createImageVolumeVoxelManager()

static createImageVolumeVoxelManager(__namedParameters): IVoxelManager<number> | IVoxelManager<RGB>

Creates a VoxelManager for an image volume. which are those volumes that are composed of multiple images, one for each slice.

Parameters

__namedParameters

__namedParameters.dimensions: Point3

__namedParameters.imageIds: string[]

__namedParameters.numberOfComponents: number = 1

Returns

IVoxelManager<number> | IVoxelManager<RGB>

A VoxelManager instance for the image volume.

Defined in

packages/core/src/utilities/VoxelManager.ts:660


createImageVoxelManager()

static createImageVoxelManager(__namedParameters): IVoxelManager<number> | IVoxelManager<RGB>

Parameters

__namedParameters

__namedParameters.height: number

__namedParameters.numberOfComponents?: number = 1

__namedParameters.scalarData: PixelDataTypedArray

__namedParameters.width: number

Returns

IVoxelManager<number> | IVoxelManager<RGB>

Defined in

packages/core/src/utilities/VoxelManager.ts:1019


createLazyVoxelManager()

static createLazyVoxelManager<T>(__namedParameters): VoxelManager<T>

Creates a lazy voxel manager that will create an image plane as required for each slice of a volume as it gets changed. This can be used to store image data that gets created as required.

Type Parameters

T

Parameters

__namedParameters

__namedParameters.dimensions: Point3

__namedParameters.planeFactory

Returns

VoxelManager<T>

Defined in

packages/core/src/utilities/VoxelManager.ts:1149


createMapVoxelManager()

static createMapVoxelManager<T>(__namedParameters): IVoxelManager<T>

Creates a volume map value accessor. This is initially empty and the map stores the index to value instances. This is useful for sparse matrices containing pixel data.

Type Parameters

T

Parameters

__namedParameters

__namedParameters.dimension: Point3

Returns

IVoxelManager<T>

Defined in

packages/core/src/utilities/VoxelManager.ts:1094


createRLEVoxelManager()

static createRLEVoxelManager<T>(__namedParameters): VoxelManager<T>

Creates a RLE based voxel manager. This is effective for storing segmentation maps or already RLE encoded data such as ultrasounds.

Type Parameters

T

Parameters

__namedParameters

__namedParameters.dimensions: Point3

Returns

VoxelManager<T>

Defined in

packages/core/src/utilities/VoxelManager.ts:1182


createScalarDynamicVolumeVoxelManager()

static createScalarDynamicVolumeVoxelManager(__namedParameters): IVoxelManager<number> | IVoxelManager<RGB>

Parameters

__namedParameters

__namedParameters.dimensions: Point3

__namedParameters.imageIdGroups: string[][]

__namedParameters.numberOfComponents?: number = 1

__namedParameters.timePoint: number = 0

Returns

IVoxelManager<number> | IVoxelManager<RGB>

Defined in

packages/core/src/utilities/VoxelManager.ts:920


createScalarVolumeVoxelManager()

static createScalarVolumeVoxelManager(__namedParameters): IVoxelManager<number> | IVoxelManager<RGB>

Creates a volume value accessor, based on a volume scalar data instance. This also works for image value accessors for single plane (k=0) accessors.

This should be deprecated in favor of the createImageVolumeVoxelManager method since that one does not need to know the number of scalar data and it creates them on the fly.

Parameters

__namedParameters

__namedParameters.dimensions: Point3

__namedParameters.numberOfComponents?: number = 1

__namedParameters.scalarData: any

Returns

IVoxelManager<number> | IVoxelManager<RGB>

Defined in

packages/core/src/utilities/VoxelManager.ts:877