Skip to content

Abstract Class: NeuroSlice ​

Defined in: src/volume/NeuroSlice.ts:12

Abstract base class for representing a 2D slice of neuroimaging data.

Constructors ​

Constructor ​

ts
new NeuroSlice(space, data): NeuroSlice;

Defined in: src/volume/NeuroSlice.ts:29

Constructs a NeuroSlice instance.

Parameters ​

space ​

NeuroSpace

The 2D geometric space of the slice data.

data ​

TypedArray

The raw 2D slice data.

Returns ​

NeuroSlice

Throws ​

If space.dim is not 2-dimensional or data.length does not match space.dim.

Accessors ​

dim ​

Get Signature ​

ts
get dim(): number[];

Defined in: src/volume/NeuroSlice.ts:47

Get the dimensions of the slice.

Returns ​

number[]

An array of two numbers representing the dimensions.


space ​

Get Signature ​

ts
get space(): NeuroSpace;

Defined in: src/volume/NeuroSlice.ts:55

Get the NeuroSpace object associated with this slice.

Returns ​

NeuroSpace

The NeuroSpace object representing the geometric space of the slice.


spacing ​

Get Signature ​

ts
get spacing(): number[];

Defined in: src/volume/NeuroSlice.ts:63

Get the spacing of the slice.

Returns ​

number[]

An array of two numbers representing the spacing.


origin ​

Get Signature ​

ts
get origin(): number[];

Defined in: src/volume/NeuroSlice.ts:71

Get the origin of the slice.

Returns ​

number[]

An array of two numbers representing the origin.


trans ​

Get Signature ​

ts
get trans(): Matrix;

Defined in: src/volume/NeuroSlice.ts:75

Returns ​

Matrix


inverseTrans ​

Get Signature ​

ts
get inverseTrans(): Matrix;

Defined in: src/volume/NeuroSlice.ts:79

Returns ​

Matrix

Methods ​

getAt() ​

ts
getAt(i, j): number;

Defined in: src/volume/NeuroSlice.ts:90

Get a pixel value at specified coordinates.

Parameters ​

i ​

number

x-coordinate

j ​

number

y-coordinate

Returns ​

number

The pixel value.

Throws ​

If coordinates are out of bounds.


setAt() ​

ts
setAt(
   i, 
   j, 
   value): void;

Defined in: src/volume/NeuroSlice.ts:106

Set a pixel value at specified coordinates.

Parameters ​

i ​

number

x-coordinate

j ​

number

y-coordinate

value ​

number

The value to set.

Returns ​

void

Throws ​

If coordinates are out of bounds.


getRow() ​

ts
getRow(j): TypedArray;

Defined in: src/volume/NeuroSlice.ts:121

Get a row of the slice.

Parameters ​

j ​

number

y-coordinate of the row

Returns ​

TypedArray

The row data as the same TypedArray type.

Throws ​

If the row index is out of bounds.


getColumn() ​

ts
getColumn(i): TypedArray;

Defined in: src/volume/NeuroSlice.ts:135

Get a column of the slice.

Parameters ​

i ​

number

x-coordinate of the column

Returns ​

TypedArray

The column data as the same TypedArray type.

Throws ​

If the column index is out of bounds.


getData() ​

ts
getData(): TypedArray;

Defined in: src/volume/NeuroSlice.ts:160

Public getter for the underlying data array.

Returns ​

TypedArray

The TypedArray containing the slice data.

Released under the MIT License.