playnano.analysis.modules.tracked_particle_boundary_size module¶
Particle boundary size analysis module for the playNano analysis pipeline.
This module computes a per-particle boundary size metric over time by consuming
the output of particle_region_extraction.
For each tracked particle and frame, the maximum dimension of the (tight) bounding box is recorded. Optionally, a threshold may be applied to classify each time point into a discrete state (e.g. compact vs extended).
The module is designed to integrate with the playNano AnalysisPipeline and
records results in a provenance-aware, serializable format suitable for
downstream analysis and plotting.
- class playnano.analysis.modules.tracked_particle_boundary_size.BoundarySizeModule[source]¶
Bases:
AnalysisModuleMeasure particle boundary size over time from pre-extracted particle regions.
This module consumes output from
ParticleRegionExtractionModule(registered as"particle_region_extraction"in the pipeline). It expects that module to have been run withinclude_bbox=True.The boundary size metric is derived from the tight bounding box:
max_dim = max(bbox_height, bbox_width)Optionally, a threshold can be applied to derive a discrete state variable (e.g. compact vs extended).
Parameters accepted in
run()¶- extraction_modulestr, default
"particle_region_extraction" Name of the upstream extraction module in the pipeline.
- thresholdfloat or None
If provided, each frame is classified as
state = int(max_dim > threshold).- measurestr, default
"bbox_max_dim" Metric name (currently only
"bbox_max_dim"is supported).
Notes
If a region entry is
None(missing detection) or its bounding box isNone,max_dimis recorded asnp.nan.If the upstream extraction module was run without
include_bbox=True, aRuntimeErroris raised.
- 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]¶
Execute the boundary size analysis.
- Parameters:
stack (AFMImageStack) – Input image stack (not used directly; present for pipeline API compatibility).
previous_results (dict, optional) – Results from earlier pipeline modules. Must contain output from
extraction_modulewithinclude_bbox=True.extraction_module (str, default
"particle_region_extraction") – Key identifying the region extraction module output inprevious_results.threshold (float or None, optional) – Threshold applied to
max_dimto compute a binary state variable. IfNone, no state classification is performed.measure (str, default
"bbox_max_dim") – Name of the boundary size metric. Currently only"bbox_max_dim"is supported.
- Returns:
Keys:
measurestrName of the boundary size metric used.
thresholdfloat or NoneThreshold used for state classification, or
None.per_tracklist of dictPer-track time series. Each dict has:
"track_id": int"frames": list of int"timestamps": list of float"max_dim": list of float (np.nanwhere absent)"state": list of int/float (only if threshold given)
flat_tablelist of dictRow-per-frame representation suitable for
pandas.DataFrame.plot_hintsdictSuggested plotting helper function names.
summarydictBookkeeping counters.
- Return type:
- version = '0.1.0'¶
- extraction_modulestr, default