diff --git a/mesmerize_core/caiman_extensions/cnmf.py b/mesmerize_core/caiman_extensions/cnmf.py index 653ea9d..0cbef07 100644 --- a/mesmerize_core/caiman_extensions/cnmf.py +++ b/mesmerize_core/caiman_extensions/cnmf.py @@ -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 ---------- @@ -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