Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
schienstockd committed Dec 20, 2022
1 parent 16721f5 commit 3e21b26
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions inst/py/cellpose_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,26 +363,25 @@ def predict_slice(self, im_dat, dat_slices):
for y in model_masks[i]:
interm_labels[i] = np.maximum(interm_labels[i], y)

# go through all nuclei labels
# TODO generalise as this is the same as for mesmer
if len(model_masks['cyto']) > 0 and len(model_masks['nuc']) > 0:
self.logfile_utils.log(f'>> Merge nuclei and cyto')

# match cells to a nucleus - some cells might not have a nucleus
labels_merged = self.match_cells_and_nuclei(
# [interm_labels['nuc'], interm_labels['cyto']]
[interm_labels['cyto'], interm_labels['nuc']],
stitch_threshold = self.match_threshold,
remove_unmatched = self.remove_unmatched
)

self.logfile_utils.log(f'> Cells: {np.max(labels_merged[0])}')
self.logfile_utils.log(f'> Nuclei: {np.max(labels_merged[1])}')

# add masks to list
if np.max(labels_merged[0]) > 0 and np.max(labels_merged[1]) > 0:
interm_labels['cyto'] = labels_merged[0]
interm_labels['nuc'] = labels_merged[1]
# match labels
# if len(model_masks['cyto']) > 0 and len(model_masks['nuc']) > 0:
# self.logfile_utils.log(f'>> Merge nuclei and cyto')
#
# # match cells to a nucleus - some cells might not have a nucleus
# labels_merged = self.match_cells_and_nuclei(
# # [interm_labels['nuc'], interm_labels['cyto']]
# [interm_labels['cyto'], interm_labels['nuc']],
# stitch_threshold = self.match_threshold,
# remove_unmatched = self.remove_unmatched
# )
#
# self.logfile_utils.log(f'> Cells: {np.max(labels_merged[0])}')
# self.logfile_utils.log(f'> Nuclei: {np.max(labels_merged[1])}')
#
# # add masks to list
# if np.max(labels_merged[0]) > 0 and np.max(labels_merged[1]) > 0:
# interm_labels['cyto'] = labels_merged[0]
# interm_labels['nuc'] = labels_merged[1]

# final merge of cyto and base
merged_labels = np.zeros(label_shape, dtype = np.uint32)
Expand Down

0 comments on commit 3e21b26

Please sign in to comment.