Class: ClusteredNeuroVol
Defined in: src/volume/ClusteredNeuroVol.ts:39
ClusteredNeuroVol represents clustered volumetric neuroimaging data.
This class stores cluster assignments for voxels within a mask, where each voxel in the mask is assigned a cluster ID. It provides methods to work with clusters, extract cluster-specific data, and convert between representations.
Direct translation of Python's ClusteredNeuroVol class.
Implements
Constructors
Constructor
new ClusteredNeuroVol(
mask,
clusters,
labelMap?): ClusteredNeuroVol;Defined in: src/volume/ClusteredNeuroVol.ts:54
Creates a ClusteredNeuroVol instance.
Parameters
mask
A LogicalNeuroVol representing the spatial domain of the clusters
clusters
number[] | Int32Array<ArrayBufferLike>
An array of cluster labels for each voxel in the mask
labelMap?
LabelMap = {}
Optional mapping from cluster names to cluster IDs
Returns
ClusteredNeuroVol
Properties
space
readonly space: NeuroSpace;Defined in: src/volume/ClusteredNeuroVol.ts:40
Implementation of
mask
readonly mask: LogicalNeuroVol;Defined in: src/volume/ClusteredNeuroVol.ts:41
clusters
readonly clusters: Int32Array;Defined in: src/volume/ClusteredNeuroVol.ts:42
labelMap
readonly labelMap: LabelMap;Defined in: src/volume/ClusteredNeuroVol.ts:43
Accessors
length
Get Signature
get length(): number;Defined in: src/volume/ClusteredNeuroVol.ts:100
Returns
number
Implementation of
dim
Get Signature
get dim(): number[];Defined in: src/volume/ClusteredNeuroVol.ts:104
Returns
number[]
Implementation of
spacing
Get Signature
get spacing(): number[];Defined in: src/volume/ClusteredNeuroVol.ts:108
Returns
number[]
Implementation of
origin
Get Signature
get origin(): number[];Defined in: src/volume/ClusteredNeuroVol.ts:112
Returns
number[]
Implementation of
Methods
get()
get(index): number;Defined in: src/volume/ClusteredNeuroVol.ts:120
Get value at a linear index. Returns the cluster ID if the voxel is in the mask, 0 otherwise.
Parameters
index
number
Returns
number
Implementation of
getAt()
getAt(
i,
j,
k): number;Defined in: src/volume/ClusteredNeuroVol.ts:130
Get value at specific coordinates. Returns the cluster ID if the voxel is in the mask, 0 otherwise.
Parameters
i
number
j
number
k
number
Returns
number
Implementation of
setAt()
setAt(
i,
j,
k,
value): void;Defined in: src/volume/ClusteredNeuroVol.ts:138
Setting values is not supported for ClusteredNeuroVol.
Parameters
i
number
j
number
k
number
value
number
Returns
void
Implementation of
getData()
getData(): Int32Array;Defined in: src/volume/ClusteredNeuroVol.ts:146
Get the underlying data as a dense array. Returns a volume where masked voxels have their cluster IDs and others are 0.
Returns
Int32Array
Implementation of
getRange()
getRange(): [number, number];Defined in: src/volume/ClusteredNeuroVol.ts:160
Get the range of cluster IDs.
Returns
[number, number]
Implementation of
setData()
setData(_newData): void;Defined in: src/volume/ClusteredNeuroVol.ts:180
Replace data is not supported for clustered sparse volumes. Provided to satisfy NeuroVol; throws to indicate misuse.
Parameters
_newData
Returns
void
Implementation of
getLabelMap()
getLabelMap(): LabelMap;Defined in: src/volume/ClusteredNeuroVol.ts:187
Get the label map.
Returns
getClusterInfo()
getClusterInfo(idOrLabel): ClusterInfo | undefined;Defined in: src/volume/ClusteredNeuroVol.ts:194
Get cluster information by ID or label.
Parameters
idOrLabel
string | number
Returns
ClusterInfo | undefined
getClusterMask()
getClusterMask(idOrLabel): LogicalNeuroVol;Defined in: src/volume/ClusteredNeuroVol.ts:239
Get a binary mask for a specific cluster.
Parameters
idOrLabel
string | number
Returns
getClusterData()
getClusterData(data, idOrLabel): Float32Array;Defined in: src/volume/ClusteredNeuroVol.ts:251
Extract data for a specific cluster from another volume.
Parameters
data
idOrLabel
string | number
Returns
Float32Array
getClusterId()
getClusterId(coord): number | undefined;Defined in: src/volume/ClusteredNeuroVol.ts:273
Get cluster ID for a voxel at a specific coordinate. This is a convenience method for compatibility.
Parameters
coord
number[]
Returns
number | undefined
getClusterLabel()
getClusterLabel(coord): string | undefined;Defined in: src/volume/ClusteredNeuroVol.ts:292
Get cluster label for a voxel at a specific coordinate. This is a convenience method for compatibility.
Parameters
coord
number[]
Returns
string | undefined
getClusterCoords()
getClusterCoords(idOrLabel): number[][];Defined in: src/volume/ClusteredNeuroVol.ts:304
Get all coordinates for a specific cluster. This is a convenience method for compatibility.
Parameters
idOrLabel
string | number
Returns
number[][]
numClusters()
numClusters(): number;Defined in: src/volume/ClusteredNeuroVol.ts:316
Get the number of unique clusters.
Returns
number
clusterSizes()
clusterSizes(): Map<number, number>;Defined in: src/volume/ClusteredNeuroVol.ts:323
Get sizes of all clusters.
Returns
Map<number, number>
clusterCenters()
clusterCenters(): Map<number, number[]>;Defined in: src/volume/ClusteredNeuroVol.ts:334
Get centers of all clusters.
Returns
Map<number, number[]>
asSparse()
asSparse(): SparseNeuroVol;Defined in: src/volume/ClusteredNeuroVol.ts:350
Convert to SparseNeuroVol.
Returns
asDense()
asDense(): DenseNeuroVol;Defined in: src/volume/ClusteredNeuroVol.ts:364
Convert to DenseNeuroVol.
Returns
asLogical()
asLogical(): LogicalNeuroVol;Defined in: src/volume/ClusteredNeuroVol.ts:372
Convert to LogicalNeuroVol (returns the mask).
Returns
getSlice()
getSlice(zlevel, outAxes): NeuroSlice;Defined in: src/volume/ClusteredNeuroVol.ts:379
Get slice - delegates to dense representation.
Parameters
zlevel
number
outAxes
Returns
Implementation of
getSliceAt()
getSliceAt(
coord,
outAxes,
interpolation): NeuroSlice;Defined in: src/volume/ClusteredNeuroVol.ts:386
Get slice at coordinates - delegates to dense representation.
Parameters
coord
number[]
outAxes
interpolation
"nearest" | "trilinear"
Returns
Implementation of
getSliceTypedArrayType()
getSliceTypedArrayType(): NumericType;Defined in: src/volume/ClusteredNeuroVol.ts:390
Returns
Implementation of
NeuroVol.getSliceTypedArrayType
getDataConstructor()
getDataConstructor(): (length) => Int32Array;Defined in: src/volume/ClusteredNeuroVol.ts:394
Returns
(length) => Int32Array
Implementation of
toString()
toString(): string;Defined in: src/volume/ClusteredNeuroVol.ts:432
String representation of the volume.
Returns
string