dystrack.pipelines.lateral_line#

Tracking the zebrafish posterior lateral line primordium.

See also here.

dystrack.pipelines.lateral_line.analyze_image(target_path, channel=None, gauss_sigma=3.0, count_reduction=0.5, blank_fract=0.2, default_catchup_fract=0.2, default_step_fract=0.125, await_write=2, warn_8bit=True, show=False, verbose=False)#

Compute new coordinates for the scope to track the zebrafish lateral line primordium’s movement based on a 2D or 3D image. The primordium is masked using object-count thresholding. The new y (and z, if 3D) positions are computed as the respective centers of mass of the mask. The new x position is computed relative to the leading edge position of the mask.

Note: This was developed for and (mainly) tested on the cldnb:EGFP line. While it has been used for some other lines with adjusted parameters, it is absolutely not guaranteed to work universally.

Parameters:
  • target_path (str) – Path to the image file that is to be analyzed.

  • channel (int, optional, default None) – Index of channel to use for masking in case of multi-channel images. If not specified, a single-channel image is assumed.

  • gauss_sigma (float, optional, default 3.0) – Sigma for Gaussian filter prior to masking.

  • count_reduction (float, optional, default 0.5) – Factor by which object count has to be reduced below its initial peak for a threshold value to be accepted.

  • blank_fract (float, optional, default 1.0/5.0) – Distance of the leading edge from the right-hand border of the image after the correction, expressed as a fraction of the image size in x.

  • default_catchup_fract (float, optional, default 1.0/5.0) – Catch-up distance by which the field of view should be moved if the mask touches the right-hand border of the image, expressed as a fraction of the image size in x.

  • default_step_fract (float, optional, default 1.0/8.0) – Default distance by which the field of view should be moved if masking appears to have failed (leading edge in rear half of image), expressed as a fraction of the image size in x.

  • await_write (int, optional, default 2) – Seconds to wait between each check of the target file size to determine if the file is still being written to. Reducing this will shave off latency but increases the risk of race conditions.

  • warn_8bit (bool, optional, default True) – Whether to emit a warning when a non-8bit image was found and was down- converted to 8bit using min-max rescaling.

  • show (bool, optional, default False) – Whether to show the threshold plot and the mask. Default is False. Note that figures will be shown without blocking execution, so if many iterations are performed, many figures will be opened. Also, note that all figures will be closed when the python process exits.

  • verbose (bool, optional, default False) – If True, more information is printed.

Returns:

  • z_pos, y_pos, x_pos (floats) – New coordinates for the next acquisition. For 2D inputs, z_pos is 0.0.

  • img_msg (“_”) – A string output message; required by DySTrack but here unused and just set to “_”.

  • img_cache ({}) – A dictionary to be passed as keyword arguments to future calls to the pipeline; required by DySTrack but here unused and just set to {}.