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

docs(readme): refresh RemoteImageViewer info

parent 993d6d4d
No related branches found
No related tags found
No related merge requests found
...@@ -80,12 +80,18 @@ It fetches the metadata from the Image object, and uses the TilerParameters valu ...@@ -80,12 +80,18 @@ It fetches the metadata from the Image object, and uses the TilerParameters valu
```python ```python
fpath = "h5/location" fpath = "h5/location"
trap_id = 9 tile_id = 9
trange = list(range(0, 30)) trange = range(0, 10)
ncols = 8 ncols = 8
riv = remoteImageViewer(fpath) riv = remoteImageViewer(fpath)
trap_tps = riv.get_trap_timepoints(trap_id, trange, ncols) trap_tps = [riv.tiler.get_tiles_timepoint(tile_id, t) for t in trange]
# You can also access labelled traps
m_ts = riv.get_labelled_trap(tile_id=0, tps=[0])
# And plot them directly
riv.plot_labelled_trap(trap_id=0, channels=[0, 1, 2, 3], trange=range(10))
``` ```
Depending on the network speed can take several seconds at the moment. Depending on the network speed can take several seconds at the moment.
...@@ -95,8 +101,8 @@ For a speed-up: take fewer z-positions if you can. ...@@ -95,8 +101,8 @@ For a speed-up: take fewer z-positions if you can.
Alternatively, if you want to get all the traps at a given timepoint: Alternatively, if you want to get all the traps at a given timepoint:
```python ```python
timepoint = 0 timepoint = (4,6)
seg_expt.get_tiles_timepoints(timepoint, tile_size=96, channels=None, tiler.get_tiles_timepoint(timepoint, channels=None,
z=[0,1,2,3,4]) z=[0,1,2,3,4])
``` ```
......
...@@ -6,12 +6,12 @@ Example of usage: ...@@ -6,12 +6,12 @@ Example of usage:
fpath = "/home/alan/Documents/dev/skeletons/scripts/data/16543_2019_07_16_aggregates_CTP_switch_2_0glu_0_0glu_URA7young_URA8young_URA8old_01/URA8_young018.h5" fpath = "/home/alan/Documents/dev/skeletons/scripts/data/16543_2019_07_16_aggregates_CTP_switch_2_0glu_0_0glu_URA7young_URA8young_URA8old_01/URA8_young018.h5"
trap_id = 9 tile_id = 9
trange = list(range(0, 30)) trange = list(range(0, 10))
ncols = 8 ncols = 8
riv = remoteImageViewer(fpath) riv = remoteImageViewer(fpath)
riv.plot_labelled_trap(trap_id, trange, [0], ncols=ncols) riv.plot_labelled_trap(tile_id, trange, [0], ncols=ncols)
""" """
...@@ -224,7 +224,7 @@ class RemoteImageViewer(BaseImageViewer): ...@@ -224,7 +224,7 @@ class RemoteImageViewer(BaseImageViewer):
def get_labelled_trap( def get_labelled_trap(
self, self,
trap_id: int, tile_id: int,
tps: t.Union[range, t.Collection[int]], tps: t.Union[range, t.Collection[int]],
channels=None, channels=None,
concatenate=True, concatenate=True,
...@@ -234,12 +234,12 @@ class RemoteImageViewer(BaseImageViewer): ...@@ -234,12 +234,12 @@ class RemoteImageViewer(BaseImageViewer):
Core method to fetch traps and labels together Core method to fetch traps and labels together
""" """
imgs = self.get_pos_timepoints(tps, channels=channels, **kwargs) imgs = self.get_pos_timepoints(tps, channels=channels, **kwargs)
imgs_list = [x[trap_id] for x in imgs.values()] imgs_list = [x[tile_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(tile_id, [])
for tp in tps for tp in tps
] ]
lbls = [self.cells.labels_at_time(tp).get(trap_id, []) for tp in tps] lbls = [self.cells.labels_at_time(tp).get(tile_id, []) for tp in tps]
lbld_outlines = [ lbld_outlines = [
np.stack([mask * lbl for mask, lbl in zip(maskset, lblset)]).max( np.stack([mask * lbl for mask, lbl in zip(maskset, lblset)]).max(
axis=0 axis=0
...@@ -253,7 +253,7 @@ class RemoteImageViewer(BaseImageViewer): ...@@ -253,7 +253,7 @@ class RemoteImageViewer(BaseImageViewer):
imgs_list = np.concatenate(imgs_list, axis=1) imgs_list = np.concatenate(imgs_list, axis=1)
return lbld_outlines, imgs_list return lbld_outlines, imgs_list
def get_images(self, trap_id, trange, channels, **kwargs): def get_images(self, tile_id, trange, channels, **kwargs):
""" """
Wrapper to fetch images Wrapper to fetch images
""" """
...@@ -262,13 +262,13 @@ class RemoteImageViewer(BaseImageViewer): ...@@ -262,13 +262,13 @@ class RemoteImageViewer(BaseImageViewer):
for ch in self._find_channels(channels): for ch in self._find_channels(channels):
out, imgs[ch] = self.get_labelled_trap( out, imgs[ch] = self.get_labelled_trap(
trap_id, trange, channels=[ch], **kwargs tile_id, trange, channels=[ch], **kwargs
) )
return out, imgs return out, imgs
def plot_labelled_trap( def plot_labelled_trap(
self, self,
trap_id: int, tile_id: int,
channels, channels,
trange: t.Union[range, t.Collection[int]], trange: t.Union[range, t.Collection[int]],
remove_axis: bool = False, remove_axis: bool = False,
...@@ -288,7 +288,7 @@ class RemoteImageViewer(BaseImageViewer): ...@@ -288,7 +288,7 @@ class RemoteImageViewer(BaseImageViewer):
Parameters Parameters
---------- ----------
trap_id : int tile_id : int
Identifier of trap Identifier of trap
channels : Union[str, int] channels : Union[str, int]
Channels to use Channels to use
...@@ -325,7 +325,7 @@ class RemoteImageViewer(BaseImageViewer): ...@@ -325,7 +325,7 @@ class RemoteImageViewer(BaseImageViewer):
nrows = int(np.ceil(len(trange) / ncols)) nrows = int(np.ceil(len(trange) / ncols))
width = self.tiler.tile_size * ncols width = self.tiler.tile_size * ncols
out, images = self.get_images(trap_id, trange, channels, **kwargs) out, images = self.get_images(tile_id, trange, channels, **kwargs)
# dilation makes outlines easier to see # dilation makes outlines easier to see
out = dilation(out).astype(float) out = dilation(out).astype(float)
......
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