Skip to content
Snippets Groups Projects
Commit 13344669 authored by Alán Muñoz's avatar Alán Muñoz
Browse files

fix(imageViewer): passing tps, channels,cells.tp

parent 371daf97
No related branches found
No related tags found
No related merge requests found
...@@ -211,17 +211,20 @@ class remoteImageViewer: ...@@ -211,17 +211,20 @@ class remoteImageViewer:
self, self,
trap_id: int, trap_id: int,
tps: t.Union[range, t.Collection[int]], tps: t.Union[range, t.Collection[int]],
channels=None,
concatenate=True,
**kwargs, **kwargs,
) -> t.Tuple[np.array]: ) -> t.Tuple[np.array]:
imgs = self.get_pos_timepoints(tps, **kwargs) """
Core method to fetch traps and labels together
"""
imgs = self.get_pos_timepoints(tps, channels=channels, **kwargs)
imgs_list = [x[trap_id] for x in imgs.values()] imgs_list = [x[trap_id] for x in imgs.values()]
outlines = [ outlines = [
self.cells.at_time(tp, kind="edgemask").get(trap_id, []) self.cells.at_time(tp, kind="edgemask").get(trap_id, [])
for tp in tps for tp in tps
] ]
lbls = [ lbls = [self.cells.labels_at_time(tp).get(trap_id, []) for tp in tps]
self.cells.labels_at_time(tp - 1).get(trap_id, []) for tp in tps
]
lbld_outlines = [ lbld_outlines = [
np.dstack([mask * lbl for mask, lbl in zip(maskset, lblset)]).max( np.dstack([mask * lbl for mask, lbl in zip(maskset, lblset)]).max(
axis=2 axis=2
...@@ -230,9 +233,10 @@ class remoteImageViewer: ...@@ -230,9 +233,10 @@ class remoteImageViewer:
else np.zeros_like(imgs_list[0]).astype(bool) else np.zeros_like(imgs_list[0]).astype(bool)
for maskset, lblset in zip(outlines, lbls) for maskset, lblset in zip(outlines, lbls)
] ]
outline_concat = np.concatenate(lbld_outlines, axis=1) if concatenate:
img_concat = np.concatenate(imgs_list, axis=1) lbld_outlines = np.concatenate(lbld_outlines, axis=1)
return outline_concat, img_concat imgs_list = np.concatenate(imgs_list, axis=1)
return lbld_outlines, imgs_list
def get_images(self, trap_id, trange, channels, **kwargs): def get_images(self, trap_id, trange, channels, **kwargs):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment