Skip to content

Class: ROIVec ​

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

ROIVec - Represents a volumetric ROI with associated vector data for each voxel.

Direct translation of Python's ROIVec class.

Extends ​

Extended by ​

Constructors ​

Constructor ​

ts
new ROIVec(
   data, 
   space, 
   coords): ROIVec;

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

Creates an ROIVec instance.

Parameters ​

data ​

number[][] | Matrix

Matrix where each row corresponds to a voxel, columns represent vector components

space ​

NeuroSpace

NeuroSpace object defining the spatial reference

coords ​

number[][]

Matrix with 3 columns representing (i,j,k) coordinates

Returns ​

ROIVec

Overrides ​

ROICoords.constructor

Properties ​

space ​

ts
readonly space: NeuroSpace;

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

Inherited from ​

ROICoords.space


coords ​

ts
readonly coords: number[][];

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

Inherited from ​

ROICoords.coords


data ​

ts
readonly data: Matrix;

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

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

Inherited from ​

ROICoords.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]

Inherited from ​

ROICoords.dim


ncol ​

Get Signature ​

ts
get ncol(): number;

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

Get the number of columns (vector dimension).

Returns ​

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[]

Inherited from ​

ROICoords.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[][]

Inherited from ​

ROICoords.realCoords


centroid() ​

ts
centroid(): number[];

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

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

Returns ​

number[]

Inherited from ​

ROICoords.centroid


getSubset() ​

ts
getSubset(indices): ROICoords;

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

Extract subset of coordinates.

Parameters ​

indices ​

number | number[] | boolean[]

Returns ​

ROICoords

Inherited from ​

ROICoords.getSubset


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

Inherited from ​

ROICoords.asSparse


getVector() ​

ts
getVector(index): number[];

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

Retrieves the vector data at a specific voxel index.

Parameters ​

index ​

number

Index of the voxel in the ROI.

Returns ​

number[]


setVector() ​

ts
setVector(index, vector): void;

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

Sets the vector data at a specific voxel index.

Parameters ​

index ​

number

Index of the voxel in the ROI.

vector ​

number[]

Vector data to set.

Returns ​

void


getColumn() ​

ts
getColumn(colIndex): number[];

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

Get column of data (all values for a specific vector component).

Parameters ​

colIndex ​

number

Returns ​

number[]


setColumn() ​

ts
setColumn(colIndex, values): void;

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

Set column of data.

Parameters ​

colIndex ​

number

values ​

number[]

Returns ​

void


toString() ​

ts
toString(): string;

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

String representation.

Returns ​

string

Overrides ​

ROICoords.toString

Released under the MIT License.