Max projection in combined is all zeros if excluding flyback planes
Thank you for implementing flyback plane exclusion recently, which makes my workflow more seamless. A minor bug appeared with that though: When loading combined view from a dataset with excluded flyback frame(s), max projection is just empty/zeros. If the individual planes are loaded, max projection looks normal. I assume there is some (hopefully easily resolved) issue with rescaling the max projection if one or more planes are empty while combining the images.
Thank you for the great software and continuous improvements!
hmm not sure why the rescaling isn't working, this is where the combined file adds the max_proj files together: https://github.com/MouseLand/suite2p/blob/b0a7d6f403ffab32f3b0baed6412b6256dc22374/suite2p/io/save.py#L115. I'd appreciate if you can try running it and changing it for your purposes and opening a pull request. install suite2p in editable mode (git clone suite2p, change to the folder, then pip install -e .) and try modifying the function accordingly and testing in a jupyter notebook for instance
from suite2p.io.save import combined
combined(save_folder)
Thanks for the pointer.
I am not very familiar with github and don't actually know how to make a pull request. Nevertheless, looking into this, the issue seems that no max_projection is created in the skipped flyback frame's ops file. As any flyback frame tends to be the last plane and the last ops makes up the backbone for combined ops
in suite2p/suite2p/io/save.py
line 159: if 'max_proj' in ops: returns false
The simplest way to fix this I could think of was to change into:
line 159: if any(['max_proj' in ops for ops in ops1]):
which works for me! alternatively one could remove flyback frames from ops1 in line 79. sorry for the extra work changing this without a pull request. you may close this issue. Thanks again!
this is fixed now