Skip to content
Snippets Groups Projects
Commit aca2c258 authored by pswain's avatar pswain
Browse files

general intro to tiler

parent fc494e29
No related branches found
No related tags found
No related merge requests found
""" """
Segment/segmented pipelines. Tiler: Tiles and tracks traps.
Includes splitting the image into traps/parts,
cell segmentation, nucleus segmentation
Standard order is (T, C, Z, Y, X) The tasks of the Tiler are selecting regions of interest, or tiles, of an image - with one tile per trap, tracking and correcting for the drift of the microscope stage over time, and handling errors and bridging between the image data and ALIBY’s image-processing steps.
Tiler subclasses deal with either network connections or local files.
To find traps, we use a two-step process: we analyse the bright-field image to produce the template of a trap, and we fit this template to the image to find the traps' centres.
We use texture-based segmentation (entropy) to split the image into foreground -- cells and traps -- and background, which we then identify with an Otsu filter. Two methods are used to produce a template trap from these regions: pick the trap with the smallest minor axis length and average over all validated traps.
A peak-identifying algorithm recovers the x and y-axis location of traps in the original image, and we choose the templating approach that identifies the most traps
One key method is Tiler.run.
The image-processing is performed by traps/segment_traps.
The experiment is stored as an array wuth a standard indexing order of (Time, Channels, Z-stack, Y, X).
""" """
import warnings import warnings
from functools import lru_cache from functools import lru_cache
...@@ -306,27 +318,26 @@ class Tiler(ProcessABC): ...@@ -306,27 +318,26 @@ class Tiler(ProcessABC):
@lru_cache(maxsize=2) @lru_cache(maxsize=2)
def get_tc(self, t, c): def get_tc(self, t, c):
""" """
Load image using dask. Load image using dask.
Assumes the image is arranged as Assumes the image is arranged as
no of time points no of time points
no of channels no of channels
no of z stacks no of z stacks
no of pixels in y direction no of pixels in y direction
no of pixels in z direction no of pixels in z direction
Parameters Parameters
---------- ----------
t: integer t: integer
An index for a time point An index for a time point
c: integer c: integer
An index for a channel An index for a channel
def _initialise_traps(self, tile_size: int): Retruns
------- -------
full: an array of images full: an array of images
""" """
full = self.image[t, c].compute(scheduler="synchronous") full = self.image[t, c].compute(scheduler="synchronous")
return full return full
@property @property
...@@ -401,7 +412,7 @@ class Tiler(ProcessABC): ...@@ -401,7 +412,7 @@ class Tiler(ProcessABC):
def find_drift(self, tp): def find_drift(self, tp):
""" """
Find any translational drifts between two images at consecutive Find any translational drift between two images at consecutive
time points using cross correlation. time points using cross correlation.
Arguments Arguments
...@@ -499,7 +510,6 @@ class Tiler(ProcessABC): ...@@ -499,7 +510,6 @@ class Tiler(ProcessABC):
time_dim = 0 time_dim = 0
for t in range(self.image.shape[time_dim]): for t in range(self.image.shape[time_dim]):
self.run_tp(t) self.run_tp(t)
return None return None
# The next set of functions are necessary for the extraction object # The next set of functions are necessary for the extraction object
...@@ -510,7 +520,6 @@ class Tiler(ProcessABC): ...@@ -510,7 +520,6 @@ class Tiler(ProcessABC):
Get a multidimensional array with all tiles for a set of channels Get a multidimensional array with all tiles for a set of channels
and z-stacks. and z-stacks.
""" """
# FIXME add support for subtiling trap # FIXME add support for subtiling trap
# FIXME can we ignore z(always give) # FIXME can we ignore z(always give)
if channels is None: if channels is None:
......
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