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

Poor outcome of PW-Rigid Motion Correction on 2P Data #1407

Open
mohammadsohaib opened this issue Sep 19, 2024 · 4 comments
Open

Poor outcome of PW-Rigid Motion Correction on 2P Data #1407

mohammadsohaib opened this issue Sep 19, 2024 · 4 comments

Comments

@mohammadsohaib
Copy link

Your setup:

  1. Operating System (Linux, MacOS, Windows): Linux
  2. Hardware type (x86, ARM..) and RAM: x86 , 64gb
  3. Python Version (e.g. 3.9): 3.11
  4. Caiman version (e.g. 1.9.12): 1.11.2
  5. Which demo exhibits the problem (if applicable):
  6. How you installed Caiman (pure conda, conda + compile, colab, ..): Custom installation (conda + compile)
  7. Details:
    Issue Description:
    I am encountering issues while running motion correction on my 2P imaging data using the pw-rigid method, as the results look worse than the original data. Previously, I attempted rigid correction, but it failed to produce satisfactory results, so I switched to pw-rigid. I have experimented with several parameter variations in pw-rigid, but the outcome remains suboptimal.

For validation, I have been analyzing both the maximum projection and correlation images as suggested in the demo. However, the motion-corrected images appear significantly degraded when compared to the original data.

I have attached a figure comparing the original and motion-corrected images, as well as a demo movie for reference.

Parameters Used:
PW-Rigid parameters:
image

Dataset-dependent parameters: Objective Zoom (1.5x) 20X lens, frame rate: 30, frame size: 512X512
I would appreciate any insights or suggestions on what might be causing this issue, and how to improve the motion correction process.

Thank you for your assistance.

image image

Link to the demo video: https://drive.google.com/file/d/1dC-sA7IWZwXLmfKHU2fP_mGZSqNFBUQN/view?usp=drive_link

@pgunn
Copy link
Member

pgunn commented Sep 19, 2024

Thanks for providing a download link; we'll give it a look. I'm hoping this is something we can fix with different parameters.

@kushalkolar
Copy link
Collaborator

those strides look way too huge

mesmerize-core can help you determine optimal params in a more structured way: https://github.com/nel-lab/mesmerize-core

@mohammadsohaib
Copy link
Author

@kushalkolar Thanks for the suggestion, I will look into mesmerise as well.
I did start with a small stride value eg:48 and then increased it.

@mohammadsohaib
Copy link
Author

mohammadsohaib commented Sep 26, 2024

@pgunn Could you provide any suggestions after reviewing the TIFF file?
@kushalkolar mesmerize-core looks promising, however, i ran into an error while running the demo.

I ran some more experiments, and upon viewing the TIFF files, it appears that the algorithm did a good job. However, I am a bit puzzled as to why the local correlation and maximum projection still look poor.

I also conducted some tests of my own, mimicking the logic of CaImAn motion correction, albeit in a simpler manner (just for a sanity check of motion correction). Using a rigid template, I was able to achieve a pretty good result visualised with normalized cross-correlation. This kind of hints that the caiman rigid motion correction would/might do a satisfactory job as well. However, these local correlations graphs always look bad.

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

3 participants