dbdicom.extensions.vreg.rotate#

dbdicom.extensions.vreg.rotate(series: Series, parameters: ndarray, reshape=False, output_shape: tuple | None = None, output_affine: ndarray | None = None, mode='constant', **kwargs) Series[source]#

Rotate a series in 3D

Parameters:
  • series (dbdicom.Series) – Series containing the volume to be rotated.

  • parameters (np.ndarray) – 3-element numpy array with values of the rotation vector. The vectors are defined in the absolute (scanner) reference frame in units of mm.

  • reshape (bool, optional) – if True, the array size and affine will be adjusted to contain the complete rotate data. If False, the original array size and affine is retained. Defaults to True.

  • output_shape (tuple, optional) – determines the shape of the result. If not provided, the shape of the original (reshape=False) or reshaped array (reshape=True) is used. Defaults to False.

  • output_affine (ndarray, optional) – determines the affine of the result. If not provided, the affine of the original (reshape=False) or reshaped array (reshape=True) is used. Defaults to None.

  • mode (str, optional) – Determines how the input array is extended beyond its boundaries. See scipy.ndimage.map_coordinates for more detail. Defaults to constant = 0.

  • kwargs – List of optionional arguments specifying valid DICOM (keyword = value) pairs.

Raises:
  • ValueError – If the moving series contains multiple slice groups with different orentations.

  • ValueError – If the array to be moved is empty.

Returns:

Sibling dbdicom series in the same study, containing the rotated volume.

Return type:

dbdicom.Series

Examples using dbdicom.extensions.vreg.rotate#

Rotate and translate

Rotate and translate