cortex-lab / Suite2P

Tools for processing 2P recordings
Other
120 stars 65 forks source link

How to tweak ROI refinement process #156

Open lachioma opened 5 years ago

lachioma commented 5 years ago

The cell detection algorithm seems to work very well on my data. However, I lose several cells in the refinement process (see below, right image is before refinement). How can I improve this step?

I tried changing the neuropil options (ops0.innerNeuropil, ops0.ratioNeuropil) but it did not seem to help.

picture1

P.s. Many thanks for the help and for providing such a great tool!

marius10p commented 5 years ago

I am aware of that problem, it happens because the first optimization uses spatial smoothing, but this is disabled during refinement so we can get more spatially sharp masks. When a cell has relatively low SNR, or high SNR but few frames, then the refinement can exclude pixels like in your case. It could also be that the cells have SNR relatively heterogeneously across its surface and that's why lower SNR pixels get dropped.

The best plan right now would be to try the other branch or wait until I pull it in. It is a significant change in the refinement step which was partly meant to address exactly this kind of thing. It will also be the last big update for a while, bringing the Matlab version up to date with the Python version.

If you want to continue with this version, you can try reducing the number of SVDs:

ops0.nSVDforROI = 1000; % if you're data is really short, you could go as low as 100-200.

lachioma commented 5 years ago

Ok, thank you very much for the clear answer.

So you would generally suggest to use the Python version? I thought that the Python and Matlab versions were at the same version, but that just the GUI and the documentation were better for Python (as mentioned in the readme of Matlab Suite2P).

lachioma commented 5 years ago

What about switching off the refinement? Do you think that the ROIs would then result not accurate enough?