File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 55from napari import Viewer
66from napari .utils import progress
77from scipy .ndimage import shift
8- from vigra .filters import eccentricityCenters
8+
9+ # this is more precise for comuting the centers, but slow!
10+ # from vigra.filters import eccentricityCenters
911
1012from .. import util
1113from ..segment_from_prompts import segment_from_mask , segment_from_points
2325def _compute_movement (seg , t0 , t1 ):
2426
2527 def compute_center (t ):
26- center = np .array (eccentricityCenters (seg [t ].astype ("uint32" )))
27- assert center .shape == (2 , 2 )
28- return center [1 ]
28+
29+ # computation with vigra eccentricity centers (too slow)
30+ # center = np.array(eccentricityCenters(seg[t].astype("uint32")))
31+ # assert center.shape == (2, 2)
32+ # return center[1]
33+
34+ # computation with center of mass
35+ center = np .where (seg [t ] == 1 )
36+ center = np .array (np .mean (center [0 ]), np .mean (center [1 ]))
37+ return center
2938
3039 center0 = compute_center (t0 )
3140 center1 = compute_center (t1 )
You can’t perform that action at this time.
0 commit comments