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

apply_shifts_movie: Memory mapping block not generalized for 3D movies? #1482

Open
rcalfredson opened this issue Mar 5, 2025 · 0 comments
Open

Comments

@rcalfredson
Copy link

In the function apply_shifts_movie (see line 477 of the current version), the block that saves the memory-mapped file uses the following code:

big_mov[:] = np.reshape(m_reg.transpose(1, 2, 0), (np.prod(dims[1:]), dims[0]), order='F')

This transpose call (m_reg.transpose(1, 2, 0)) is hardcoded for a 3D array corresponding to a 2D movie (with shape (n_frames, height, width)). It works correctly for 2D movies but fails to generalize when the movie data is 3D (e.g., having a shape like (n_frames, height, width, depth)).

It seems like switching to moveaxis resolves this for both 2D and 3D, like this:

big_mov[:] = np.reshape(np.moveaxis(m_reg, 0, -1), (np.prod(dims[1:]), dims[0]), order='F')

Could this be a change work making to the function? Thanks very much.

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

No branches or pull requests

1 participant