xmcdpy.shifts¶
- xmcdpy.shifts.apply_shift(img, shift)¶
Apply the shift to the img
- xmcdpy.shifts.apply_stack_shifts(images, shifts)¶
Applies the list of shifts to the images. Images need to be a numpy array with last axis listing images.
- Parameters
images ((n,m, k) array) – Stack of images
shifts (list of (2,) arrays) – Shifts per image
- Returns
shifted images
- Return type
(n,m,k) array
- xmcdpy.shifts.get_stack_shifts(images, ref_image=None, rect_coord=None, upsample_factor=10, gaussian_sigma=5)¶
Returns the list of shifts for the images in the stack. Rect parameter specifies the coordinates of the region of interest
- Parameters
images ((n,m,k) array) – stack of images
ref_image ((n,m) array, optional) – Image to align to. If None, use the first image in the stack. Defaults to None.
rect_coord ((4,) array, optional) – ROI coordinates. Defaults to None.
upsample_factor (int, optional) – Defaults to 10.
gaussian_sigma (int, optional) – Blur to apply to get rid of high frequency noise. Defaults to 5.
- xmcdpy.shifts.stack_shifts(images_stack, rect_coord, alignment_threshold=0.25, start_upsample=1, max_iter=7, gaussian_sigma=5)¶
Finds the shifts based on the alignment stack and applies them to the image stack
- Parameters
images_stack ((n,m, k) array) – Stack of images
rect_coord ((4,) array, optional) – ROI coordinates.
alignment_threshold (float, optional) – See align_stack. Defaults to 0.25.
start_upsample (int, optional) – initial upsample. It will increase until it reaches 3/alignment_threshold. Defaults to 1.
max_iter (int, optional) – Maximum number of alignment iterations. Defaults to 7.
gaussian_sigma (int, optional) – Blur to apply for the alignment. See get_stack_shifts. Defaults to 5.
- Returns
Shifted images
- Return type
(n,m, k) array