Class: CompositeVoxelManager<T>
A simple, standard interface to the values associated with a voxel.
This interface is STRUCTURAL. VoxelManager implements it, and so can any
other object - a composite that holds several sub voxel managers, for
example. An earlier version of this file aliased the class
(export type IVoxelManager<T> = VoxelManager<T>), and an alias admits only
a subclass.
Four members are optional, and they are optional for a reason. They are not methods of the class. They are function-valued properties that a factory installs on the instance after the constructor returns, and only some of the factories install them:
getCompleteScalarDataArraysetCompleteScalarDataArrayinvalidateCachegetRange
VoxelManager.createScalarVolumeVoxelManager and
VoxelManager.createImageVoxelManager install none of the four, so a call to
getRange() on one of those instances throws a TypeError.
A caller that holds a VOLUME voxel manager does not need a guard. Use IVolumeVoxelManager for that case, and see the note on that interface.
Type Parameters
• T
Implements
Constructors
new CompositeVoxelManager()
new CompositeVoxelManager<
T>(__namedParameters):CompositeVoxelManager<T>
Parameters
• __namedParameters: CompositeVoxelManagerOptions<T>
Returns
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:915
Properties
primary
readonlyprimary:IVoxelManager<T>
The representation that defines the index space of the composite.
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:913
Accessors
_get
get_get(): (index) =>T
Gets the value at a flat index. The factory supplies this function.
Returns
Function
Parameters
• index: number
Returns
T
Gets the value at a flat index. The factory supplies this function.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1761
_getConstructor
get_getConstructor(): () => (length) =>PixelDataTypedArray
Gives the typed array constructor that the data expands to.
Returns
Function
Returns
Function
Parameters
• length: number
Returns
Gives the typed array constructor that the data expands to.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1767
_getScalarData
get_getScalarData(): () =>ArrayLike<number>
Produces the scalar data, for a voxel manager that stores no array.
Returns
Function
Returns
ArrayLike<number>
Produces the scalar data, for a voxel manager that stores no array.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1773
_getScalarDataLength
get_getScalarDataLength(): () =>number
Gives the length of the array that getScalarData produces.
Returns
Function
Returns
number
Gives the length of the array that getScalarData produces.
Implementation of
IVoxelManager._getScalarDataLength
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1770
_getSliceData
get_getSliceData(): (args) =>PixelDataTypedArray
Produces the data of one slice, for a voxel manager that already holds the
values of that slice together. getSliceData calls this member first.
Returns
Function
Parameters
• args
• args.sliceIndex: number
• args.slicePlane: number
Returns
Produces the data of one slice, for a voxel manager that already holds the
values of that slice together. getSliceData calls this member first.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1779
_set
get_set(): (index,v) =>boolean
Sets the value at a flat index. The factory supplies this function.
Returns
Function
Parameters
• index: number
• v: T
Returns
boolean
Sets the value at a flat index. The factory supplies this function.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1764
_updateScalarData
get_updateScalarData(): (scalarData) =>PixelDataTypedArray
Refreshes an array that a caller holds from the sparse store.
Returns
Function
Parameters
• scalarData: ArrayLike<number>
Returns
Refreshes an array that a caller holds from the sparse store.
Implementation of
IVoxelManager._updateScalarData
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1776
bytePerVoxel
getbytePerVoxel():number
The number of bytes in one voxel.
Returns
number
The number of bytes in one voxel.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1758
dimensions
getdimensions():Point3
The dimensions of the grid, as [width, height, depth].
Returns
The dimensions of the grid, as [width, height, depth].
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1713
frameSize
getframeSize():number
dimensions[0] * dimensions[1], the number of voxels in one frame.
setframeSize(frameSize):void
dimensions[0] * dimensions[1], the number of voxels in one frame.
Parameters
• frameSize: number
Returns
number
dimensions[0] * dimensions[1], the number of voxels in one frame.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1725
getCompleteScalarDataArray
getgetCompleteScalarDataArray(): () =>ArrayLike<number>
Returns every voxel in one array. A factory installs this member, so a caller that does not know which factory made this voxel manager must guard the call. The array is read only: a write into the array does not reach the voxels.
Returns
Function
Returns
ArrayLike<number>
Returns every voxel in one array. A factory installs this member, so a caller that does not know which factory made this voxel manager must guard the call. The array is read only: a write into the array does not reach the voxels.
Implementation of
IVoxelManager.getCompleteScalarDataArray
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1782
getRange
getgetRange(): () => [number,number]
Gets the [min, max] pair of the data. A factory installs this member.
Returns
Function
Returns
[number, number]
Gets the [min, max] pair of the data. A factory installs this member.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1791
grid
getgrid():VoxelGrid
The grid of the primary representation.
Returns
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:940
id
getid():string
The identifier that the factory gave this voxel manager.
Returns
string
The identifier that the factory gave this voxel manager.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1710
invalidateCache
getinvalidateCache(): () =>void
Drops any cached lookup. A factory installs this member.
Returns
Function
Returns
void
Drops any cached lookup. A factory installs this member.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1788
isInObject
getisInObject(): (pointLPS,pointIJK) =>boolean
The default test that forEach applies, when the options give no test.
setisInObject(isInObject):void
The default test that forEach applies, when the options give no test.
Parameters
• isInObject
Returns
Function
Parameters
• pointLPS: any
• pointIJK: any
Returns
boolean
The default test that forEach applies, when the options give no test.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1749
map
getmap():Map<number,T> |IRLEVoxelMap<T>
The sparse store, for a voxel manager that a factory backed with a map or with an RLE map. It is undefined for a voxel manager over a typed array.
setmap(map):void
The sparse store, for a voxel manager that a factory backed with a map or with an RLE map. It is undefined for a voxel manager over a typed array.
Parameters
• map: Map<number, T> | IRLEVoxelMap<T>
Returns
Map<number, T> | IRLEVoxelMap<T>
The sparse store, for a voxel manager that a factory backed with a map or with an RLE map. It is undefined for a voxel manager over a typed array.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1731
modifiedSlices
getmodifiedSlices():Set<number>
The k indices of the frames that a write changed.
Returns
Set<number>
The k indices of the frames that a write changed.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1746
numberOfComponents
getnumberOfComponents():number
The number of components in each voxel. 1 for grayscale, 3 for RGB.
Returns
number
The number of components in each voxel. 1 for grayscale, 3 for RGB.
Implementation of
IVoxelManager.numberOfComponents
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1716
points
getpoints():Set<number>
The indices that a caller recorded with addPoint.
Returns
Set<number>
The indices that a caller recorded with addPoint.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1743
setCompleteScalarDataArray
getsetCompleteScalarDataArray(): (scalarData) =>void
Writes every voxel from one array. A factory installs this member.
Returns
Function
Parameters
• scalarData: ArrayLike<number>
Returns
void
Writes every voxel from one array. A factory installs this member.
Implementation of
IVoxelManager.setCompleteScalarDataArray
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1785
sizeInBytes
getsizeInBytes():number
The size of the data in bytes.
Returns
number
The size of the data in bytes.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1755
sourceVoxelManager
getsourceVoxelManager():IVoxelManager<T>
The voxel manager that this one writes through to, for a history voxel manager or a preview voxel manager.
setsourceVoxelManager(voxelManager):void
The voxel manager that this one writes through to, for a history voxel manager or a preview voxel manager.
Parameters
• voxelManager: IVoxelManager<T>
Returns
The voxel manager that this one writes through to, for a history voxel manager or a preview voxel manager.
Implementation of
IVoxelManager.sourceVoxelManager
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1737
width
getwidth():number
dimensions[0], kept as a field because the index arithmetic reads it.
setwidth(width):void
dimensions[0], kept as a field because the index arithmetic reads it.
Parameters
• width: number
Returns
number
dimensions[0], kept as a field because the index arithmetic reads it.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1719
Methods
acceptData()
acceptData(
__namedParameters):VoxelRepresentation<T>
Takes new data at a stated quality.
A loader calls this member when a brick, a sub-resolution frame or a full frame arrives. The data goes into the representation of its own grid, and the composite adds that representation when the composite does not hold it yet.
The unit of a delivery is not always a frame. bounds states the region
that the delivery covered, in the index space of that representation, so a
brick of a brick store and a tile of a whole slide image each state their
own box. frameIndex is the convenience for the case of one frame, and it
builds the bounds of one k slice.
A call that states neither bounds nor frameIndex states the quality of
every voxel that no delivery covers.
Parameters
• __namedParameters
• __namedParameters.bounds?: BoundsIJK
• __namedParameters.frameIndex?: number
• __namedParameters.grid: VoxelGrid
• __namedParameters.imageIds?: string[]
The images of the image cache that hold the voxels of this representation, one for each slice of its grid. A loader that delivers a reduced level of a server store, or a brick, states them, and the voxels then live in the image cache with the full-resolution frames.
• __namedParameters.quality?: ImageQualityStatus = ImageQualityStatus.FULL_RESOLUTION
• __namedParameters.reduction?: VoxelReduction
How this data reached its spacing. none by default.
• __namedParameters.source?: VoxelDataSource
Where this data came from. A direct load by default.
• __namedParameters.statistic?: VoxelStatistic = VoxelStatistics.Average
• __namedParameters.voxelManager?: IVoxelManager<T>
Returns
VoxelRepresentation<T>
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1118
addPoint()
addPoint(
point):void
Records a point, for example a point that the user clicked.
Parameters
• point: number | Point3
Returns
void
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1857
addRepresentation()
addRepresentation(
representation):VoxelRepresentation<T>
Adds a representation. The caller owns the voxel manager and the grid.
A representation that shares the key of a representation that the composite already holds REPLACES that representation, because one region at one resolution at one statistic has one sub voxel manager.
Parameters
• representation: VoxelRepresentation<T>
Returns
VoxelRepresentation<T>
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:956
clear()
clear():
void
Clears the sparse store, the recorded frames, the points and the bounds.
Returns
void
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1866
clearBounds()
clearBounds():
void
Resets the recorded bounds.
Returns
void
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1817
coveringRepresentations()
coveringRepresentations(
region?,statistic?):VoxelRepresentation<T>[]
Gives every representation that covers the region, from the finest to the coarsest. A read that finds no value in one representation continues with the next, so a region that no representation covers yet - A HOLE - still gives a value from the coarsest representation that covers it. The user must not see a blank region.
Parameters
• region?: BoundsIJK
• statistic?: VoxelStatistic
Returns
VoxelRepresentation<T>[]
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1041
fillGrid()
fillGrid(
grid,target,statistic):number
Fills a target grid from the best sources that the composite holds.
A fill is many to one. Several representations can cover one region between them, which is the brick case, so the fill asks the composite for a value at each voxel of the target, and the composite answers from the best source that holds that voxel. There is no strategy parameter in this version.
Parameters
• grid: VoxelGrid
• target: IVoxelManager<T>
• statistic: VoxelStatistic = VoxelStatistics.Average
Returns
number
the number of voxels of the target that the fill wrote
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1431
forEach()
forEach(
callback,options?):void|PointInShape[]
Applies a callback to the voxels of this voxel manager. The iteration covers the bounds of the options, or the recorded bounds, or the whole grid. A voxel manager over a map iterates over the stored values only.
Both direction and spacing must reach this method through
options.imageData for the LPS calculation.
The result holds the points only when options.returnPoints is true. The
RLE path gives no result at all, which is why void is part of the type.
Parameters
• callback: any
• options?: VoxelManagerForEachOptions
Returns
void | PointInShape[]
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1820
getArrayOfModifiedSlices()
getArrayOfModifiedSlices():
number[]
The k indices of the frames that a write changed.
Returns
number[]
Implementation of
IVoxelManager.getArrayOfModifiedSlices
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1851
getAtIJK()
getAtIJK(
i,j,k):T
Gets the value at position i,j,k. Use this method, and not getAtIJKPoint,
where the performance matters.
Parameters
• i: number
• j: number
• k: number
Returns
T
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1680
getAtIJKPoint()
getAtIJKPoint(
point):T
Gets the value at an IJK point.
Parameters
• point: Point3
Returns
T
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1700
getAtIndex()
getAtIndex(
index):T
Gets the value at a flat index.
Parameters
• index: number
Returns
T
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1703
getBoundsIJK()
getBoundsIJK():
BoundsIJK
The bounds of the voxels that a write changed, or the whole grid.
Returns
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1811
getConstructor()
getConstructor(): (
length) =>PixelDataTypedArray
The typed array constructor for the data. Defaults to Float32Array.
Returns
Function
Parameters
• length: number
Returns
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1842
getDefaultBounds()
getDefaultBounds():
BoundsIJK
The bounds of the whole grid.
Returns
Implementation of
IVoxelManager.getDefaultBounds
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1808
getGridQuality()
getGridQuality(
grid,__namedParameters):VoxelQualityRecord
The record of the data that a grid holds when it reads the best source of the composite.
A representation of that grid answers for itself. A grid that no representation holds is the grid of a texture that fills by box average straight from the source, and the record of the source deliveries, mapped into that grid, is then the record of the texture.
Parameters
• grid: VoxelGrid
• __namedParameters = {}
• __namedParameters.region?: BoundsIJK
• __namedParameters.statistic?: VoxelStatistic = VoxelStatistics.Average
Returns
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1059
getMiddleSliceData()
getMiddleSliceData():
PixelDataTypedArray
Gets the data of the middle slice on the k axis.
Returns
Implementation of
IVoxelManager.getMiddleSliceData
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1849
getMinMax()
getMinMax():
object
The min and max of the data.
A grayscale voxel manager gives a number for each of the two values, and an
RGB voxel manager gives an array of three numbers, so the type of each
value is T. A caller over a union of the two must test the result.
Returns
object
max
max:
T
min
min:
T
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1863
getPoints()
getPoints():
Point3[]
The recorded points, as IJK points.
Returns
Point3[]
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1860
getQuality()
getQuality(
selector):VoxelQualityRecord
The absolute record of the data that a reader would get for a region.
The reader states the same three inputs that the selection takes, so a reader that will draw at one eighth passes that ceiling and gets the record of the representation that it will really read. Two viewports over one volume can therefore hold a different record at one moment, and each record is correct for its reader.
The record states no verdict. compareVoxelQuality compares a record
against the requirement of one reader.
Parameters
• selector: VoxelRepresentationSelector = {}
Returns
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1476
getRegionQuality()
getRegionQuality(
representation,region?):VoxelQualityRecord
The absolute record of what one representation holds for a region.
The region belongs to the index space of the composite, and the function maps that region into the grid of the representation. The record then aggregates the deliveries that meet the region: the record of one delivery and the record of a region are the same thing at two scales.
The record states no verdict. A reader compares the record against its own requirement, so two viewports over one volume can report differently.
Parameters
• representation: VoxelRepresentation<T>
• region?: BoundsIJK
Returns
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1358
getRepresentation()
getRepresentation(
grid,statistic):VoxelRepresentation<T>
Gives one representation DIRECTLY, by its grid and its statistic. No selection rule applies to a read through the result. A render path does this when it draws the sub-resolution data, and this is the only way to reach a statistic that a default selection does not consider.
Parameters
• grid: VoxelGrid
• statistic: VoxelStatistic = VoxelStatistics.Average
Returns
VoxelRepresentation<T>
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:979
getRepresentations()
getRepresentations():
VoxelRepresentation<T>[]
Every representation that the composite holds, the primary included.
Returns
VoxelRepresentation<T>[]
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:945
getScalarData()
getScalarData(
storeScalarData?):PixelDataTypedArray
Gets the scalar data. storeScalarData keeps an expansion, so that the
next call returns the expansion and does not repeat the work.
Parameters
• storeScalarData?: boolean
Returns
Throws
Error - when no scalar data is available.
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1827
getScalarDataLength()
getScalarDataLength():
number
The length of the array that getScalarData produces.
Returns
number
Throws
Error - when the length can be neither measured nor derived.
Implementation of
IVoxelManager.getScalarDataLength
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1839
getSliceData()
getSliceData(
args):PixelDataTypedArray
Gets the data of one slice, on one of the three axis aligned planes.
Parameters
• args
• args.sliceIndex: number
• args.slicePlane: number
Returns
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1845
getWritableScalarData()
getWritableScalarData():
PixelDataTypedArray
The backing store that a caller can write into, or undefined when this voxel manager has none.
Returns
Implementation of
IVoxelManager.getWritableScalarData
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1833
resetModifiedSlices()
resetModifiedSlices():
void
Marks every frame as unchanged.
Returns
void
Implementation of
IVoxelManager.resetModifiedSlices
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1854
rleForEach()
rleForEach(
callback,options?):void
The forEach of an RLE backed voxel manager. See the RLE map for the
callbacks that work at the level of a row or of a run, because those can be
faster.
Parameters
• callback: any
• options?: any
Returns
void
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1824
selectRepresentation()
selectRepresentation(
__namedParameters):VoxelRepresentation<T>
The selection rule. It takes three inputs: the region, the statistic and the ceiling.
The rule selects the representation of the highest resolution that is not higher than the ceiling, among those that match the statistic and cover the region. A tie of the resolution takes the better quality.
Why the ceiling matters. Without it, a request that fills a texture at one eighth selects the full-resolution data, and it reduces that data at every fill.
When nothing sits at the ceiling the rule returns the best that exists. Every candidate is then finer than the ceiling, and the rule takes the coarsest of them, which is the cheapest source that still holds the resolution that the caller asked for.
The rule never creates a representation.
The rule resolves for a region, and not for each voxel, because a test inside the inner loop of a brush tool is too slow.
Parameters
• __namedParameters: VoxelRepresentationSelector = {}
Returns
VoxelRepresentation<T>
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1012
setAtIJK()
setAtIJK(
i,j,k,v):boolean
Sets the value at position i,j,k, and records the frame that the write
changed. Use this method, and not setAtIJKPoint, where the performance
matters.
Parameters
• i: number
• j: number
• k: number
• v: any
Returns
boolean
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1795
setAtIJKPoint()
setAtIJKPoint(
point,v):void
Sets the value at an IJK point, and records the frame.
Parameters
• point: Point3
• v: any
Returns
void
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1797
setAtIndex()
setAtIndex(
index,v):boolean
Sets the value at a flat index, and records the frame.
Parameters
• index: number
• v: any
Returns
boolean
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1799
setBounds()
setBounds(
bounds):void
Replaces the recorded bounds.
Parameters
• bounds: BoundsIJK
Returns
void
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1814
setDeliveredQuality()
setDeliveredQuality(
representation,bounds,quality):boolean
Records the quality of one delivery of one representation.
A lower quality never replaces a higher one for a region that a delivery
already covered, which is the rule that
BaseStreamingImageVolume.updateTextureAndTriggerEvents applies to
cachedFrames: a decimated frame that arrives after the full frame must
not take the record backwards.
Parameters
• representation: VoxelRepresentation<T>
• bounds: BoundsIJK
• quality: ImageQualityStatus
Returns
boolean
true when the record changed
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1223
setFromScalarData()
setFromScalarData(
scalarData):void
Copies an array INTO this voxel manager, in whatever representation this
voxel manager uses. Use this method, and not getScalarData().set(...).
Parameters
• scalarData: ArrayLike<number>
Returns
void
Implementation of
IVoxelManager.setFromScalarData
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1836
setScalarData()
setScalarData(
newScalarData):void
Installs an array as the backing store of this voxel manager.
Parameters
• newScalarData: PixelDataTypedArray
Returns
void
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1830
toIJK()
toIJK(
index):Point3
Converts a flat index to an IJK point.
Parameters
• index: number
Returns
Implementation of
Defined in
packages/core/src/utilities/CompositeVoxelManager.ts:1802
toIndex()
toIndex(
ijk):number
Converts an IJK point to a flat index.
Parameters
• ijk: Point3
Returns
number