vol_distance_transform — 3D medial op

• 数据种类:voxel → voxel

• 调用: import fullseye as fs; fs.ledger.vol_distance_transform(vol_binary, spacing=None)(要直接调用实现,import volops; volops.vol_distance_transform(vol_binary, spacing=None);从台账取用则 ops3d.get("vol_distance_transform"))

• GPU:有(许可列表中的机械式 GPU 路径,CuPy)。device="auto" 在实测尺寸(16,777,216 像素)及以上选择 GPU

用法

二值体的精确欧氏距离变换。

> 以下的详细说明为原文 —— 摘要与标题已翻译。

Each foreground (non-zero) voxel is labelled with its Euclidean distance to the nearest background voxel, via scipy.ndimage.distance_transform_edt. Pass *spacing* (sz, sy, sx) (e.g. VolumeMeta.spacing_mm, or the VolumeMeta itself) to make the distance anisotropy-aware — millimetres rather than voxels; otherwise unit spacing is assumed. A non-{0, 1} input is thresholded at > 0.5.

Returns a (D, H, W) float64 distance field (0 on the background). Outside the volume is not background (a foreground slab touching the edge keeps growing towards it). With no background voxel at all the nearest background is infinitely far: every voxel is inf (the 2-D distance_transform returns its normalised maximum 1.0 in the same case). This op returns absolute distances, so the 2-D convention (normalise to 1.0) does not carry over; inf was chosen over raising so that a mixed batch keeps its shape. Dividing by the maximum afterwards gives NaN — check np.isinf first.

Reference: Felzenszwalb & Huttenlocher, Theory of Computing 2012.

Empty input (vol_binary with 0 elements) raises ValueError.

参考(示例数据、文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

可运行的示例(实际调用该算子并已验证的样例)

• medial_topology — py -3.11 examples_3d/medial_topology.py

• molecule_atom_count — py -3.11 examples_3d/molecule_atom_count.py

• nearest_seed_partition — py -3.11 examples_3d/nearest_seed_partition.py

• vessel_metrology — py -3.11 examples_3d/vessel_metrology.py

类型可衔接的下一个算子(可接受 voxel 作为输入)

voxel_to_mips · voxel_to_mesh · signed_distance_field · to_points · sobel3d · hessian3d · curvature_maps · edt_jfa

同类别(medial)

distance_ridge · skeletonize_vol · medial_axis_points · topology_signature · medial_match · skeleton_junctions3d · skeleton_endpoints3d · skeleton_prune3d


*Provenance: volops.py — 3D 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.