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

BUG: chan2detect intensity_ratio function using meanImg_chan2 instead of meanImg_chan2_corrected #1061

Open
mariacozan opened this issue Nov 21, 2023 · 0 comments

Comments

@mariacozan
Copy link

mariacozan commented Nov 21, 2023

Describe the issue:

I was trying to understand how suite2p determines which ROIs are considered as also being present in the second channel so I started going into the source code. I noticed that there is a function which corrects for bleed through from the green channel which is great. However, I also noticed that when the intensity_ratio is used to actually detect red cells, the meanImg_chan2 is used instead of meanImg_chan2_corrected to get the intensity values. So I was just wondering if perhaps the corrected image should be used instead? Otherwise, unless I missed it, I don't see the meanImg_chan2_corrected being used anywhere else except for visualisation purposes.

Reproduce the code example:

def intensity_ratio(ops, stats):
    """ compute pixels in cell and in area around cell (including overlaps)
        (exclude pixels from other cells) """
 .
 .
 .

# here in line 70 perhaps it should be:

mimg2 = ops["meanImg_chan2_corrected"]
#instead of:
    mimg2 = ops["meanImg_chan2"]
    inpix = cell_masks @ mimg2.flatten()
    extpix = neuropil_masks @ mimg2.flatten()
    inpix = np.maximum(1e-3, inpix)
    redprob = inpix / (inpix + extpix)
    redcell = redprob > ops["chan2_thres"]
    return np.stack((redcell, redprob), axis=-1)

Error message:

No response

Version information:

v0.10.4.dev9+gf93c1ca.d20220615

Context for the issue:

This could hopefully make the red cell detection more accurate. Many thanks!

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

1 participant