slitflow.trj.wtrackpy module

Caution

This module consists of brief wrapper classes of Trackpy.

Wrapper classes do not cover all functionality of Trackpy functions. Please create your custom class to use Trackpy functions that are not provided in this module.

Do not ask the Trackpy developers any questions about the wrapper part that is not directly related to the Trackpy package.

If you use Trackpy functions in this module, please cite original package according to the package documentation.

Bases: Table

Brief wrapper of trackpy link function.

See also trackpy.link function. While trackpy supports 3D, this wrapper class uses only 2D image.

The input localization table should have all frames for linking. You have to split data into appropriate depths. Currently, only the table containing img_no, frm_no, x_(length_unit) and y_(length_unit) is available.

Parameters:
  • reqs[0] (Table) – X,Y-coordinate of localization. Required params; length_unit. Required columns; img_no, frm_no, x_(length_unit) and y_(length_unit).

  • param["search_range"] (float) – Maximum distance features can move between frames in length_unit.

  • param["split_depth"] (int) – File split depth number.

Returns:

Trajectory Table

Return type:

Table

set_info(param)[source]

Copy info from reqs[0] and add params.

Caution

Currently, only the table containing img_no, frm_no, x_(length_unit) and y_(length_unit) is available.

static process(reqs, param)[source]

Brief wrapper of trackpy link function.

Parameters:
  • reqs[0] (pandas.DataFrame) – X,Y-coordinate of localization. Required params; length_unit. Required columns; img_no, frm_no, x_(length_unit) and y_(length_unit).

  • param["search_range"] (float) – Maximum distance features can move between frames in length_unit.

  • param["calc_cols"] (list of str) – Column names of X,Y-coordinate.

  • param["all_cols"] (list of str) – Column names for reindex.

  • param["index_cols"] (list of str) – Column names for index.

Returns:

Trajectory table

Return type:

pandas.DataFrame

class RefineCoM(info_path=None)[source]

Bases: Table

Refine localization using center of mass in trackpy.

Parameters:
  • reqs[0] (Image) – Raw movie Image. Required parameters; length_unit, img_size.

  • reqs[1] (Table) – X,Y-coordinate of trajectory. Required columns; x_(length_unit), y_(length_unit).

  • param["radius"] (int) – Mask radius for trackpy.

  • param["split_depth"] (int) – File split depth number.

Returns:

Refined X,Y-coordinate

Return type:

Table

set_info(param)[source]

Copy info from reqs[1] and param from reqs[0] and modify and add params.

static process(reqs, param)[source]

Refine localization using center of mass in trackpy.

Parameters:
  • reqs[0] (numpy.ndarray) – Raw movie Image.

  • reqs[1] (pandas.DataFrame) – X,Y-coordinate of trajectory. Required columns; x_(length_unit), y_(length_unit).

  • param["img_size"] (list of int) – [width, height] of each image in pixel.

  • param["pitch"] (float) – Pixel size in length_unit/pix.

  • param["radius"] (int) – Mask radius for trackpy in pixel.

  • param["calc_cols"] (list of str) – Column names for [x, y] coordinates.

Returns:

Refined X,Y-coordinate

Return type:

pandas.DataFrame

class Locate(info_path=None)[source]

Bases: Table

Brief wrapper of trackpy batch function.

This class uses only two-dimensional image. Image stack should be split into the image number.

Parameters:
  • reqs[0] (Image) – Image for location detection. Required parameters: length_unit.

  • param["diameter"] (odd integer) – Feature size in pixel.

  • param["split_depth"] (int) – File split depth number.

Returns:

X,Y-coordinate of detected points

Return type:

Table

set_index()[source]

Copy index from required data index and result pandas.DataFrame.

set_info(param)[source]

Copy information from reqs[0] and modify columns and add params.

static process(reqs, param)[source]

Brief wrapper of trackpy batch function.

Parameters:
  • reqs[0] (numpy.ndarray) – Numpy 2D array of image for location detection.

  • param["diameter"] (odd integer) – Feature size in pixel.

  • param["pitch"] (float) – Pixel size in length_unit/pix.

  • param["col_names"] (list of str) – List of column names. This should be [frame number (frm_no), point number (point_no), X-coordinate (x_[length_unit]), Y-coordinate (y_[length_unit]), Total integrated brightness (mass), Radius of gyration (size), Eccentricity (ecc), Signal (signal), Total integrated brightness in raw_image (raw_mass), Error in a feature’s position (ep)].

Returns:

X,Y-coordinate and other parameters of detected points

Return type:

pandas.DataFrame

post_run()[source]

Merge the index table to the split result data.