vreg.volume#

vreg.volume(values: ndarray, affine: ndarray | None = None, orient='axial', rotation=None, center=None, spacing=1.0, pos=[0, 0, 0])[source]#

Create a new volume from an array of values

Parameters:
  • values (array) – 2D or 3D array of values.

  • affine (array, optional) – 4x4 affine array. If this is not provided, the affine array is constructed from the other arguments. Defaults to None.

  • orient (str, optional) – Orientation of the volume. The options are ‘axial’, ‘sagittal’, or ‘coronal’. Alternatively the same options can be provided referring to the orientation of the image planes: ‘xy’, ‘yz’ or ‘zx’. Note while ‘xy’ and ‘yz’ mean exactly the same as ‘axial’ and ‘sagittal’, respectively, ‘zx’ differs from coronal in the orientation of the z-axis. While ‘zx’ forms a right-handed reference frame, ‘coronal’ is left-handed following the common convention in medical imaging.Defaults to ‘axial.

  • rotation (array, optional) – 3-element array specifying a rotation relative to orient. Defaults to None.

  • center (array, optional) – 3-element array specifying the rotation center, in case a rotation is provided. Defaults to None.

  • spacing (float, optional) – Pixel spacing in mm. Can be a 3D array or a single scalar for isotropic spacing. Defaults to 1.0.

  • pos (list, optional) – Position of the upper left-hand corner in mm. Defaults to [0,0,0].

Returns:

volume with required orientation and position.

Return type:

vreg.Volume3D