Skip to main content

Function: decimatedVolumeLoader()

decimatedVolumeLoader(volumeId, options): IVolumeLoader

Decimated volume loader that creates a StreamingImageVolume while delegating volume mutations to a plugin-style modifier chain. The loader still handles the responsibilities of preparing imageIds (including optional k-axis decimation), instantiating the streaming volume, and updating VTK/voxel-manager state, but it now relies on decimatedVolumeModifiers to encapsulate any transformations that are specific to projection parameters such as decimation.

The loader currently wires a dedicated modifier set for:

  • K-axis decimation handling: Removes slices before metadata generation so that spacing reflects the decimated stack without manual scaling.
  • In-plane decimation: Implemented by InPlaneDecimationModifier, which updates dimensions, spacing, and DICOM metadata in a self-contained class.

Additional modifiers can be introduced by implementing the shared DecimatedVolumeModifier interface. For example:

const modifiers = [
inPlaneDecimationModifier,
orientationModifier, // rotates the direction matrix or redefines axis order
partialRangeModifier, // limits the volume to a subset of frames / slices
windowingModifier, // applies window/level or LUT adjustments at load time
];

Modifiers are executed via applyDecimatedVolumeModifiers, so the loader still just selects the set to run and trusts the chain to mutate props appropriately.

Parameters

volumeId: string

The unique identifier for the volume

options

Configuration options for volume loading

options.ijkDecimation?: Point3

Decimation factors for [I, J, K] axes where I/J affect in-plane resolution and K affects slice count. Defaults to [1, 1, 1] (no decimation). Example: [2, 2, 2] reduces dimensions by half in all axes.

options.imageIds: string[]

Array of DICOM imageIds to construct the volume from (required)

options.progressiveRendering?: boolean | IRetrieveConfiguration

Enable progressive rendering or provide custom retrieve configuration for streaming behavior

Returns

IVolumeLoader

An object containing:

  • promise: Resolves to the created StreamingImageVolume instance
  • cancel: Function to cancel ongoing volume loading
  • decache: Function to destroy and remove the volume from cache

Throws

Error if imageIds are not provided or empty

Example

const volumeLoader = decimatedVolumeLoader('volumeId', {
imageIds: ['dicomweb:...', 'dicomweb:...'],
ijkDecimation: [2, 2, 2], // Half resolution in all dimensions
progressiveRendering: true
});

const volume = await volumeLoader.promise;
// Later: volumeLoader.cancel() or volumeLoader.decache()

Defined in

packages/core/src/loaders/decimatedVolumeLoader.ts:77