MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
334 stars 239 forks source link

BUG: ROI coordinates shifted in y-axis with respect to manually-drawn Ellipse #1125

Open yzerlaut opened 1 month ago

yzerlaut commented 1 month ago

Describe the issue:

Dear Suite2p developers,

I noticed a small shift in y-coordinates between the manually-drawn ROIs and the actual pixels used to define the ROI fluorescence. This shift seems proportional to the height of the ellipse. For thin pieces of dendrites with rotated ROIs, it can be quite problematic. You can find an example below.

Here is the selection in the manual_labelling GUI:

Pasted Graphic

Here is the selection in the main GUI:

Pasted Graphic 1

Note the fact that it's not centered anymore on the dendrite.

This is worst with rotations:

image

versus:

image

I re-did the ellipse coordinates calculation to fix the ROI pixel values (see https://github.com/yzerlaut/suite2p/commit/af26542016ec22408e18f312c091e2a81a89fae6). I think it fixed it:

A few ellipses manually drawn:

Pasted Graphic 3

And their respective ROIs in the GUI:

Pasted Graphic 4

If this bug is reproduced by others, I could also do a PR.

Best, yann

P.S. 1) Thank you very much for sharing and maintaining this amazing piece of software ! P.S. 2) Just to let you know. I am adding on my fork the python support for other ROI shapes (RectROI, PolyLineROI) in case you would be interested by a PR.

Reproduce the code example:

draw a ROI in "manual_labeling" GUI and note the y-shift in the ROI pixels

Error message:

No response

Version information:

v0.9.3.dev528+gc88e1ba.d20240604

Context for the issue:

This bug impedes to select pieces of thin dendritic segments.