Skip to content

Commit 56f25e3

Browse files
committed
Update function for getting center coordinates
1 parent a9c6e7c commit 56f25e3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

micro_sam/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def compute_iou(mask1, mask2):
288288
return iou
289289

290290

291-
def get_cell_center_coordinates(gt, mode="p"):
291+
def get_cell_center_coordinates(gt, mode="v"):
292292
"""
293293
Returns the center coordinates of the foreground instances in the ground-truth
294294
"""
@@ -300,6 +300,7 @@ def get_cell_center_coordinates(gt, mode="p"):
300300
center_coordinates = [prop.centroid for prop in properties]
301301
elif mode == "v":
302302
center_coordinates = vigra.filters.eccentricityCenters(gt.astype('float32'))
303+
center_coordinates.pop(0)
303304

304305
bbox_coordinates = [prop.bbox for prop in properties]
305306

test/test_prompt_generators.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ def test_point_prompt_generator(self):
1919
labels = self._get_test_data()
2020
label_ids = np.unique(labels)
2121

22-
mode = "v" # this gets center points using vigra - regionprops throws error for asymmetrical blobs
23-
centers, boxes = get_cell_center_coordinates(labels, mode=mode)
24-
if mode == "v":
25-
centers.pop(0) # to avoid the background element
22+
centers, boxes = get_cell_center_coordinates(labels)
2623

2724
test_point_pairs = [(1, 0), (1, 1), (2, 4), (3, 9)]
2825
for (n_pos, n_neg) in test_point_pairs:

0 commit comments

Comments
 (0)