Skip to content

Commit 6c3d6c0

Browse files
committed
fix cover image generation
1 parent 27fb850 commit 6c3d6c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bioimageio/spec/model/v0_5.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,6 +3540,7 @@ def normalize(
35403540

35413541
def to_2d_image(data: NDArray[Any], axes: Sequence[AnyAxis]):
35423542
original_shape = data.shape
3543+
original_axes = list(axes)
35433544
data, axes = squeeze(data, axes)
35443545

35453546
# take slice fom any batch or index axis if needed
@@ -3624,9 +3625,9 @@ def to_2d_image(data: NDArray[Any], axes: Sequence[AnyAxis]):
36243625
data, axes = squeeze(data, axes)
36253626
assert len(axes) == ndim
36263627

3627-
if (has_c_axis and ndim != 3) or ndim != 2:
3628+
if (has_c_axis and ndim != 3) or (not has_c_axis and ndim != 2):
36283629
raise ValueError(
3629-
f"Failed to construct cover image from shape {original_shape}"
3630+
f"Failed to construct cover image from shape {original_shape} with axes {[a.id for a in original_axes]}."
36303631
)
36313632

36323633
if not has_c_axis:

0 commit comments

Comments
 (0)