Skip to content

Function: extractOrthogonalSlices()

ts
function extractOrthogonalSlices(
   vol, 
   worldPoint, 
   sliceTypes?): Record<string, NeuroSlice>;

Defined in: src/volume/orthogonalSlices.ts:37

Extract orthogonal slices from a volume at a given world-space point.

This function extracts axial, sagittal, and/or coronal slices from a 3D neuroimaging volume at the specified world-space coordinate.

Parameters

vol

NeuroVol

The 3D volume to extract slices from

worldPoint

number[]

World-space coordinates [x, y, z] at which to extract slices

sliceTypes?

("axial" | "coronal" | "sagittal")[]

Array of slice types to extract. Valid values are 'axial', 'sagittal', 'coronal'. If not provided, all three slice types are extracted.

Returns

Record<string, NeuroSlice>

Object mapping slice type names to NeuroSlice objects

Throws

Error if worldPoint is outside volume bounds or has wrong dimensions

Throws

Error if vol is not a 3D volume

Example

typescript
// Extract all orthogonal slices at world point (10, 20, 30)
const slices = extractOrthogonalSlices(vol, [10, 20, 30]);
const axialSlice = slices.axial;

// Extract only sagittal slice
const slices = extractOrthogonalSlices(vol, [10, 20, 30], ['sagittal']);
const sagittalSlice = slices.sagittal;

Released under the MIT License.