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 motion correction and CNMF for 3D movies #300

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

ethanbb
Copy link
Collaborator

@ethanbb ethanbb commented Jun 14, 2024

The mcorr algorithm currently fails when run on a 3D movie during correlation image calculation. This is due to some code in caiman that could probably also be changed to get it to work (flatironinstitute/CaImAn#1363 does half of it), but this PR should fix mcorr in a way that is also compatible with existing caiman versions:

  • By passing the file in as a string rather than list, load_file_chain does not get called, which means is3D is not needed (otherwise this throws an error).
  • I added a try/catch that should catch the specific bug fixed in Fix removeBL for 3D movies flatironinstitute/CaImAn#1363 and tries again without baseline removal to avoid it.

This PR is dependent on #298 (to avoid an ugly merge) so I'm submitting it as a draft for now. Also, it would be good to add a test case for 3D motion correction (with test data and everything). But at least the current tests pass (except for the 2 that are always failing) so it doesn't break 2D mcorr.

@kushalkolar
Copy link
Collaborator

rebase this on main once #298 is merged

@ethanbb ethanbb changed the title Fix motion correction for 3D movies Fix motion correction and CNMF for 3D movies Jun 22, 2024
@kushalkolar
Copy link
Collaborator

wait until next release of caiman and then pin the next release of mescore to that

@ethanbb
Copy link
Collaborator Author

ethanbb commented Jul 24, 2024

Caiman PR is merged, but still waiting for next release to mark as ready for review.

@ethanbb
Copy link
Collaborator Author

ethanbb commented Jul 31, 2024

Caiman 1.11.2 is released

Copy link
Collaborator

@kushalkolar kushalkolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the response, few minor comments mostly because I haven't been keeping up with what's happening on caiman

mesmerize_core/algorithms/mcorr.py Show resolved Hide resolved
mesmerize_core/algorithms/cnmf.py Show resolved Hide resolved
@kushalkolar
Copy link
Collaborator

Lgtm!

@ethanbb ethanbb merged commit c42c035 into nel-lab:master Aug 22, 2024
0 of 5 checks passed
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.

2 participants