labels_to_indices — REPRCONV index op

資料種類:labelsindices

呼叫:import reprconv; reprconv.labels_to_indices(labels)(或 opsreprconv.get("labels_to_indices"))

用法

`labels → 非背景的索引 (N,)。:func: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_conversionpy -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.