Skip to content
Draft
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
110 changes: 64 additions & 46 deletions benchmarks/benchmarks/cellfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,29 +204,38 @@ def setup(self):

def time_cellfinder_run(self):
cellfinder_run(
self.signal_array,
self.background_array,
self.cfg.voxel_sizes,
self.cfg.start_plane,
self.cfg.end_plane,
self.cfg.trained_model,
self.cfg.model_weights,
self.cfg.model,
self.cfg.batch_size,
self.cfg.n_free_cpus,
self.cfg.network_voxel_sizes,
self.cfg.soma_diameter,
self.cfg.ball_xy_size,
self.cfg.ball_z_size,
self.cfg.ball_overlap_fraction,
self.cfg.log_sigma_size,
self.cfg.n_sds_above_mean_thresh,
self.cfg.soma_spread_factor,
self.cfg.max_cluster_size,
self.cfg.cube_width,
self.cfg.cube_height,
self.cfg.cube_depth,
self.cfg.network_depth,
signal_array=self.signal_array,
background_array=self.background_array,
voxel_sizes=self.cfg.voxel_sizes,
start_plane=self.cfg.start_plane,
end_plane=self.cfg.end_plane,
trained_model=self.cfg.trained_model,
model_weights=self.cfg.model_weights,
model=self.cfg.model,
classification_batch_size=self.cfg.classification_batch_size,
n_free_cpus=self.cfg.n_free_cpus,
network_voxel_sizes=self.cfg.network_voxel_sizes,
soma_diameter=self.cfg.soma_diameter,
ball_xy_size=self.cfg.ball_xy_size,
ball_z_size=self.cfg.ball_z_size,
ball_overlap_fraction=self.cfg.ball_overlap_fraction,
log_sigma_size=self.cfg.log_sigma_size,
n_sds_above_mean_thresh=self.cfg.n_sds_above_mean_thresh,
n_sds_above_mean_tiled_thresh=self.cfg.n_sds_above_mean_tiled_thresh,
tiled_thresh_tile_size=self.cfg.tiled_thresh_tile_size,
soma_spread_factor=self.cfg.soma_spread_factor,
max_cluster_size=self.cfg.max_cluster_size,
cube_width=self.cfg.cube_width,
cube_height=self.cfg.cube_height,
cube_depth=self.cfg.cube_depth,
network_depth=self.cfg.network_depth,
detection_batch_size=self.cfg.detection_batch_size,
torch_device=self.cfg.torch_device,
pin_memory=self.cfg.pin_memory,
normalize_channels=self.cfg.normalize_channels,
normalization_down_sampling=self.cfg.normalization_down_sampling,
detect_centre_of_intensity=self.cfg.detect_centre_of_intensity,
classification_max_workers=self.cfg.classification_max_workers,
)


Expand All @@ -244,29 +253,38 @@ def setup(self):

# detect cells
self.detected_cells = cellfinder_run(
self.signal_array,
self.background_array,
self.cfg.voxel_sizes,
self.cfg.start_plane,
self.cfg.end_plane,
self.cfg.trained_model,
self.cfg.model_weights,
self.cfg.model,
self.cfg.batch_size,
self.cfg.n_free_cpus,
self.cfg.network_voxel_sizes,
self.cfg.soma_diameter,
self.cfg.ball_xy_size,
self.cfg.ball_z_size,
self.cfg.ball_overlap_fraction,
self.cfg.log_sigma_size,
self.cfg.n_sds_above_mean_thresh,
self.cfg.soma_spread_factor,
self.cfg.max_cluster_size,
self.cfg.cube_width,
self.cfg.cube_height,
self.cfg.cube_depth,
self.cfg.network_depth,
signal_array=self.signal_array,
background_array=self.background_array,
voxel_sizes=self.cfg.voxel_sizes,
start_plane=self.cfg.start_plane,
end_plane=self.cfg.end_plane,
trained_model=self.cfg.trained_model,
model_weights=self.cfg.model_weights,
model=self.cfg.model,
classification_batch_size=self.cfg.classification_batch_size,
n_free_cpus=self.cfg.n_free_cpus,
network_voxel_sizes=self.cfg.network_voxel_sizes,
soma_diameter=self.cfg.soma_diameter,
ball_xy_size=self.cfg.ball_xy_size,
ball_z_size=self.cfg.ball_z_size,
ball_overlap_fraction=self.cfg.ball_overlap_fraction,
log_sigma_size=self.cfg.log_sigma_size,
n_sds_above_mean_thresh=self.cfg.n_sds_above_mean_thresh,
n_sds_above_mean_tiled_thresh=self.cfg.n_sds_above_mean_tiled_thresh,
tiled_thresh_tile_size=self.cfg.tiled_thresh_tile_size,
soma_spread_factor=self.cfg.soma_spread_factor,
max_cluster_size=self.cfg.max_cluster_size,
cube_width=self.cfg.cube_width,
cube_height=self.cfg.cube_height,
cube_depth=self.cfg.cube_depth,
network_depth=self.cfg.network_depth,
detection_batch_size=self.cfg.detection_batch_size,
torch_device=self.cfg.torch_device,
pin_memory=self.cfg.pin_memory,
normalize_channels=self.cfg.normalize_channels,
normalization_down_sampling=self.cfg.normalization_down_sampling,
detect_centre_of_intensity=self.cfg.detect_centre_of_intensity,
classification_max_workers=self.cfg.classification_max_workers,
)

def time_save_cells(self):
Expand Down
62 changes: 36 additions & 26 deletions brainglobe_workflows/brainmapper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,27 @@ def run_all(args, what_to_run, atlas):
)

points = detect.main(
signal_array,
args.start_plane,
args.end_plane,
args.voxel_sizes,
args.soma_diameter,
args.max_cluster_size,
args.ball_xy_size,
args.ball_z_size,
args.ball_overlap_fraction,
args.soma_spread_factor,
args.n_free_cpus,
args.log_sigma_size,
args.n_sds_above_mean_thresh,
signal_array=signal_array,
start_plane=args.start_plane,
end_plane=args.end_plane,
voxel_sizes=args.voxel_sizes,
soma_diameter=args.soma_diameter,
max_cluster_size=args.max_cluster_size,
ball_xy_size=args.ball_xy_size,
ball_z_size=args.ball_z_size,
ball_overlap_fraction=args.ball_overlap_fraction,
soma_spread_factor=args.soma_spread_factor,
n_free_cpus=args.n_free_cpus,
log_sigma_size=args.log_sigma_size,
n_sds_above_mean_thresh=args.n_sds_above_mean_thresh,
n_sds_above_mean_tiled_thresh=args.n_sds_above_mean_tiled_thresh,
tiled_thresh_tile_size=args.tiled_thresh_tile_size,
save_planes=args.save_planes,
plane_directory=args.plane_directory,
batch_size=args.detection_batch_size,
torch_device=args.torch_device,
pin_memory=args.pin_memory,
detect_centre_of_intensity=args.detect_centre_of_intensity,
)
ensure_directory_exists(args.paths.points_directory)

Expand Down Expand Up @@ -166,19 +172,23 @@ def run_all(args, what_to_run, atlas):
background_array = read_z_stack(args.background_planes_path[0])

points = classify.main(
points,
signal_array,
background_array,
args.n_free_cpus,
args.voxel_sizes,
args.network_voxel_sizes,
args.batch_size,
args.cube_height,
args.cube_width,
args.cube_depth,
args.trained_model,
model_weights,
args.network_depth,
points=points,
signal_array=signal_array,
background_array=background_array,
n_free_cpus=args.n_free_cpus,
voxel_sizes=args.voxel_sizes,
network_voxel_sizes=args.network_voxel_sizes,
batch_size=args.classification_batch_size,
cube_height=args.cube_height,
cube_width=args.cube_width,
cube_depth=args.cube_depth,
trained_model=args.trained_model,
model_weights=model_weights,
network_depth=args.network_depth,
pin_memory=args.pin_memory,
normalize_channels=args.normalize_channels,
normalization_down_sampling=args.normalization_down_sampling,
max_workers=args.classification_max_workers,
)
save_cells(
points,
Expand Down
Loading
Loading