What’s New in playNano 0.5.0¶
Release date: 2026-10-19
This release fixes per-frame timing for bidirectional JPK scans and, in doing so, unifies the per-frame metadata produced by every file reader. Readers now record real acquisition timing wherever the source format stores it, and whole-video acquisition settings get a dedicated home on the stack. It also adds three analysis modules for extracting, measuring and exporting individual tracked particles, two new processing operations, explicit units in OME-TIFF exports, and several bug fixes.
Added¶
Unified Frame Metadata Schema: Every reader (
.jpkfolder,.h5-jpk,.spmfolder,.aris,.asd) now emits the same six keys for every frame:Key
Meaning
timestampSeconds from frame zero
frame_pixel_size_nmPhysical pixel size for that frame
frame_duration_sFrame acquisition duration in seconds
start_epoch_msAbsolute frame start as Unix epoch milliseconds
scan_directionSlow-axis direction (
'topDown'/'bottomUp')line_rateFast-scan line rate (lines per second)
Fields a format cannot provide are stored as
Nonerather than filled with a synthetic value. Readers build these dicts through a sharedbuild_frame_metadatafactory inplaynano.utils.io_utils, which casts every value to a native Python type so metadata stays JSON-serialisable.FRAME_METADATA_KEYSis the authoritative list of keys.Real Per-Frame Timing: Readers now use the timing each format records instead of a uniform
lines / scan rateestimate:.jpkfolders: per-fileStartDate/EndDateTIFF tags (millisecond precision)..h5-jpk:meta-data/start-times/meta-data/end-timesdatasets..spmfolders: each file’sRelative frame timeheader field, capturing real gaps between frames. Per-frameFrame directionis also read, so alternating up/down sequences are represented faithfully..aris: per-frameSeries/Timeoffsets, plus absolute start time fromGlobal/StartTime..asd: frame duration from the header, with absolute start time back-derived from the file’s write time.
Where real timing is unavailable, readers fall back to scan-rate timing for the whole stack (interlace-aware for JPK formats) and log a warning.
AFMImageStack.acquisition: A new property, backed bystack.provenance["acquisition"], for whole-video acquisition settings that don’t belong per-frame. Currently populated with:bidirectional(bool) by the.jpkfolder and.h5-jpkreaders.asd_file_version,asd_scan_direction_rawandasd_channelsby the.asdreader. The raw ASD scan-direction integer is not formally documented, so it is preserved as-is rather than mapped to a label.
This will be developed more in future releases.
Schema Drift Warning:
AFMImageStacknow logs a warning whenframe_metadatacontains keys outsideFRAME_METADATA_KEYS, catching reader regressions early. Missing keys are still tolerated so older saved bundles reload.Particle Region Analysis Modules: Three new modules that build on
feature_detectionandparticle_tracking:particle_region_extraction(ParticleRegionExtractionModule): extracts per-particle, per-frame regions from tracked detections, with tight, padded, squared or fixed-size bounding boxes and optional image and mask crops.particle_region_media_export(ParticleRegionMediaExportModule): exports per-particle GIFs, videos and/or image sequences from the extracted crops, with colormap, timestamp and scale-bar overlays. Tracks can be filtered by ID, sorted by length or detection count, and capped.tracked_particle_boundary_size(BoundarySizeModule): measures each particle’s maximum bounding-box dimension over time, with an optional threshold to classify each frame into a binary state (e.g. compact vs extended). This is based on the analysis first released in the playNano-plugins package.
zero_medianFilter: Subtracts the median height from every pixel to centre the background on zero. A masked variant computes the median over unmasked (background) pixels only, making it more robust thanzero_meanwhen large features are present.drop_final_framesStack Edit: Generates the indices of the last N frames (default 1) for removal withdrop_frames. Useful for discarding incomplete final frames from an interrupted acquisition.
Changed¶
playnano.utils.io_utils.height_unitshas been renamed toHEIGHT_UNITS.Reader docstrings now document which metadata fields each format populates, its timing sources, and its fallbacks.
Developer tooling:
pre-commit-hooksbumped to v6.0.0, andome-typesadded to thedevextras.
Fixed¶
Bidirectional JPK Timing: Bidirectional (interlaced)
.jpkfolder and.h5-jpkscans were timed as unidirectional, so timestamps ran at roughly twice their real values. Real per-frame start and end times are now used..h5-jpkDataset Names: The dataset name is now read from the channel group instead of being reconstructed from the channel string, fixing aKeyErroron camelCase datasets such asMeasuredHeight..h5-jpkZ-Units: The z-unit attribute is now decoded correctly. Previously it was read as"b'm'", so explicit unit conversion never applied.OME-TIFF Units: Exports now record explicit units for
PhysicalSizeX/Y/Z(µm) andTimeIncrement(s), so calibration and timing display correctly in ImageJ/Fiji, napari and other OME readers.export_processing_log: The method referenced a non-existentself.stackattribute and raisedAttributeErroron every call. It now writes the processing log as intended.
Removed¶
The unused
pad_to_squareutility has been removed fromplaynano.utils.io_utils.
Documentation¶
Introduction has a new Loading and Metadata section describing the unified per-frame schema and
stack.acquisition.processing-operations-referencenow listszero_mediananddrop_final_frames, and links each filter to its masked variant.Fixed the release date in the 0.4.0 release notes.
Pytest Coverage Added¶
Parametrised schema test confirming every reader with a test fixture (
.asd,.spm,.jpkfolder,.h5-jpk) emits exactlyFRAME_METADATA_KEYSon every frame.build_frame_metadata: full and minimal invocations and numpy-scalar coercion.Timing fallbacks: scan-rate fallback for
.jpkfolder and.h5-jpk, bidirectional interval halving, and the error raised when no timing information is available.Bidirectional detection: the timing-ratio threshold and settings-blob parsing (true, false, missing key, missing tag).
.spmreal-timing path: uneven inter-frame gaps, unknown last-frame duration, and the single-frame case.AFMImageStack.acquisitionand the schema drift warning.OME-TIFF unit and timing metadata, validated with
ome-types.export_processing_logtests updated to exercise real provenance.Particle region extraction, boundary size and media export modules, including bounding-box geometry helpers and extraction → boundary-size integration.
zero_median(masked and unmasked) anddrop_final_frames.