labels_to_indices — REPRCONV index op

• 数据种类:labels → indices

• 调用: import fullseye as fs; fs.ledger.labels_to_indices(labels)(要直接调用实现,import reprconv; reprconv.labels_to_indices(labels);从台账取用则 opsreprconv.get("labels_to_indices"))

用法

labels → 非背景的索引 (N,)。indices_to_labels 的反向。

也接受 2-D 以上的标签图像 —— 此时的下标是 对 labels.ravel() 的下标(C 顺序)。可用 np.unravel_index 还原为坐标, 但还原需要原来的 shape,所以这个方向舍弃了 shape(不可逆)。

Args:

labels: 任意维度的整数/实数标签数组。

Returns:

(N,) int64。标签不为 0 的位置的平坦下标(升序)。

Raises:

ValueError: 空 / 非有限 / 连 1 个非背景元素也没有。

参考(示例数据、文献)

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

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

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

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

• representation_conversion — py -3.11 examples/representation_conversion.py

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

indices_to_labels · select_points

同类别(index)

indices_to_labels · select_points


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

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