labels_to_indices — REPRCONV index op

• Data kinds: labels → indices

• Call: import fullseye as fs; fs.ledger.labels_to_indices(labels) (to call the implementation directly, import reprconv; reprconv.labels_to_indices(labels); from the registry, opsreprconv.get("labels_to_indices"))

Usage

labels → the indices (N,) of the non-background. The other direction of indices_to_labels.

Also accepts label images of 2-D or more -- in that case the indices are indices into labels.ravel() (C order). They can be turned back into coordinates with np.unravel_index, but turning them back needs the original shape, so this direction discards shape (irreversible).

Args:

labels: integer/real label array of any dimension.

Returns:

(N,) int64. Flat indices (ascending) of the positions where the label is not 0.

Raises:

ValueError: empty / non-finite / not even 1 non-background element.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• representation_conversion — py -3.11 examples/representation_conversion.py

Ops the type connects to (they accept indices as input)

indices_to_labels · select_points

Same category (index)

indices_to_labels · select_points


*Provenance: reprconv.py — REPRCONV operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

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