Skip to content

volume

voxel.volume.stack(*vols) -> Volume

Concatenate (stack) multiple volumes channel-wise. Assumes the volumes are in the same image space (with the same base shape).

Parameters:

  • *vols (Volume, default: () ) –

    Volumes to merge.

Returns:

  • Volume

    Single channel-stacked volume instance.

voxel.volume.volume_grid(baseshape, transform=None, localshape=None, device=None) -> torch.Tensor

Construct a grid of 3D voxel coordinates of the shape (W, H, D, 3).

Parameters:

  • baseshape (Size) –

    Spatial (3D) shape of the volume grid.

  • transform (AffineMatrix, default: None ) –

    Grid voxel coordinate transform.

  • localshape (Size, default: None ) –

    If provided, the grid is normalized to the range [-1, 1] using this spatial shape and the coordinate order is swapped (for torch sampling methods).

  • device (device, default: None ) –

    Device on which to allocate the grid data.

Returns:

  • Tensor

    Grid volume tensor.

voxel.volumes_equal(a, b, vol_tol=1e-06, geom_tol=1e-06) -> bool

Check if two volumes are equal within a given tolerance.

Parameters:

  • a (Volume) –

    First volume to compare.

  • b (Volume) –

    Second volume to compare.

  • vol_tol (float, default: 1e-06 ) –

    Absolute tolerance for volume tensor comparison.

  • geom_tol (float, default: 1e-06 ) –

    Absolute tolerance for geometry comparison.

Returns:

  • bool

    True if the volumes are equal, False otherwise.