y_higher = min(arr.shape[2], y_idx + (size // 2) + 1)