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; read_chunk reads one chunk of the
volume’s annotation/s0 for it, for the sampler and for the ranking.
Attributes
Functions
|
Persist a manifest sentinel that |
|
Return the manifest if present, else |
|
Remove the session's manifest from |
|
The directory name ( |
|
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: |
|
Chunk |
|
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.remove_manifest(corrections_dir: str) bool
Remove the session’s manifest from
corrections_dir; whether there was one.For a session whose volume is now one no manifest can name (a volume painted before any model): a manifest left naming the volume before it would keep that one the session’s (trained_volume_name), and Rank, Seed and Use this model would read the old paint while the user paints the new volume. The manifest is derived (write_volume_manifest builds it again from a volume record), and the volume it named stays where it is.
- cellmap_flow.finetune.session.manifest.trained_volume_name(corrections_dir) str | None
The directory name (
<id>.zarr) of the volume the session incorrections_dirtrains on, its manifest’svolume_zarr_path: the session’s current volume, which every route and both modes mean by “the session’s volume”. None without a manifest, or one that names none or cannot be read.By name, not by path: a resumed session’s manifest names its own copy, and the corrections dir may be spelled another way (a symlink, a trailing slash) by whoever asks.
- 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.read_chunk(array: worldarray.WorldArray, index) numpy.ndarray
Chunk
indexofarray, cut short at the array’s end as the stored chunk is.
- 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.