Skip to content

Class: Resampler ​

Defined in: src/resampling/Resampler.ts:21

Resampling implementation for NeuroVol

Implements ​

Constructors ​

Constructor ​

ts
new Resampler(volume): Resampler;

Defined in: src/resampling/Resampler.ts:24

Parameters ​

volume ​

NeuroVol

Returns ​

Resampler

Methods ​

resample() ​

ts
resample(targetSpace, options?): NeuroVol;

Defined in: src/resampling/Resampler.ts:31

Resample volume to new space/resolution

Parameters ​

targetSpace ​

NeuroSpace

options? ​

ResampleOptions = {}

Returns ​

NeuroVol

Implementation of ​

IResampler.resample


resampleToDimensions() ​

ts
resampleToDimensions(dimensions, options?): NeuroVol;

Defined in: src/resampling/Resampler.ts:79

Resample to specific voxel dimensions

Parameters ​

dimensions ​

[number, number, number]

options? ​

ResampleOptions

Returns ​

NeuroVol

Implementation of ​

IResampler.resampleToDimensions


resampleToVoxelSize() ​

ts
resampleToVoxelSize(voxelSize, options?): NeuroVol;

Defined in: src/resampling/Resampler.ts:103

Resample to specific voxel size

Parameters ​

voxelSize ​

[number, number, number]

options? ​

ResampleOptions

Returns ​

NeuroVol

Implementation of ​

IResampler.resampleToVoxelSize


transform() ​

ts
transform(options, resampleOptions?): NeuroVol;

Defined in: src/resampling/Resampler.ts:139

Apply an affine transformation to the volume, resampling onto a grid of the same dimensions/spacing as the input.

The transform is expressed in voxel (grid) coordinates. The forward map sends an input voxel p to an output voxel q via

q = M * (p - center) + center + translation

where M = R * S (rotation composed with scale). Resampling fills each OUTPUT voxel q by mapping it back into the INPUT volume with the inverse transform and sampling there:

p = M^-1 * (q - center - translation) + center

Parameters ​

options ​

TransformOptions

resampleOptions? ​

ResampleOptions = {}

Returns ​

NeuroVol

Implementation of ​

IResampler.transform


interpolateAt() ​

ts
interpolateAt(
   x, 
   y, 
   z, 
   method?): number;

Defined in: src/resampling/Resampler.ts:180

Interpolate value at continuous coordinate

Parameters ​

x ​

number

y ​

number

z ​

number

method? ​

InterpolationMethod = 'linear'

Returns ​

number

Implementation of ​

IResampler.interpolateAt


downsample() ​

ts
downsample(factor, options?): NeuroVol;

Defined in: src/resampling/Resampler.ts:187

Downsample by integer factor

Parameters ​

factor ​

number

options? ​

ResampleOptions

Returns ​

NeuroVol

Implementation of ​

IResampler.downsample


upsample() ​

ts
upsample(factor, options?): NeuroVol;

Defined in: src/resampling/Resampler.ts:204

Upsample by integer factor

Parameters ​

factor ​

number

options? ​

ResampleOptions

Returns ​

NeuroVol

Implementation of ​

IResampler.upsample


resampleClustered() ​

ts
static resampleClustered(source, targetSpace): ClusteredNeuroVol;

Defined in: src/resampling/Resampler.ts:225

Resample a ClusteredNeuroVol to a new target space.

Uses nearest-neighbour interpolation to preserve integer labels. The algorithm:

  1. Resample labels (dense Int32 representation) with nearest-neighbour
  2. Resample the mask with nearest-neighbour
  3. Keep voxels where both resampled mask and label are non-zero
  4. Build a new ClusteredNeuroVol with the surviving labels

Parameters ​

source ​

ClusteredNeuroVol

targetSpace ​

NeuroSpace

Returns ​

ClusteredNeuroVol

Released under the MIT License.