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!
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:
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!