itasc.contact_analysis.contacts.batch¶
Name-based batch discovery and headless contact-analysis builds.
The standalone contact piece is visualizer-first; the .h5 it shows is a pure
derived artifact of the label inputs. This module lets users pre-compute that
artifact for many positions at once: name the three files (cell labels, optional
nucleus labels, output .h5), point at one top-level folder, and every folder
that contains a cell-labels file becomes one job. A nucleus file is associated
only when it sits in that same folder; otherwise the job runs cell-only. Outputs
that already exist are skipped unless overwrite is set.
Position-agnostic and napari-free: shipped by the itasc-aggregate wheel.
Functions
|
Find contact-analysis jobs under |
|
Build the contact-analysis HDF5 for each job, collecting per-job outcomes. |
Classes
|
One discovered contact-analysis build: a cell-labels file and where its output goes, with an optional co-located nucleus-labels file. |
|
Outcome of a single |
- class itasc.contact_analysis.contacts.batch.ContactBatchJob(group_dir, cell_labels, output, nucleus_labels=None)[source]¶
Bases:
objectOne discovered contact-analysis build: a cell-labels file and where its output goes, with an optional co-located nucleus-labels file.
- class itasc.contact_analysis.contacts.batch.ContactBatchResult(job, status, error=None)[source]¶
Bases:
objectOutcome of a single
ContactBatchJob.statusis"built"(computed),"skipped"(output already present), or"failed"(errorholds the message).- Parameters:
job (ContactBatchJob)
status (str)
error (str | None)
- job: ContactBatchJob¶
- itasc.contact_analysis.contacts.batch.discover_contact_batch_jobs(root, *, cell_name, h5_name, nucleus_name=None)[source]¶
Find contact-analysis jobs under
rootby file name.Files are discovered recursively, then grouped by position folder — the first directory under
rooton the path to each match (rootitself for files lying directly in it). The named files of one position may live in different subfolders (e.g.pos01/3_cell/andpos01/2_nucleus/); they are still grouped together.For a position with exactly one cell-labels file, that file is one job whose output is
<position>/<h5_name>; the nucleus is associated only when exactly onenucleus_namefile exists anywhere in that position (zero or several → cell-only, “can’t associate → don’t assign”). A position holding several cell-labels files is ambiguous to group, so each falls back to a cell-only job written beside its own cell file. Jobs are sorted by cell path.
- itasc.contact_analysis.contacts.batch.run_contact_batch(jobs, *, overwrite=False, edge_extraction_params=None, progress_cb=None, cancel=None)[source]¶
Build the contact-analysis HDF5 for each job, collecting per-job outcomes.
A single job’s failure never aborts the run — it is recorded as a
failedresult and the batch continues.cancelis polled before each job;progress_cb(done, total, label)is reported after each.