Skip to content

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 ​

ts
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

NeuroSpace object defining the spatial reference. If not provided, creates a default space based on coordinate bounds.

Returns ​

ROICoords

Overrides ​

ROI.constructor

Properties ​

space ​

ts
readonly space: NeuroSpace;

Defined in: src/roi/ROI_improved.ts:15

Overrides ​

ROI.space


coords ​

ts
readonly coords: number[][];

Defined in: src/roi/ROI_improved.ts:16

Overrides ​

ROI.coords

Accessors ​

length ​

Get Signature ​

ts
get length(): number;

Defined in: src/roi/ROI_improved.ts:62

Returns the number of voxels in the ROI.

Returns ​

number

Overrides ​

ROI.length


dim ​

Get Signature ​

ts
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() ​

ts
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 ​

ROI.indices


realCoords() ​

ts
realCoords(): number[][];

Defined in: src/roi/ROI_improved.ts:84

Returns the real-world coordinates of the voxels in the ROI.

Returns ​

number[][]


centroid() ​

ts
centroid(): number[];

Defined in: src/roi/ROI_improved.ts:91

Computes the centroid of the ROI in real-world coordinates.

Returns ​

number[]


getSubset() ​

ts
getSubset(indices): ROICoords;

Defined in: src/roi/ROI_improved.ts:104

Extract subset of coordinates.

Parameters ​

indices ​

number | number[] | boolean[]

Returns ​

ROICoords


toString() ​

ts
toString(): string;

Defined in: src/roi/ROI_improved.ts:137

String representation matching Python's implementation.

Returns ​

string

Overrides ​

ROI.toString


asSparse() ​

ts
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 ​

SparseNeuroVol

A SparseNeuroVol with the ROI voxels set to fillValue

Released under the MIT License.