-
etspy.base.TomoStack.stack_register(method: AlignmentMethod | 'PC' | 'COM' | 'COM-CL' | 'StackReg' =
AlignmentMethod.PC, start: int | None =None, show_progressbar: bool =False, cuda: bool | None =False, crop: bool =False, shift_type: 'interp' | 'fourier' ='fourier', **kwargs) 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.AlignmentMethodenum.- 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
- cuda: bool | None =
False¶ Whether or not to use CUDA-accelerated reconstruction algorithms.
- crop: bool =
False¶ If True, crop aligned stack to eliminate border pixels. Default is False.
- 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’.
- **kwargs
Remaining keyword arguments are passed to the underlying alignment functions.
- include : Keyword arguments that may be used
- xrange
(Only used when
method ==COM) The range for performing alignment. Seecalculate_shifts_com()for more details.- p
(Only used when
method ==COM) Padding element. Seecalculate_shifts_com()for more details.- nslices
(Only used when
method ==COM) Number of slices to return. Seecalculate_shifts_com()for more details.- com_ref_index
(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. Seecalc_shifts_com_cl()for more details.- cl_ref_index
(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
(Only used when
method ==COM_CL) Resolution for subpixel common line alignment. Default is 0.05. Should be less than 0.5. Seecalc_shifts_com_cl()for more details.- cl_div_factor
(Only used when
method ==COM_CL) Factor which determines the number of iterations of common line alignment to perform. Default is 8. Seecalc_shifts_com_cl()for more details.
- method: AlignmentMethod | 'PC' | 'COM' | 'COM-CL' | 'StackReg' =
- Returns:¶
out – Spatially registered copy of the input stack
- Return type:¶
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')