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:117

Properties​

defaultValue​

defaultValue: T

The default value returned for get. This allows treating 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:98


depth​

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:80


height​

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:73


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:84


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:88


normalizer​

normalizer: PlaneNormalizer

Defined in​

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


numComps​

protected numComps: number = 1

Number of components in the value

Defined in​

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


pixelDataConstructor​

pixelDataConstructor: Uint8ArrayConstructor = Uint8Array

The constructor for creating pixel data.

Defined in​

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


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:71


updateScalarData()​

updateScalarData: (scalarData) => void

Update the scalar data with the current RLE state

Parameters​

• scalarData: PixelDataTypedArray

old scalar data to update

Returns​

void

Defined in​

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


width​

width: number = 1

The width of the image planes

Defined in​

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


getScalarData()​

static getScalarData: (ArrayType) => Uint8ClampedArray

This is a function on the voxel manager, to get the RLE scalar data.

Parameters​

• ArrayType: Uint8ClampedArrayConstructor = Uint8ClampedArray

Returns​

Uint8ClampedArray

an array of the given type for the data.

Defined in​

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

Methods​

clear()​

clear(): void

Clears all entries.

Returns​

void

Defined in​

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


delete()​

delete(index): void

Delete any value at the given index;

Parameters​

• index: number

Returns​

void

Defined in​

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


fillFrom()​

fillFrom(getter, boundsIJK): void

Fills an RLE from a given getter result, skipping undefined values only.

Parameters​

• getter

a function taking i,j,k values (indices) and returning the new value at the given point.

• boundsIJK: BoundsIJK

a set of boundary values to flood up to and including both values.

Returns​

void

Defined in​

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


findAdjacents()​

findAdjacents(item, options): any[]

Finds adjacent RLE runs, in all directions. The planar value (true by default) does plane at a time fills.

Parameters​

• item: [RLERun<T>, number, number, Point3[]?]

an RLE being sepecified to find adjacent values for

• options

see floodFill

• options.diagonals: boolean = true

• options.planar: boolean = true

• options.singlePlane: boolean = false

Returns​

any[]

Defined in​

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


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:253


floodFill()​

floodFill(i, j, k, value, options?): number

Performs a flood fill on the RLE values at the given position, replacing the current value with the new value (which must be different) Note that this is, by default, a planar fill, which will fill each plane given the starting point, in a true flood fill fashion, but then not re-fill the given plane.

Parameters​

• i: number

• j: number

• k: number

• value: T

to replace the existing value with. Must be different from the starting value.

• options?

to control the flood.

  • planar means to flood the current k plane entirely, and then use the points from the current plane as seed points in the k+1 and k-1 planes, but not returning to the current plane
  • singlePlane is just a single k plane, not filling any other planes
  • diagonals means to use the diagonally adjacent points.

• options.diagonals?: boolean

• options.planar?: boolean

• options.singlePlane?: boolean

Returns​

number

Defined in​

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


forEach()​

forEach(callback, options?): void

For each RLE element, call the given callback

Parameters​

• callback: any

• options?

• options.rowModified?: boolean

Returns​

void

Defined in​

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


forEachRow()​

forEachRow(callback): void

For each row, call the callback with the base index and the row data

Parameters​

• callback: any

Returns​

void

Defined in​

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


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:158


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:429


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:181


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:289


has()​

has(index): boolean

Indicate if the map has the given value

Parameters​

• index: number

Returns​

boolean

Defined in​

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


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:421


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:299


toIJK()​

toIJK(index): Point3

Parameters​

• index: number

Returns​

Point3

Defined in​

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


toIndex()​

toIndex(__namedParameters): number

Parameters​

• __namedParameters: Point3

Returns​

number

Defined in​

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


copyMap()​

static copyMap<T>(destination, source): void

Copies the data in source into the map.

Type Parameters​

• T

Parameters​

• destination: RLEVoxelMap<T>

• source: RLEVoxelMap<T>

Returns​

void

Defined in​

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