Skip to content

Volume

A single 3D or 4D medical image stored as a TileDB dense array. Supports efficient partial reads (slices, patches) and preserves spatial metadata (orientation, voxel spacing).

radiobject.Volume

Single 3D/4D radiology acquisition indexed by obs_id in VolumeCollection.

dtype property

Data type of the volume.

obs_id property

Observation identifier stored in array metadata.

orientation_info property

Anatomical orientation information from TileDB metadata.

shape property

Volume dimensions.

tile_orientation property

Tile slicing strategy used at array creation (None if missing).

__getitem__(key)

NumPy-like indexing for partial reads: vol[10:20, :, :].

__repr__()

Concise representation of the Volume.

axial(z, t=None)

Get axial slice (X-Y plane at given Z).

compute_histogram(bins=256, value_range=None)

Compute intensity histogram. Returns (counts, bin_edges).

coronal(y, t=None)

Get coronal slice (X-Z plane at given Y).

create(uri, shape, dtype=np.float32, ctx=None) classmethod

Create an empty Volume with explicit schema.

from_dicom(uri, dicom_dir, ctx=None, reorient=None, dtype=None) classmethod

Create a new Volume from a DICOM series directory.

Parameters:

Name Type Description Default
uri str

TileDB array URI.

required
dicom_dir str | Path

Path to directory containing DICOM files.

required
ctx Ctx | None

TileDB context (uses global if None).

None
reorient bool | None

Reorient to canonical orientation (None uses config default).

None
dtype dtype | type | None

Output dtype. None preserves original DICOM dtype (uint16/int16). Use np.float32 for backward-compatible behavior.

None

from_nifti(uri, nifti_path, ctx=None, reorient=None) classmethod

Create a new Volume from a NIfTI file.

Parameters:

Name Type Description Default
uri str

TileDB array URI.

required
nifti_path str | Path

Path to NIfTI file.

required
ctx Ctx | None

TileDB context (uses global if None).

None
reorient bool | None

Reorient to canonical orientation (None uses config default).

None

from_numpy(uri, data, ctx=None) classmethod

Create Volume from numpy array.

get_statistics(percentiles=None)

Compute mean, std, min, max, median, and optional percentiles.

sagittal(x, t=None)

Get sagittal slice (Y-Z plane at given X).

set_obs_id(obs_id)

Store observation identifier in array metadata.

slice(x, y, z, t=None)

Partial read using slice objects. Prefer vol[x, y, z] for most cases.

to_nifti(file_path, compression=True)

Export to NIfTI with metadata preservation.

to_numpy()

Read entire volume into memory.