neu_morpho.ops.export_roi_seg

Copy the ROI’s segmentation into the output as a precomputed volume.

So meshes and skeletons can be inspected against the labels they came from. Each scale carries its voxel_offset, so the labels land in the same physical-nm space as the meshes.

Every source scale is copied, not regenerated: each is cropped directly into the matching destination scale, where downsampling from level 0 would re-read far more data and might not reproduce the source’s own rule.

Cost is uneven: scale 0 usually dominates by an order of magnitude. scale_cost() reports it and scale_indices restricts the range. By default the region is expanded to whole blocks, matching what stage 1 meshed (roi.py).

Attributes

Functions

block_align(roi, block_shape, shape) → tuple[int, ...]

Expand an ROI to whole blocks of the global grid, clipped to the volume.

export_roi_seg(src, out_dir, *, roi, roi_voxel_size[, ...]) → dict

Write the ROI's labels to out_dir as a multiscale precomputed volume.

scale_cost(src, roi, roi_voxel_size, *[, block_shape, ...]) → list[dict]

Per-scale shape and byte estimate for an export — check before running one.

source_levels(src, roi_voxel_size) → list[tuple]

[(ScaleInfo, read_spec)] for the source, finest first.

Module Contents

neu_morpho.ops.export_roi_seg.block_align(roi: Sequence[int], block_shape: Sequence[int], shape: Sequence[int]) → tuple[int, ...]

Expand an ROI to whole blocks of the global grid, clipped to the volume.

neu_morpho.ops.export_roi_seg.export_roi_seg(src: dict | str, out_dir: str, *, roi: Sequence[int] | str | None, roi_voxel_size: Sequence[float], scale_indices: Sequence[int] | None = None, block_shape: Sequence[int] = (256, 256, 256), align_to_blocks: bool = True, copy_block: Sequence[int] = DEFAULT_COPY_BLOCK, encoding: str | None = 'compressed_segmentation', progress_path: str | None = None, client: Any | None = None, npartitions: int | None = None, delete_existing: bool = False, resume: bool = True) → dict

Write the ROI’s labels to out_dir as a multiscale precomputed volume.

roi is in the voxels of the scale whose voxel size is roi_voxel_size; None copies the whole volume. scale_indices selects which source scales to copy (default: all) — see scale_cost() first, since scale 0 usually dominates.

neu_morpho.ops.export_roi_seg.scale_cost(src, roi, roi_voxel_size, *, block_shape=(256, 256, 256), align_to_blocks: bool = True, scale_indices=None) → list[dict]

Per-scale shape and byte estimate for an export — check before running one.

neu_morpho.ops.export_roi_seg.source_levels(src, roi_voxel_size) → list[tuple]

[(ScaleInfo, read_spec)] for the source, finest first.

A source with no pyramid metadata (a bare array, an HDF5 dataset) is one level at roi_voxel_size.

neu_morpho.ops.export_roi_seg.DEFAULT_COPY_BLOCK = (512, 512, 512)
neu_morpho.ops.export_roi_seg.PRECOMPUTED_PROFILE = 's3-neuroglancer'
neu_morpho.ops.export_roi_seg.logger