We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7907e5 commit 2c666afCopy full SHA for 2c666af
spatiomic/segment/_assign_communities.py
@@ -50,8 +50,9 @@ def assign_communities(
50
# Initialize output with same shape as masks
51
community_image = np.zeros_like(masks)
52
53
- # Assign community labels (adding 1 to avoid confusion with background)
+ # Assign community labels (adding 1 to avoid confusion with background, if needed)
54
+ pseudocount = 1 if communities_array.min() == 0 else 0
55
for i, region_id in enumerate(unique_regions):
- community_image[masks == region_id] = communities_array[i] + 1
56
+ community_image[masks == region_id] = communities_array[i] + pseudocount
57
58
return community_image
0 commit comments