cellmap_flow.finetune.session.manifest ====================================== .. py:module:: cellmap_flow.finetune.session.manifest .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: cellmap_flow.finetune.session.manifest.logger cellmap_flow.finetune.session.manifest.VIRTUAL_MANIFEST_FILENAME cellmap_flow.finetune.session.manifest.GOOD_REGIONS_FILENAME Functions --------- .. autoapisummary:: cellmap_flow.finetune.session.manifest.write_manifest cellmap_flow.finetune.session.manifest.read_manifest cellmap_flow.finetune.session.manifest.good_regions_path cellmap_flow.finetune.session.manifest.load_good_regions cellmap_flow.finetune.session.manifest.save_good_regions cellmap_flow.finetune.session.manifest.load_good_regions_for cellmap_flow.finetune.session.manifest.voxels_inside_any_bbox cellmap_flow.finetune.session.manifest.has_painted_annotations Module Contents --------------- .. py:data:: logger .. py:data:: VIRTUAL_MANIFEST_FILENAME :value: '_virtual_sources.json' .. py:data:: GOOD_REGIONS_FILENAME :value: 'good_regions.json' .. py:function:: write_manifest(corrections_dir: str, manifest: dict) -> str Persist a manifest sentinel that ``create_dataloader`` looks for. .. py:function:: read_manifest(corrections_dir: str) -> Optional[dict] Return the manifest if present, else ``None``. .. py:function:: good_regions_path(corrections_dir: Optional[str]) -> Optional[str] Where the good regions of the session owning ``corrections_dir`` live: beside it, in the session directory. None without a corrections dir. .. py:function:: load_good_regions(path: Optional[str]) -> list The regions stored at ``path``; [] when there are none or they can't be read. .. py:function:: save_good_regions(path: str, regions: list) -> bool Replace the regions at ``path`` atomically; False if it could not be written. .. py:function:: load_good_regions_for(corrections_dir: Optional[str]) -> 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. .. py:function:: 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. .. py:function:: 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.