merge_horizontal¶

merge_horizontal(canvas, count, output_locs_y, canvas_np, output_locs, change_indices)[source]¶

Merge horizontal patches incrementally for each row of patches.

This function processes segments of NumPy patch arrays (canvas_np, count_np, output_locs) based on change_indices, merging them horizontally and appending the results to Dask arrays. It also updates the vertical output locations (output_locs_y_) for downstream vertical merging.

Parameters:
  • canvas (None | da.Array) – Existing Dask array for canvas data, or None if uninitialized.

  • count (None | da.Array) – Existing Dask array for count data, or None if uninitialized.

  • output_locs_y (np.ndarray) – Array tracking vertical output locations for merged patches.

  • canvas_np (np.ndarray) – NumPy array of canvas patches to be merged.

  • output_locs (np.ndarray) – Array of output locations for each patch.

  • change_indices (np.ndarray | list[np.ndarray]) – Indices indicating where to flush and merge patches.

Returns:

Updated canvas and count Dask arrays, along with remaining canvas_np, count_np, output_locs, and output_locs_y_ arrays after processing.

Return type:

tuple