linumpy.gpu.corrections#

GPU-accelerated correction operations for linumpy.

Functions#

fix_galvo_shift(volume, shift[, axis, use_gpu])

GPU-accelerated galvo shift correction.

detect_and_fix_galvo_shift(volume[, n_pixel_return, ...])

Detect and conditionally fix galvo shift.

Module Contents#

linumpy.gpu.corrections.fix_galvo_shift(volume, shift, axis=1, use_gpu=True)[source]#

GPU-accelerated galvo shift correction.

Parameters:
  • volume (np.ndarray) – Input volume

  • shift (int) – Shift amount in pixels

  • axis (int) – Axis along which to shift

  • use_gpu (bool) – Whether to use GPU

Returns:

Corrected volume

Return type:

np.ndarray

linumpy.gpu.corrections.detect_and_fix_galvo_shift(volume, n_pixel_return=40, threshold=0.5, axis=1, use_gpu=True)[source]#

Detect and conditionally fix galvo shift.

Note: Detection uses CPU (GPU offers no benefit). Only the fix uses GPU.

Parameters:
  • volume (np.ndarray) – Input volume (3D)

  • n_pixel_return (int) – Number of pixels in galvo return region

  • threshold (float) – Confidence threshold for applying fix (default 0.5, higher = more conservative)

  • axis (int) – A-line axis

  • use_gpu (bool) – Whether to use GPU for the fix operation

Returns:

  • np.ndarray – Corrected volume (or original if no fix needed)

  • dict – Detection results with ‘shift’, ‘confidence’, ‘fixed’ keys

Return type:

Any