Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/tracksdata/nodes/_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def _nd_sphere(
"""

if ndim == 2:
return morph.disk(radius)
return morph.disk(radius).astype(bool)

if ndim == 3:
return morph.ball(radius)
return morph.ball(radius).astype(bool)

raise ValueError(f"Spherical is only implemented for 2D and 3D, got ndim={ndim}")

Expand Down
1 change: 1 addition & 0 deletions src/tracksdata/nodes/_test/test_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def test_mask_from_coordinates_2d_basic() -> None:
# Should be a disk of radius 2, shape (5,5), centered at (5,5)
assert mask.mask.shape == (5, 5)
assert mask.mask[2, 2] # center pixel is True
assert mask.mask.dtype == bool
np.testing.assert_array_equal(mask.bbox, [3, 3, 8, 8])


Expand Down
Loading