vreg.Volume3D#
- class vreg.Volume3D(values: ndarray, affine: ndarray)[source]#
A spatially aware numpy array
- Parameters:
values (np.ndarray) – 2D or 3D numpy array with values
affine (np.ndarray) – 4x4 numpy array with the affine matrix of the value array. If not provided, the identity is assumed. Defaults to None.
Methods
add
(v, *args, **kwargs)Add another volume
bounding_box
([mask, margin])Return the bounding box
center_of_mass
([coords])Center of mass.
copy
(**kwargs)Return a copy
distance
(target, transform, params[, ...])Distance to a target volume after a transform
extract_slice
([z])Extract a slice at index z
find_rotate_to
(target[, rotation, metric, ...])Find the rigid transform to a static target volume.
find_transform_rigid_to
(target[, params, ...])Find the rigid transform to a static target volume.
find_transform_to
(target, transform[, ...])Coregister a volume to a static target volume.
find_translate_to
(target[, translation, ...])Find the translation to a static target volume.
resample
([spacing, stretch])Resample volume to new pixel spacing
reslice
([affine, orient, rotation, center, ...])Reslice the volume.
rotate
(rotation[, center, values, reshape, ...])Rotate the volume.
rotate_to
(target, rotation[, center, coords])Apply a rotation and reslice the result to the geometry of a target volume.
slice_like
(v)Slice the volume to the geometry of another volume
split
([n, axis, gap])Split a volume into slices (2D volumes)
stretch
(stretch[, values, reshape])Stretch the volume.
stretch_to
(target, stretch)Stretch and reslice to the geometry of a target volume.
subtract
(v, *args, **kwargs)Subtract another volume
transform
(transform, params, **kwargs)Transform a volume
transform_affine
(params[, center, values, ...])Apply an affine transformation.
transform_affine_to
(target, params[, ...])Apply an affine transformation and reslice the result to the geometry of a target volume.
transform_rigid
(params[, values, reshape, ...])Apply a rigid transformation.
transform_rigid_to
(target, params[, center, ...])Apply a rigid transformation and reslice the result to the geometry of a target volume.
transform_to
(target, transform, params, **kwargs)Transform a volume to a target volume
translate
(translation[, values, reshape, ...])Translate the volume.
translate_to
(target, translation[, coords, dir])Apply a translation and reslice the result to the geometry of a target volume.
Attributes