linumpy.stack_alignment.io#
CSV loading and cumulative shift computation.
Functions#
|
Load shifts CSV and build cumulative shift lookup. |
|
Build cumulative pixel shifts for selected slices. |
Module Contents#
- linumpy.stack_alignment.io.load_shifts_csv(shifts_path)[source]#
Load shifts CSV and build cumulative shift lookup.
The shifts file contains pairwise shifts: fixed_id -> moving_id in mm. Accumulates these to get absolute positions from the first slice.
- linumpy.stack_alignment.io.build_cumulative_shifts(shifts_df, selected_slice_ids, resolution, center_drift=True)[source]#
Build cumulative pixel shifts for selected slices.
Handles skipped slices by accumulating intermediate steps. Converts mm shifts to pixels using the provided resolution.
- Parameters:
shifts_df (pd.DataFrame) – DataFrame with columns: fixed_id, moving_id, x_shift_mm, y_shift_mm
selected_slice_ids (list) – Sorted list of slice IDs to process.
resolution (tuple) – Resolution (res_z, res_y, res_x) from read_omezarr; auto-detects mm vs µm.
center_drift (bool) – If True, center cumulative drift around the middle slice.
- Returns:
Mapping from slice_id to (cumulative_dx_px, cumulative_dy_px).
- Return type: