Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Use bool dtype for good tiles mask #152

Merged
merged 1 commit into from
Apr 25, 2023
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
2 changes: 1 addition & 1 deletion benchmarks/filter_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def gen_signal_array(ny, nx):
)

# Use random data for mask data
mask = np.random.randint(low=0, high=2, size=(42, 32), dtype=np.uint8)
mask = np.random.randint(low=0, high=2, size=(42, 32), dtype=bool)

# Fill up the 3D filter with planes
for plane in signal_array:
Expand Down
2 changes: 1 addition & 1 deletion src/cellfinder_core/detect/filters/plane/plane_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_tile_mask(self, plane: da.array) -> Tuple[np.ndarray, np.ndarray]:
# Get tiles that are within the brain
walker = TileWalker(plane, self.soma_diameter)
walker.mark_bright_tiles()
inside_brain_tiles = walker.bright_tiles_mask.astype(np.uint8)
inside_brain_tiles = walker.bright_tiles_mask

# Threshold the image
thresholded_img = enhance_peaks(
Expand Down
2 changes: 1 addition & 1 deletion src/cellfinder_core/detect/filters/volume/ball_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(
int(np.ceil(plane_height / tile_step_height)),
ball_z_size,
),
dtype=np.uint8,
dtype=bool,
)
# Stores the z-index in volume at which new planes are inserted when
# append() is called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def ball_filter_imgs(
) -> Tuple[np.ndarray, List[Point]]:
# OPTIMISE: reuse ball filter instance

good_tiles_mask = np.ones((1, 1, volume.shape[2]), dtype=np.uint8)
good_tiles_mask = np.ones((1, 1, volume.shape[2]), dtype=bool)

plane_width, plane_height = volume.shape[:2]

Expand Down