suite2p icon indicating copy to clipboard operation
suite2p copied to clipboard

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

Open yzerlaut opened this issue 1 year ago • 1 comments

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.

yzerlaut avatar Jun 05 '24 13:06 yzerlaut

Implemented the fix and it works great. Thanks

davidfoub avatar Aug 12 '24 18:08 davidfoub