Configuration and status codes

The run configuration and the per-point status codes. The fields are described in full in Run configuration and Status codes.

zvdvc.config

Run configuration.

A frozen dataclass tree describes one run. Where a CCPi DVC input key exists, it is given in the comment, so a CCPi dvc_in file maps onto this one to one (zvdvc.io.ccpi.read_dvc_input()). Axis conventions: points and vectors are (x, y, z) in voxels; shapes and boxes of arrays are (z, y, x).

class zvdvc.config.VolumeSpec(reference: 'str', deformed: 'str', array_path: 'str' = '0', raw_shape_xyz: 'tuple[int, int, int] | None' = None, raw_dtype: 'str | None' = None, raw_header_bytes: 'int' = 0, prefilter_sigma: 'float' = 0.0, gpu_io: 'GpuIo' = 'auto')[source]

Bases: object

Parameters:
  • reference (str)

  • deformed (str)

  • array_path (str)

  • raw_shape_xyz (tuple[int, int, int] | None)

  • raw_dtype (str | None)

  • raw_header_bytes (int)

  • prefilter_sigma (float)

  • gpu_io (Literal['auto', 'host', 'kvikio'])

reference: str
deformed: str
array_path: str = '0'
raw_shape_xyz: tuple[int, int, int] | None = None
raw_dtype: str | None = None
raw_header_bytes: int = 0
prefilter_sigma: float = 0.0
gpu_io: Literal['auto', 'host', 'kvikio'] = 'auto'
class zvdvc.config.SubvolumeSpec(geometry: 'Geometry' = 'sphere', size: 'float' = 80.0, n_samples: 'int' = 8000, aspect: 'Vec3' = (1.0, 1.0, 1.0), seed: 'int' = 0)[source]

Bases: object

Parameters:
geometry: Literal['cube', 'sphere'] = 'sphere'
size: float = 80.0
n_samples: int = 8000
aspect: tuple[float, float, float] = (1.0, 1.0, 1.0)
seed: int = 0
class zvdvc.config.ThresholdSpec(gray_min: 'float', gray_max: 'float', min_fraction: 'float' = 0.2)[source]

Bases: object

Parameters:
gray_min: float
gray_max: float
min_fraction: float = 0.2
class zvdvc.config.SearchSpec(dof: 'Literal[3, 6, 12]' = 6, objective: 'Objective' = 'znssd', interpolation: 'Interpolation' = 'tricubic', disp_max: 'float' = 38.0, rigid_trans: 'Vec3' = (0.0, 0.0, 0.0), basin_radius: 'float' = 0.0, threshold: 'ThresholdSpec | None' = None, method: 'Method' = 'fagn', max_iterations: 'int' = 20, obj_tol: 'float' = 1e-06, disp_tol: 'float' = 0.01, report_convg_fail: 'bool' = True)[source]

Bases: object

Parameters:
dof: Literal[3, 6, 12] = 6
objective: Literal['sad', 'ssd', 'zssd', 'nssd', 'znssd'] = 'znssd'
interpolation: Literal['nearest', 'trilinear', 'tricubic'] = 'tricubic'
disp_max: float = 38.0
rigid_trans: tuple[float, float, float] = (0.0, 0.0, 0.0)
basin_radius: float = 0.0
threshold: ThresholdSpec | None = None
method: Literal['fagn', 'icgn'] = 'fagn'
max_iterations: int = 20
obj_tol: float = 1e-06
disp_tol: float = 0.01
report_convg_fail: bool = True
class zvdvc.config.SeedingSpec(strategy: 'SeedStrategy' = 'wavefront', start_point: 'Vec3 | None' = None, n_neighbours: 'int' = 75, shell_width: 'float | None' = None, coarse_stride: 'int' = 4, coarse_level: 'int' = 1, repair_passes: 'int' = 1)[source]

Bases: object

Parameters:
strategy: Literal['rigid', 'wavefront', 'coarse', 'fft'] = 'wavefront'
start_point: tuple[float, float, float] | None = None
n_neighbours: int = 75
shell_width: float | None = None
coarse_stride: int = 4
coarse_level: int = 1
repair_passes: int = 1
class zvdvc.config.ClusterSpec(tile_shape: 'tuple[int, int, int]' = (1024, 1024, 1024), devices: 'tuple[int, ...] | None' = None, gpu_memory_fraction: 'float' = 0.8, batch_points: 'int | None' = None, prefetch_depth: 'int' = 2, brick_dtype: "Literal['native', 'float32']" = 'native', scheduler: "Literal['dynamic', 'static']" = 'dynamic')[source]

Bases: object

Parameters:
tile_shape: tuple[int, int, int] = (1024, 1024, 1024)
devices: tuple[int, ...] | None = None
gpu_memory_fraction: float = 0.8
batch_points: int | None = None
prefetch_depth: int = 2
brick_dtype: Literal['native', 'float32'] = 'native'
scheduler: Literal['dynamic', 'static'] = 'dynamic'
class zvdvc.config.RunConfig(volumes: 'VolumeSpec', points: 'str', output: 'str', subvolume: 'SubvolumeSpec' = <factory>, search: 'SearchSpec' = <factory>, seeding: 'SeedingSpec' = <factory>, cluster: 'ClusterSpec' = <factory>, num_points_to_process: 'int | None' = None, uncertainty_seeds: 'int' = 0, workdir: 'str' = 'runs/default')[source]

Bases: object

Parameters:
volumes: VolumeSpec
points: str
output: str
subvolume: SubvolumeSpec
search: SearchSpec
seeding: SeedingSpec
cluster: ClusterSpec
num_points_to_process: int | None = None
uncertainty_seeds: int = 0
workdir: str = 'runs/default'
classmethod from_yaml(path)[source]
Parameters:

path (str | Path)

Return type:

RunConfig

classmethod from_dict(data)[source]

Build from nested plain data and validate() it.

Unknown or missing keys, invalid choices and out-of-range values raise ValueError.

Parameters:

data (dict[str, Any])

Return type:

RunConfig

classmethod from_ccpi(path)[source]

Build from a CCPi dvc_in file (see zvdvc.io.ccpi); relative paths resolve against its folder.

Parameters:

path (str | Path)

Return type:

RunConfig

to_yaml(path)[source]
Parameters:

path (str | Path)

Return type:

None

to_dict()[source]
Return type:

dict[str, Any]

validate()[source]

Check ranges and choices; returns self. The ValueError names the first offending key.

Settings that are read but not used yet warn when they differ from their default.

Return type:

RunConfig

halo()[source]

Brick margin around a tile’s points, in voxels.

The subvolume’s farthest sample (half-diagonal for a cube, since 6/12-DOF warps rotate it), plus disp_max, plus the 2-voxel cubic stencil. The spread of seeds within a tile is added at plan time.

Return type:

float

zvdvc.status

Per-point search status.

Codes 0 to -3 are CCPi DVC’s (Core/Utility.h) and keep their meaning, so exported .disp files read correctly in iDVC. Codes below -3 are zvDVC additions; the CCPi exporter maps them to NOT_SEARCHED.

class zvdvc.status.PointStatus(value)[source]

Bases: IntEnum

GOOD = 0
RANGE_FAIL = -1
CONVG_FAIL = -2
NOT_SEARCHED = -3
THRESH_FAIL = -4
SINGULAR = -5
to_ccpi()[source]
Return type:

int