cellmap_flow.finetune.session.manifest
The files a session is trained from, besides the volume itself.
_virtual_sources.json in corrections/ points the trainer at the
annotation volume and carries the patch geometry and normalization;
good_regions.json, one level up, lists the regions the user marked as
already right. has_painted_annotations says whether a volume holds
scribbles as well as imported crops.
Attributes
Functions
|
Persist a manifest sentinel that |
|
Return the manifest if present, else |
|
Where the good regions of the session owning |
|
The regions stored at |
|
Replace the regions at |
|
Read the session's good regions, if any were marked. |
|
Return a boolean mask: |
|
Whether the volume holds annotations outside its imported crops. |
Module Contents
- cellmap_flow.finetune.session.manifest.logger
- cellmap_flow.finetune.session.manifest.VIRTUAL_MANIFEST_FILENAME = '_virtual_sources.json'
- cellmap_flow.finetune.session.manifest.GOOD_REGIONS_FILENAME = 'good_regions.json'
- cellmap_flow.finetune.session.manifest.write_manifest(corrections_dir: str, manifest: dict) str
Persist a manifest sentinel that
create_dataloaderlooks for.
- cellmap_flow.finetune.session.manifest.read_manifest(corrections_dir: str) dict | None
Return the manifest if present, else
None.
- cellmap_flow.finetune.session.manifest.good_regions_path(corrections_dir: str | None) str | None
Where the good regions of the session owning
corrections_dirlive: beside it, in the session directory. None without a corrections dir.
- cellmap_flow.finetune.session.manifest.load_good_regions(path: str | None) list
The regions stored at
path; [] when there are none or they can’t be read.
- cellmap_flow.finetune.session.manifest.save_good_regions(path: str, regions: list) bool
Replace the regions at
pathatomically; False if it could not be written.
- cellmap_flow.finetune.session.manifest.load_good_regions_for(corrections_dir: str | None) list
Read the session’s good regions, if any were marked.
Deliberately read here rather than snapshotted into the manifest: the manifest is written when crops are imported, and regions get marked afterwards, for as long as the user keeps browsing. Reading at training time means the run uses every region marked up to the moment it started.
- cellmap_flow.finetune.session.manifest.voxels_inside_any_bbox(voxels: numpy.ndarray, bbox_offsets: numpy.ndarray, bbox_ends: numpy.ndarray) numpy.ndarray
Return a boolean mask:
Truewherevoxels[i]lies inside any[bbox_offsets[j], bbox_ends[j])half-open box.voxels: (N, 3) int. bbox_offsets, bbox_ends: (M, 3) int. Vectorized over both: builds an (N, M) inside-test matrix and reduces along M. For typical M ~ 1-10 the temporary stays small.
- cellmap_flow.finetune.session.manifest.has_painted_annotations(volume_zarr_path: str) bool
Whether the volume holds annotations outside its imported crops.
Those are painted: scribbles, sparse by construction, with unannotated voxels all around them. Chunks entirely inside a crop are not read.