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

Conversation

nickeener
Copy link
Contributor

Found a bug while running the command line version of the tool. If you give it a multi-z multi-channel image with a dimension order of (z, ch, y, x) (as suggested in the documentation) and correctly set the --z_axis parameter to 0 and the --channel_axis parameter to 1, this chunk of code in convert_image() of transforms.py:

# put z axis first
if z_axis is not None and x.ndim > 2:
    x = move_axis(x, m_axis=z_axis, first=True)
    if channel_axis is not None:
        channel_axis += 1
    if x.ndim==3:
        x = x[...,np.newaxis]

shouldn't change the image at all since the z_axis is already first but it will still add 1 to channel_axis, making it wrong because the z_axis wasn't moved. Adding an additional check before running this chunk to make sure the z_axis needs to be moved fixes this.

@carsen-stringer carsen-stringer merged commit 28ddc24 into MouseLand:main Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants