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

Don't filter out NaNs for contours #309

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions mesmerize_core/caiman_extensions/cnmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ def get_contours(
) -> Tuple[List[np.ndarray], List[np.ndarray]]:
"""
Get the contour and center of mass for each spatial footprint
Note, the centers of mass are different from those computed by CaImAn.
They are based on the contours and can be used to compute click targets for visualizations.

Parameters
----------
Expand Down Expand Up @@ -303,10 +305,9 @@ def get_contours(

for contour in contours:
coors = contour["coordinates"]
coors = coors[~np.isnan(coors).any(axis=1)]
coordinates.append(coors)

com = coors.mean(axis=0)
com = np.nanmean(coors, axis=0)
coms.append(com)

return coordinates, coms
Expand Down
Loading