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

logger

VIRTUAL_MANIFEST_FILENAME

GOOD_REGIONS_FILENAME

Functions

write_manifest(→ str)

Persist a manifest sentinel that create_dataloader looks for.

read_manifest(→ Optional[dict])

Return the manifest if present, else None.

good_regions_path(→ Optional[str])

Where the good regions of the session owning corrections_dir live:

load_good_regions(→ list)

The regions stored at path; [] when there are none or they can't be read.

save_good_regions(→ bool)

Replace the regions at path atomically; False if it could not be written.

load_good_regions_for(→ list)

Read the session's good regions, if any were marked.

voxels_inside_any_bbox(→ numpy.ndarray)

Return a boolean mask: True where voxels[i] lies inside any

has_painted_annotations(→ bool)

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_dataloader looks 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_dir live: 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 path atomically; 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: True where voxels[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.