Skip to main content

Class: RLEVoxelMap<T>

RLE based implementation of a voxel map. This can be used as single or multi-plane, as the underlying indexes are mapped to rows and hte rows are indexed started at 0 and continuing incrementing for all rows in the multi-plane voxel.

Type Parameters

T

Constructors

new RLEVoxelMap()

new RLEVoxelMap<T>(width, height, depth): RLEVoxelMap<T>

Parameters

width: number

height: number

depth: number = 1

Returns

RLEVoxelMap<T>

Defined in

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

Properties

defaultValue

defaultValue: T

The default value returned for get. This allows treting the voxel map more like scalar data, returning the right default value for unset values. Set to 0 by default, but any maps where 0 not in T should update this value.

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:44


depth

protected depth: number = 1

The number of image planes stored (the depth of the indices), with the k index going from 0...depth.

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:26


height

protected height: number = 1

The height of the images stored in the voxel map (eg the height of each plane)

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:19


jMultiple

protected jMultiple: number = 1

A multiplier value to go from j values to overall index values.

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:30


kMultiple

protected kMultiple: number = 1

A multiplier value to go from k values to overall index values.

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:34


numberOfComponents

protected numberOfComponents: number = 1

Number of components in the value

Defined in

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


pixelDataConstructor

pixelDataConstructor: Uint8ArrayConstructor = Uint8Array

The constructor for creating pixel data.

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:49


rows

protected rows: Map<number, RLERun<T>[]>

The rows for the voxel map is a map from the j index location (or for volumes, j + k*height) to a list of RLE runs. That is, each entry in the rows specifies the voxel data for a given row in the image. Then, the RLE runs themselves specify the pixel values for given rows as a pair of start/end indices, plus the value to apply.

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:17


width

protected width: number = 1

The width of the image planes

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:21

Methods

clear()

clear(): void

Clears all entries.

Returns

void

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:233


findIndex()

protected findIndex(row, i): number

Finds the index in the row that i is contained in, OR that i would be before. That is, the rle value for the returned index in that row has i ε [start,end) if a direct RLE is found, or i ε [end_-1,start) if in the prefix. If no RLE is found with that index, then i ε [end_final,length)

Parameters

row: RLERun<T>[]

i: number

Returns

number

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:96


get()

get(index): T

Gets the value encoded in the map at the given index, which is an integer [i,j,k] voxel index, equal to index=i+(j+k*height)*width value (eg a standard ScalarData index for stack/volume single component indices.)

Returns defaultValue if the RLE value is not found.

Parameters

index: number

Returns

T

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:67


getPixelData()

getPixelData(k, pixelData?): PixelDataTypedArray

Gets the pixel data into the provided pixel data array, or creates one according to the assigned type.

Parameters

k: number = 0

pixelData?: PixelDataTypedArray

Returns

PixelDataTypedArray

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:249


getRLE()

protected getRLE(i, j, k): RLERun<T>

Gets a list of RLERun values which specify the data on the row j This allows applying or modifying the run directly. See CanvasActor for an example in the RLE rendering.

Parameters

i: number

j: number

k: number = 0

Returns

RLERun<T>

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:79


getRun()

getRun(j, k): RLERun<T>[]

Gets the run for the given j,k indices. This is used to allow fast access to runs for data for things like rendering entire rows of data.

Parameters

j: number

k: number

Returns

RLERun<T>[]

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:110


keys()

keys(): number[]

Gets the set of key entries - that is j values. This may include j>=height, where j = key % height, and k = Math.floor(j / height)

Returns

number[]

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:241


set()

set(index, value): void

Adds to the RLE at the given position. This is unfortunately fairly complex since it is desirable to minimize the number of runs, but to still allow it to be efficient.

Parameters

index: number

value: T

Returns

void

Defined in

packages/core/src/utilities/RLEVoxelMap.ts:120