Class: VolLayer
Defined in: src/display/VolLayer.ts:47
Constructors
Constructor
new VolLayer(
id,
volume,
colorMap,
range?,
threshold?,
opacity?,
cacheSize?): VolLayer;Defined in: src/display/VolLayer.ts:152
Constructs a new VolLayer.
Parameters
id
string
A unique identifier for the layer.
volume
The 3D neuroimaging volume data. Can be any NeuroVol implementation (DenseNeuroVol, SparseNeuroVol, LogicalNeuroVol, ClusteredNeuroVol).
colorMap
Instance of a ColorMap used for intensity -> RGBA transformation.
range?
Range | null
[Optional] The initial intensity range [min, max]. If not provided, it is inferred from the volume data.
threshold?
Threshold = ...
[Optional] The threshold range [low, high]. Defaults to [0, 0].
opacity?
number = 1.0
[Optional] The global opacity of this layer (0 to 1). Defaults to 1.0.
cacheSize?
number
Returns
VolLayer
Properties
id
id: string;Defined in: src/display/VolLayer.ts:51
A unique identifier for the layer.
volume
volume: NeuroVol;Defined in: src/display/VolLayer.ts:56
The underlying volume data. Can be any NeuroVol implementation.
colorMap
colorMap: ColorMap;Defined in: src/display/VolLayer.ts:62
Color mapping configuration for this volume layer. Used to transform intensity values to RGBA values.
opacity
opacity: number;Defined in: src/display/VolLayer.ts:67
Global opacity for this layer (0 to 1).
visible
visible: boolean;Defined in: src/display/VolLayer.ts:72
Whether this layer is visible.
range
range: Range;Defined in: src/display/VolLayer.ts:79
The intensity range [min, max] used for visualization. Values outside this range may be clipped or mapped differently, depending on the color map.
threshold
threshold: Threshold;Defined in: src/display/VolLayer.ts:86
The intensity threshold [low, high] used for masking. Intensity values outside this threshold range may be set to transparent, depending on the color map.
version
version: number = 0;Defined in: src/display/VolLayer.ts:92
Version number that increments whenever colormap settings change. Used by ImageLayer to invalidate texture cache.
textureVersion
textureVersion: number = 0;Defined in: src/display/VolLayer.ts:98
Bumped only when the colour-mapped pixels change (not for opacity), so renderers can reuse uploaded textures across opacity changes.
interpolation
interpolation: SliceInterpolation = 'linear';Defined in: src/display/VolLayer.ts:107
Sampling for display. Note: 'smooth' is meant for overlays resampled on the reference (layer 0) grid; the reference layer itself should not use it.
outline
outline: number = 0;Defined in: src/display/VolLayer.ts:114
Strength in [0, 1] of a dark outline drawn on the visible side of every edge between drawn and transparent pixels (i.e. at the threshold contour). 0 disables it.
edgeFade
edgeFade: number = 0;Defined in: src/display/VolLayer.ts:121
Width, in voxels, of an alpha ramp at the slice's outer edges, so a field of view that ends inside tissue fades out instead of stopping at a hard line. 0 disables it.
minOutlineClusterSize
minOutlineClusterSize: number = 0;Defined in: src/display/VolLayer.ts:128
Only suprathreshold clusters with at least this many voxels (3-D, 26-connected, same sign) get the threshold-contour outline; smaller clusters are still drawn, just not outlined. 0 or 1 outlines everything.
Accessors
space
Get Signature
get space(): NeuroSpace;Defined in: src/display/VolLayer.ts:189
Returns the NeuroSpace of the underlying volume, describing dimensions, spacing, and orientation.
Returns
Methods
getSlice()
getSlice(sliceIndex, outAxes): ImageSlice;Defined in: src/display/VolLayer.ts:201
Retrieves a 2D slice from the volume given a slice index (in voxel coordinates) and an orientation (outAxes). The result is cached to avoid recomputation.
Parameters
sliceIndex
number
The integer slice index in the volume (voxel coordinate).
outAxes
The desired orientation axes for the output slice.
Returns
An ImageSlice containing the 2D image data plus spatial metadata.
getTransformationToReference()
getTransformationToReference(referenceSpace): Matrix;Defined in: src/display/VolLayer.ts:233
Retrieves a transformation matrix from this layer's space to a reference space.
Parameters
referenceSpace
The reference NeuroSpace to transform into.
Returns
Matrix
A 4x4 transformation Matrix.
getSliceAt()
getSliceAt(
coord,
outAxes,
interpolation?): ImageSlice;Defined in: src/display/VolLayer.ts:246
Retrieves a 2D slice by real-world (or continuous) coordinates, rather than integer indices. Uses the specified interpolation mode. Caches the result for faster subsequent retrieval.
Parameters
coord
number[]
The [x, y, z] coordinate in the volume's space.
outAxes
The orientation for the output slice.
interpolation?
"nearest" | "trilinear"
The interpolation method: 'nearest' or 'trilinear'. Defaults to 'trilinear'.
Returns
An ImageSlice with the processed 2D image data plus spatial metadata.
replaceVolume()
replaceVolume(newVolume, opts?): void;Defined in: src/display/VolLayer.ts:283
Replace the underlying volume while keeping the same layer id and color settings. Faster than removing/re-adding a layer because it preserves viewer references.
Parameters
newVolume
A NeuroVol with matching geometry (dim, axes, spacing, origin).
opts?
Optional display overrides (range/threshold/opacity/colormap).
range?
Range | null
threshold?
opacity?
number
colormap?
Returns
void
getOrthoSliceAt()
getOrthoSliceAt(coord, interpolation?): object;Defined in: src/display/VolLayer.ts:370
Retrieves three orthogonal slices (axial, sagittal, coronal) at a specific coordinate.
Parameters
coord
number[]
The [x, y, z] coordinate in the volume's space.
interpolation?
"nearest" | "trilinear"
Interpolation method: 'nearest' or 'trilinear'. Defaults to 'trilinear'.
Returns
object
An object containing axial, sagittal, and coronal slices.
axial
axial: ImageSlice;sagittal
sagittal: ImageSlice;coronal
coronal: ImageSlice;containsCoord()
containsCoord(coord): boolean;Defined in: src/display/VolLayer.ts:444
Checks if the provided coordinate is within the boundaries of this volume's space.
Parameters
coord
number[]
A [x, y, z] coordinate in real-world or continuous space.
Returns
boolean
True if the coordinate lies within the volume bounds, false otherwise.
setColormap()
setColormap(colormap): void;Defined in: src/display/VolLayer.ts:454
Replaces the current ColorMap with a new one and invalidates the slice cache.
Parameters
colormap
The new ColorMap to use.
Returns
void
getCacheStats()
getCacheStats(): object;Defined in: src/display/VolLayer.ts:476
Gets cache statistics for monitoring performance
Returns
object
size
size: number;capacity
capacity: number;hits
hits: number;misses
misses: number;evictions
evictions: number;hitRatio
hitRatio: number;getRange()
getRange(): Range;Defined in: src/display/VolLayer.ts:490
Retrieves the current intensity range used by this layer.
Returns
getVolumeRange()
getVolumeRange(): [number, number];Defined in: src/display/VolLayer.ts:498
Retrieves the full intensity range of the underlying volume, as calculated by the volume data itself.
Returns
[number, number]
getThreshold()
getThreshold(): Threshold;Defined in: src/display/VolLayer.ts:505
Retrieves the current threshold range used by this layer.
Returns
setThreshold()
setThreshold(threshold): void;Defined in: src/display/VolLayer.ts:515
Sets a new intensity threshold [low, high] and invalidates the cache.
Parameters
threshold
The new threshold to apply.
Returns
void
setOpacity()
setOpacity(opacity): void;Defined in: src/display/VolLayer.ts:527
Sets a new opacity (0-1) for this layer and invalidates the cache.
Parameters
opacity
number
The new opacity value.
Returns
void
setMinOutlineClusterSize()
setMinOutlineClusterSize(voxels): void;Defined in: src/display/VolLayer.ts:572
Sets the minimum 3-D cluster size (voxels) that gets a threshold outline.
Parameters
voxels
number
Returns
void
setEdgeFade()
setEdgeFade(voxels): void;Defined in: src/display/VolLayer.ts:583
Sets the edge fade width in voxels (0 disables).
Parameters
voxels
number
Returns
void
setOutline()
setOutline(strength): void;Defined in: src/display/VolLayer.ts:594
Sets the threshold-contour outline strength (0 disables).
Parameters
strength
number
Returns
void
setInterpolation()
setInterpolation(interpolation): void;Defined in: src/display/VolLayer.ts:605
Sets how the slice is resampled for display; see SliceInterpolation.
Parameters
interpolation
Returns
void
setRange()
setRange(range): void;Defined in: src/display/VolLayer.ts:618
Sets a new intensity range [min, max] for visualization and invalidates the cache.
Parameters
range
The new intensity range.
Returns
void
setVisible()
setVisible(visible): void;Defined in: src/display/VolLayer.ts:630
Sets the visibility of this layer.
Parameters
visible
boolean
Whether the layer should be visible.
Returns
void