Closed EricThomson closed 1 year ago
Thanks for the details @EricThomson !
Are you setting your border pixel parameters when you run it yourself in a notebook?
This looks like it's either due to border pixel not being set in your notebook, or the nan border not being set in mesmerize for some reason.
Good point I did not mess with that, and that's almost certainly the culprit. I was a little confused about how to set it as a kwarg because with the "stop here" option it seemed there is only the gSig
parameter to tweak I assumed the kwarg window was only for when you go full CNMFE.
When I try to change params in the kwarg window (check Use CNMF kwargs
box, and set bord_px=0
or border_nan='copy'
-- or even border_pix=0
) the border_pix
parameter stays 12 so I am getting the same result.
But you are almost certainly right about the root of the problem: I haven't tried this yet but if I just go into the code and change it, it will be a reasonable workaround.
Are you setting the bord pix when running it in a notebook though? Mesmerize should set it automatically.
On Wed, Aug 4, 2021, 08:13 Eric Thomson @.***> wrote:
Good point I did not mess with that, and that's almost certainly the culprit. I was a little confused about how to set it as a kwarg because with the "stop here" option it seemed there is only the gSig parameter to tweak I assumed the kwarg window was only for when you go full CNMFE.
When I try to change params in the kwarg window (e.g., with bord_px=0 or border_nan='copy' or border_pix=0) the border_pix parameter stays 12 so I am getting the same result.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/kushalkolar/MESmerize/issues/62#issuecomment-892607639, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRCZVASPCGRVX3RCDNLT3EVINANCNFSM5BQADOEA .
Yes in my notebook I'm setting it to 0 (I use border_nan='copy'
) and this is what I was trying to recreate with kwargs after you pointed out this was likely the issue.
But that is it for sure: when I manually set bord_px
to 12 in my notebook, I get this same artifact. For now I can just tweak the relevant code in mesmerize (where it saves the memmapped file) to recreate my usual workflow until I get time.
Ah ok, what if you set the border manually in the notebook though?
On Wed, Aug 4, 2021, 12:46 Eric Thomson @.***> wrote:
Yes I'm setting it to 0, and using border_nan='copy' this is what I was trying to recreate with kwargs.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/kushalkolar/MESmerize/issues/62#issuecomment-892811408, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRB25I7HFUPW4GQR2ZLT3FVHLANCNFSM5BQADOEA .
Yes as I mentioned when I manually set bord_px
to 12 in my notebook (the same value it is being set to in mesmerize), I get the artifact so that is the issue.
Ah ok! In your notebook if you don't set border pix does CNMF pick up junk in the border area?
Yes it looks like it, but frankly I haven't played with this at all I have always just used border_nan='copy'
and sort of lived in ignorance of what that parameter did.
Or to be more precise, this (so I basically don't use the border pixel calculation spit out from motion correction):
bord_px = 0 if border_nan is 'copy' else bord_px
I think maybe just adding a border_pix option for this method would help. When I set bord_px
in the kwarg window for cnmfe it seems to work for the full cnmfe calculation. It's just for the correlation_pnr()
that there are problems. It wouldn't be a big deal but the artifact sometimes dominates the signal, making it hard to set pnr/corr values in the plot.
For now I'm just zeroing out bord_px
out in cnmfe.py around line 49 where it pulls it from the motion correction outputs, and it seems to be working fine.
@EricThomson So if I understand correctly, if there's a checkbox for border_nan='copy'
which sets that kwarg and simultaneously doesn't pass the bord_px
at all that would solve the issue? If so I could show you how to add this to GUI, takes 5 mins :D.
You'll just need to install qtcreator
, not sure how to do that on Windows though.
I think something like that would be good. Yes it would be great for me to start to learn to make these adjustments. I have a Linux machine with Qt Creator set up it might be better to do dev work there. Let me work on setting up a caiman/mesmerize environment on that machine this weekend, and getting Qt Creator resuscitated. I think maybe fewer headaches if I just do it on Ubuntu probably.
@EricThomson Do you want to make a PR for this sometime?
Yes that would probably be helpful. I can do a quick one soon (probably next weekend I'm about to get slammed this week in lab stuff).
Describe the bug When I run the "inspect correlation and pnr" step of cnmfe and look at the image, there are very large edge artifacts in both the correlation image and pnr image that are not present when I run the same method in caiman.
To Reproduce Steps to reproduce the behavior, for example:
Expected behavior Should look the same in both caiman and mesmerize.
Screenshots From caiman:![pnr_gsig7_caiman](https://user-images.githubusercontent.com/6643322/128107865-fd8e3a95-3357-4ed4-b661-9707f74fd859.png)
From mesmerize (note the bright artifact band around the outer edge of the image for both corr and pnr):![pnr_gsig7](https://user-images.githubusercontent.com/6643322/128107895-4609ea88-c39d-4b1b-92c8-6ccde5e2b7b0.png)
Operating System & specs (CPU, RAM etc.). Please complete the following information: Windows 10 128GB RAM Xeon Processor (2.4GHz)
Details about your Mesmerize install Mesmerize 0.7.1 installed using pip.
Additional comments I poked around in the source code: https://github.com/kushalkolar/MESmerize/blob/0b884e758a9fca2dac3e9106721ece5c0daf9f28/mesmerize/viewer/modules/batch_run_modules/CNMFE.py#L117
I can't see anything strange going on it is running the exact same method as the caiman code. This is truly a head-scratcher. I have seen since I started using mesmerize though so I know it's not just a one-off thing. I haven't dug very deeply into it would be nice to know if others see the same thing.