Skip to content

Commit

Permalink
Get padding per peak not per FOV
Browse files Browse the repository at this point in the history
  • Loading branch information
rthiermann committed Dec 16, 2023
1 parent c50fb3b commit 7caa759
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/napari_mm3/_segment_unet.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,6 @@ def segment_fov_unet(
if spec == 1:
break # just break out with the current peak_id

# img_stack = load_stack_params(params, fov_id, peak_id, postfix=color)
img_stack = load_unmodified_stack(params["ana_dir"], params["experiment_name"], fov_id, peak_id, postfix = color)
img_height = img_stack.shape[1]
img_width = img_stack.shape[2]

pad_dict = get_pad_distances(unet_shape, img_height, img_width)

# dermine how many channels we have to analyze for this FOV
ana_peak_ids = []
for peak_id, spec in six.iteritems(specs[fov_id]):
Expand All @@ -407,7 +400,7 @@ def segment_fov_unet(
ana_peak_ids.sort() # sort for repeatability

segment_cells_unet(
ana_peak_ids, fov_id, pad_dict, unet_shape, model, params, view_result
ana_peak_ids, fov_id, unet_shape, model, params, view_result
)

information("Finished segmentation for FOV {}.".format(fov_id))
Expand All @@ -416,7 +409,7 @@ def segment_fov_unet(


def segment_cells_unet(
ana_peak_ids, fov_id, pad_dict, unet_shape, model, params, view_result: bool = False
ana_peak_ids, fov_id, unet_shape, model, params, view_result: bool = False
):
"""
Segments cells using U-net model.
Expand All @@ -441,6 +434,11 @@ def segment_cells_unet(
# )
img_stack = load_unmodified_stack(params["ana_dir"], params["experiment_name"], fov_id, peak_id, params["phase_plane"])

img_height = img_stack.shape[1]
img_width = img_stack.shape[2]

pad_dict = get_pad_distances(unet_shape, img_height, img_width)

# do the segmentation
predictions = segment_peak_unet(img_stack, unet_shape, pad_dict, model, params)

Expand Down

0 comments on commit 7caa759

Please sign in to comment.