etspy.base.TomoStack.stack_register(method: AlignmentMethod | 'PC' | 'COM' | 'COM-CL' | 'StackReg' = AlignmentMethod.PC, start: int | None = None, show_progressbar: bool = False, crop: bool = False, xrange: tuple[int, int] | None = None, p: int = 20, nslices: int = 20, com_ref_index: int | None = None, cl_ref_index: int | None = None, cl_resolution: float = 0.05, cl_div_factor: int = 8, cuda: bool = False, shift_type: 'interp' | 'fourier' = 'fourier') TomoStack[source]

Register stack spatially.

Options are phase correlation (PC) maximization, StackReg, center of mass (‘COM’), or combined center of mass and common line methods. See docstring for etspy.align.align_stack() for details.

Parameters:
method: AlignmentMethod | 'PC' | 'COM' | 'COM-CL' | 'StackReg' = AlignmentMethod.PC

Algorithm to use for registration calculation. Must be one of the values specified by the etspy.AlignmentMethod enum.

start: int | None = None

Position in tilt series to use as starting point for the alignment. If None, the central projection is used.

show_progressbar: bool = False

Enable/disable progress bar

crop: bool = False

If True, crop aligned stack to eliminate border pixels. Default is False.

xrange: tuple[int, int] | None = None

(Only used when method ==COM) The range for performing alignment. See calculate_shifts_com() for more details.

p: int = 20

(Only used when method ==COM) Padding element. See calculate_shifts_com() for more details.

nslices: int = 20

(Only used when method ==COM) Number of slices to return. See calculate_shifts_com() for more details.

com_ref_index: int | None = None

(Only used when method ==COM_CL) Reference slice for center of mass alignment. All other slices will be aligned to this reference. If not provided, the midpoint of the stack will be chosen. See calc_shifts_com_cl() for more details.

cl_ref_index: int | None = None

(Only used when method ==COM_CL) Reference slice for common line alignment. All other slices will be aligned to this reference. If not provided, the midpoint of the stack will be chosen.

cl_resolution: float = 0.05

(Only used when method ==COM_CL) Resolution for subpixel common line alignment. Default is 0.05. Should be less than 0.5. See calc_shifts_com_cl() for more details.

cl_div_factor: int = 8

(Only used when method ==COM_CL) Factor which determines the number of iterations of common line alignment to perform. Default is 8. See calc_shifts_com_cl() for more details.

cuda: bool = False

Whether or not to use CUDA-accelerated reconstruction algorithms.

shift_type: 'interp' | 'fourier' = 'fourier'

Calculated 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’.

Returns:

out – Spatially registered copy of the input stack

Return type:

TomoStack

Examples

Registration with phase correlation algorithm (PC)
>>> import etspy.datasets as ds
>>> stack = ds.get_needle_data()
>>> regPC = stack.stack_register('PC')
Registration with center of mass tracking (COM)
>>> import etspy.datasets as ds
>>> stack = ds.get_needle_data()
>>> regCOM = stack.stack_register('COM')
Registration with StackReg
>>> import etspy.datasets as ds
>>> stack = ds.get_needle_data()
>>> regSR = stack.stack_register('StackReg')
Registration with center of mass and common line (COM-CL)
>>> import etspy.datasets as ds
>>> stack = ds.get_needle_data()
>>> regCOMCL = stack.stack_register('COM-CL')