MouseLand / suite2p

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

FEATURE: Return X Y matrix of ROI mask to visualize morphology across days #970

Closed neurovanlin closed 1 year ago

neurovanlin commented 1 year ago

Feature you'd like to see:

Return X Y matrix of ROI mask to visualize morphology across days

Attempted alternative approaches:

I am attempting to compare the ROI masks of my cells from different days in order to assess their qualitative similarity over time. Although I can reconstruct an alternative ROI using the center and radius information from the Fall.mat file, it does not assist me in achieving the desired comparison. Is there a method to obtain an XY matrix consisting of zeros and ones?

Additional Context

No response

carsen-stringer commented 1 year ago

please check out the stat.npy documentation and use the code here to retrieve ypix and xpix: https://suite2p.readthedocs.io/en/latest/outputs.html#stat-npy-fields

neurovanlin commented 1 year ago

Thank you for your prompt response.

I utilized the following code in Matlab to retrieve the X and Y pixels. However, the masks I obtained appear as squares instead of the morphology masks that I typically obtain from the Suite2p GUI (refer to the attached image). Is there a method to obtain X and Y with a morphology similar to that of the GUI?

Thank you in advance.

load('Fall.mat') im = zeros(ops.Ly, ops.Lx); ncells = numel(stat); for n = 1:ncells ypix = stat{n}.ypix(~stat{n}.overlap); xpix = stat{n}.xpix(~stat{n}.overlap); im(ypix, xpix) = n + 1; end imshow(im);

ExampleMasks bymatlab

carsen-stringer commented 1 year ago

Please use python, if that doesn't work we'll reopen the issue