playnano.analysis.modules.tracked_particle_boundary_size module

Analysis module that measures the size of each tracked particle over time.

The size is the longer side of each region’s bounding box, as found by particle_region_extraction. A threshold can split the time points into two states, for example compact and extended.

class playnano.analysis.modules.tracked_particle_boundary_size.BoundarySizeModule[source]

Bases: AnalysisModule

Measure each tracked particle’s size, frame by frame.

Pipeline name: "tracked_particle_boundary_size". It needs the output of particle_region_extraction, run with include_bbox=True (the default). The size, max_dim, is the longer side of the region’s tight bounding box, in pixels. See run() for the parameters and outputs.

property name: str

Name of this module in a pipeline, "tracked_particle_boundary_size".

requires = ['particle_region_extraction']
run(stack: Any, previous_results: Dict[str, Any] | None = None, *, extraction_module: str = 'particle_region_extraction', threshold: float | None = None, measure: str = 'bbox_max_dim') → Dict[str, Any][source]

Measure the size of each tracked particle in each frame.

Parameters:
  • stack (AFMImageStack) – The stack; not used directly.

  • previous_results (dict) – Outputs of earlier steps. Must hold the output of extraction_module.

  • extraction_module (str, optional) – Name of the region extraction step. Default is "particle_region_extraction".

  • threshold (float, optional) – If given, each frame is also given a state: 1 if max_dim is greater than threshold (in pixels), otherwise 0. Default is None.

  • measure (str, optional) – The size measure. Only "bbox_max_dim" is available. Default is "bbox_max_dim".

Returns:

"measure", "threshold"

The values used.

"per_track"

One dict per track, with track_id, frames, timestamps (s), max_dim (pixels) and, with a threshold, state. Frames where the particle was not found have max_dim NaN and state NaN.

"flat_table"

The same values with one dict per track and frame, with track_id, label, frame, timestamp, max_dim and, with a threshold, state; ready for pandas.DataFrame.

"plot_hints"

Names of plotting functions in playnano_plugins, a package that is not part of playNano.

"summary"

n_tracks, n_rows, n_missing_region_measurements and state_included.

Return type:

dict

Raises:
  • RuntimeError – If previous_results is None, lacks extraction_module, or the extraction ran with include_bbox=False.

  • ValueError – If measure is not "bbox_max_dim".

version = '0.1.0'