KymoWidgetGreedy

lumicks.pylake.KymoWidgetGreedy

class KymoWidgetGreedy(kymo, channel, *, axis_aspect_ratio=None, track_width=None, filter_width=None, pixel_threshold=None, window=None, adjacency_filter=False, sigma=None, velocity=None, diffusion=None, sigma_cutoff=None, min_length=None, use_widgets=True, output_filename='kymotracks.txt', slider_ranges=None, correct_origin=None, **kwargs)

Create a widget for performing kymotracking.

For more information on tracking using the widget, please refer to the tracking example, the tutorial on tracking or the tutorial on the use of widgets.

Parameters:
  • kymo (lumicks.pylake.Kymo) – Kymograph.

  • channel (str) – Kymograph channel to use.

  • axis_aspect_ratio (float, optional) – Desired aspect ratio of the viewport. Sometimes kymographs can be very long and thin. This helps you visualize them. The aspect ratio is defined in physical spatial and temporal units (rather than pixels).

  • track_width (float, optional) – Expected width of the particles in physical units. Defaults to 4 * pixel size.

  • pixel_threshold (float, optional) – Intensity threshold for the pixels. Local maxima above this intensity level will be designated as a track origin. Defaults to 98th percentile of the pixel intensities.

  • filter_width (float, optional) – Filter width in microns. Should ideally be chosen to the width of the PSF (default: None which results in half a pixel size for legacy reasons).

  • window (int, optional) – Number of kymograph frames in which the particle is allowed to disappear (and still be part of the same track). Defaults to 4.

  • adjacency_filter (bool) – Require that any true peak detection has a positive detection in an adjacent frame.

  • sigma (float or None, optional) – Uncertainty in the particle position. This parameter will determine whether a peak in the next frame will be linked to this one. Increasing this value will make the algorithm tend to allow more positional variation in the tracks. If none, the algorithm will use half the track width.

  • velocity (float, optional) – Expected velocity of the traces in the image. This can be used for non-static particles that are expected to move at an expected rate (default: 0.0).

  • diffusion (float, optional) – Expected diffusion constant (default: 0.0). This parameter will influence whether a peak in the next frame will be connected to this one. Increasing this value will make the algorithm allow more positional variation in.

  • sigma_cutoff (float, optional) – Sets at how many standard deviations from the expected trajectory a particle no longer belongs to this trace. Lower values result in traces being more stringent in terms of continuing (default: 2.0).

  • min_length (int, optional) – Minimum length of a trace. Minimum number of frames a spot has to be detected in to be considered. Defaults to 3.

  • use_widgets (bool, optional) – Add interactive widgets for interacting with algorithm parameters.

  • output_filename (str, optional) – Filename to save to and load from.

  • slider_ranges (dict of list, optional) – Dictionary with custom ranges for selected parameter sliders. Ranges should be in the following format: (lower bound, upper bound). Valid options are: “window”, “pixel_threshold”, “track_width”, “sigma”, “min_length” and “velocity”.

  • correct_origin (bool, optional) – Use the correct pixel origin when summing track intensities when saving the file. When saving the tracks, the widget stores the sum of the intensities around the tracks. Tracks are defined with the origin of each image pixel defined at the center. However, prior to Pylake version 1.1.0, the method that samples photon counts around the track had a bug which assumed the origin at the edge of the pixel. Setting this flag to True produces the correct behavior. The default is set to None which reproduces the old behavior and results in a warning when saving tracks, while False reproduces the old behavior without a warning.

save_tracks(filename, delimiter=';', sampling_width=None)

Export KymoTrackGroup to a csv file.

Parameters:
  • filename (str | os.PathLike) – Filename to output kymograph tracks to.

  • delimiter (str) – Which delimiter to use in the csv file.

  • sampling_width (int or None) – When supplied, this will sample the source image around the kymograph track and export the summed intensity with the image. The value indicates the number of pixels in either direction to sum over.

property tracks

Detected tracks.

Returns:

Collection of detected tracks.

Return type:

KymoTrackGroup