Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix channel_axis bug in transforms.py #688

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions cellpose/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def convert_image(x, channels, channel_axis=None, z_axis=None,
x = x.squeeze()

# put z axis first
if z_axis is not None and x.ndim > 2:
if z_axis is not None and x.ndim > 2 and z_axis != 0:
x = move_axis(x, m_axis=z_axis, first=True)
if channel_axis is not None:
channel_axis += 1
Expand Down Expand Up @@ -770,4 +770,4 @@ def random_rotate_and_resize(X, Y=None, scale_range=1., xy = (224,224),
lbl[n,1] = (-v1 * np.sin(-theta) + v2*np.cos(-theta))
lbl[n,2] = (v1 * np.cos(-theta) + v2*np.sin(-theta))

return imgi, lbl, scale
return imgi, lbl, scale