vol_labels_to_meshes — VOLCOLOR render op

• 数据种类:labels → table

• 调用: import fullseye as fs; fs.ledger.vol_labels_to_meshes(labels, ids=None, spacing=None, seed: 'int' = 0, level: 'float' = 0.5, axes: 'str' = 'xyz')(要直接调用实现,import volcolor; volcolor.vol_labels_to_meshes(labels, ids=None, spacing=None, seed: 'int' = 0, level: 'float' = 0.5, axes: 'str' = 'xyz');从台账取用则 opsvolcolor.get("vol_labels_to_meshes"))

用法

对每个成分做 marching cubes,得到一组彩色网格。

返回 list[dict],各元素为 {"label", "vertices" (nv, 3) float64, "faces" (nf, 3) int64, "color" (r, g, b)}。颜色与 vol_colorize_labels 使用同一调色板,所以在断面图和 3-D 显示中同一部件呈现同一颜色。

对每个成分只切出把 bbox 填充 1 体素后的子体, 再运行 marching cubes(不会按成分数遍历整个体数据)。填充是为了封闭接触体数据边缘的成分的面,不这样做的话,只有边缘的成分会成为有洞的网格。

axes:

• "xyz"(默认)—— 以 (x, y, z) 返回顶点。render3d / mesh 的顶点顺序就是这样,可直接传给 render3d.render_mesh。

• "zyx" —— 保持体数据的下标顺序返回。与 vol_label_shape_stats 的 centroid 顺序相同。

默默弄错也不会抛异常 —— 出来的是上下与前后互换的、

看似合理的图。tests/test_volcolor.py::test_mesh_axes_order_is_explicit

把两者的质心与 stats 的质心对照,加以固定。

传入 *spacing* 时顶点为物理坐标(mm)。可用 *ids* 筛选成分(None 时为实际存在的全部标签,但最多 MAX_MESHES 个)。

marching cubes 不可用时抛出 ImportError(附带 pip install scikit-image 的提示); *axes* 不正确、*level* 在 (0, 1) 之外、*ids* 指定了不存在的标签,或成分超过 MAX_MESHES 个时,抛出 ValueError。

参考(示例数据、文献)

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

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

• 算法的正典(作者、年份)与用途见上面的族使用指南。

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

• voxel_labels_color — py -3.11 examples/voxel_labels_color.py

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

—

同类别(render)

vol_label_volume_render


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

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