etspy.align.apply_shifts(stack: TomoStack, shifts: TomoShifts | ndarray, method: 'interp' | 'fourier' = 'fourier', cuda: bool = False, **kwargs) TomoStack[source]

Apply a series of shifts to a TomoStack.

Shifts are applied to the data using either interpolation or Fourier shift methods. These operations are carried out using either CPU or GPU resources depending on the value of cuda. If cuda is True, the shifts will be applied using GPU-acceleration via CuPy. The shifts are stored in shifted.metadata.Tomography.shifts.

Parameters:
stack: TomoStack

The image series to be aligned

shifts: TomoShifts | ndarray

The X- (tilt parallel) and Y-shifts (tilt perpendicular) to be applied to each image. Should be of size (*stack.axes_manager.navigation_shape[::-1], 2), with Y-shifts in the shifts[:, 0] position and X-shifts in shifts[:, 1] position (if shifts is a ndarray).

method: 'interp' | 'fourier' = 'fourier'

Image shifts can be applied using either interpolation via scipy.ndimage.shift or via Fourier shift as implemented in scipy.ndimage.fourier_shift. Must be either ‘interp’ or ‘fourier’.

cuda: bool = False

Enable/disable the use of GPU-accelerated processes using CUDA. If True, shifts will be applied using CuPy. If False, shifts will be applied using NumPy and SciPy.

Returns:

shifted – Copy of input stack after shifts are applied

Return type:

TomoStack