From 6c8a31b27adec4556cee3de990179c31770d48e9 Mon Sep 17 00:00:00 2001 From: Joshua Gould Date: Fri, 12 Jul 2024 13:53:31 -0400 Subject: [PATCH] add skip_trailing_dim to _ravel_shape_indices --- dask_image/ndmeasure/_utils/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dask_image/ndmeasure/_utils/__init__.py b/dask_image/ndmeasure/_utils/__init__.py index 29a4e11d..28b0e1dd 100644 --- a/dask_image/ndmeasure/_utils/__init__.py +++ b/dask_image/ndmeasure/_utils/__init__.py @@ -48,7 +48,7 @@ def _ravel_shape_indices_kernel(*args): return sum(args2) -def _ravel_shape_indices(dimensions, dtype=int, chunks=None): +def _ravel_shape_indices(dimensions, dtype=int, chunks=None, skip_trailing_dim:bool=False): """ Gets the raveled indices shaped like input. """ @@ -61,7 +61,7 @@ def _ravel_shape_indices(dimensions, dtype=int, chunks=None): dtype=dtype, chunks=c ) - for i, c in enumerate(chunks) + for i, c in enumerate(chunks[:-1] if skip_trailing_dim else chunks) ] indices = da.blockwise(