acia.registration_persistence#
Registration manifest — persist drift-correction transforms and reconstruct lazy corrected sources.
A RegistrationManifest records, per position, the per-frame
FrameTransform estimated by a chosen
RegistrationMethod against that position’s own
frame 0 – plus the source metadata baked in (pixel size, timing, axes),
mirroring acia.selection’s manifest pattern exactly.
load_registration() turns a manifest back into a dict of lazy
RegisteredSequenceSource views (position index -> source),
optionally against a different file (“load file, apply registration, work
only on the corrected sequence”). No pixel data is read while reconstructing.
- class acia.registration_persistence.RegistrationRecord[source]#
Bases:
objectOne position’s registration result: per-frame transforms + failures.
Every transform is expressed relative to
reference_frame, whatever frame was actually compared against to compute it.reference_modeandreference_framesrecord how they were obtained (seeReanchoringReference), which matters when resuming a partially-registered position: progress made under one policy is not valid to continue under another.- Variables:
reference_mode (str) – The reference policy this record was produced under – one of
MODES. Defaults to"fixed"so a manifest written before the policy existed loads as what it in fact was.reference_frames (dict[int, int]) –
frame -> anchorfor the frames that were estimated against something other thanreference_frame. Only the exceptions are stored; a purely fixed-reference run leaves this empty and serializes without the key at all.
- transforms: dict[int, FrameTransform]#
- __init__(position, method, transforms, reference_frame=0, failed_frames=<factory>, notes='', reference_mode='fixed', reference_frames=<factory>)#
- class acia.registration_persistence.RegistrationManifest[source]#
Bases:
objectA batch-apply result: per-position records + baked-in source metadata.
- Variables:
method_params (dict) – The settings the registration method was constructed with (
min_confidence,exclude_shrink_px, …), so a run is reproducible from the file rather than only from the notebook that produced it. Only JSON-representable values are kept; anything else is stringified.
- records: list[RegistrationRecord]#
- acia.registration_persistence.save_registration(manifest, directory)[source]#
Write
registration_transforms.jsonintodirectory.- Parameters:
manifest (RegistrationManifest) – The manifest to persist.
directory (str | PathLike) – Output directory (created if missing) — typically beside the notebook.
- Returns:
The path to the written
registration_transforms.json.- Return type:
- acia.registration_persistence.load_registration(manifest, source=None, *, on_missing='warn')[source]#
Reconstruct lazy registered sources from a manifest.
Each completed record becomes
seqfile.position(record.position).register( record.transforms)— a lazy per-frame-corrected view; no pixel data is read here. Calibration comes from the (possibly overriding) source.- Parameters:
manifest (RegistrationManifest) – The manifest to reconstruct.
source –
Noneto open the manifest’s original file, a path/str to apply the records to a different file, or an already-openSequenceFile.on_missing (str) – How each reconstructed view should handle a frame that has no stored transform (one that landed in
failed_frames) — seeRegisteredSequenceSource.
- Returns:
dict[int, ~acia.base.RegisteredSequenceSource] – Position index -> lazy registered source, one entry per record in the manifest.
- Raises:
ValueError – If a record’s
positionis out of range for the source.- Return type: