Class: ROICoords
Defined in: src/roi/ROI_improved.ts:14
ROICoords - A class representing a region of interest (ROI) in a brain image, defined by a set of coordinates.
Direct translation of Python's ROICoords class.
Extends
Extended by
Constructors
Constructor
new ROICoords(coords, space?): ROICoords;Defined in: src/roi/ROI_improved.ts:25
Creates an ROICoords instance.
Parameters
coords
number[][]
Matrix with 3 columns representing (i, j, k) coordinates
space?
NeuroSpace object defining the spatial reference. If not provided, creates a default space based on coordinate bounds.
Returns
ROICoords
Overrides
Properties
space
readonly space: NeuroSpace;Defined in: src/roi/ROI_improved.ts:15
Overrides
coords
readonly coords: number[][];Defined in: src/roi/ROI_improved.ts:16
Overrides
Accessors
length
Get Signature
get length(): number;Defined in: src/roi/ROI_improved.ts:62
Returns the number of voxels in the ROI.
Returns
number
Overrides
dim
Get Signature
get dim(): [number, number];Defined in: src/roi/ROI_improved.ts:70
Get dimensions of the coordinate matrix. Returns [nrows, ncols] where ncols is always 3.
Returns
[number, number]
Methods
indices()
indices(): number[];Defined in: src/roi/ROI_improved.ts:77
Returns the indices of the voxels in the ROI based on the space dimensions.
Returns
number[]
Overrides
realCoords()
realCoords(): number[][];Defined in: src/roi/ROI_improved.ts:84
Returns the real-world coordinates of the voxels in the ROI.
Returns
number[][]
centroid()
centroid(): number[];Defined in: src/roi/ROI_improved.ts:91
Computes the centroid of the ROI in real-world coordinates.
Returns
number[]
getSubset()
getSubset(indices): ROICoords;Defined in: src/roi/ROI_improved.ts:104
Extract subset of coordinates.
Parameters
indices
number | number[] | boolean[]
Returns
ROICoords
toString()
toString(): string;Defined in: src/roi/ROI_improved.ts:137
String representation matching Python's implementation.
Returns
string
Overrides
asSparse()
asSparse(fillValue?): SparseNeuroVol;Defined in: src/roi/ROI_improved.ts:148
Convert to SparseNeuroVol representation as a binary mask. All voxels in the ROI will have a value of 1, all others will be 0.
Parameters
fillValue?
number = 1
The value to assign to ROI voxels (default: 1)
Returns
A SparseNeuroVol with the ROI voxels set to fillValue