gaussians_to_voxel — REPRCONV gaussians op

Data kinds: gaussiansvoxel

Call: import reprconv; reprconv.gaussians_to_voxel(gaussians, shape=(32, 32, 32), origin=(0.0, 0.0, 0.0), spacing=(1.0, 1.0, 1.0), truncate=3.0) (or opsreprconv.get("gaussians_to_voxel"))

Usage

`gaussians → a density voxel (D,H,W). The second exit from gaussians`.

> The detailed description below is the original text — the summary and the headings are translated.

各ガウシアンを `truncate * sigma` で打ち切って加算する。**格子の原点と

刻みを明示引数にしてある**のが要点で、既定の `spacing=(1,1,1)` を

そのまま使うと「世界座標をそのまま添字にする」ことになり、実データでは

まず間違う —— しかも例外は出ず、密度が別の場所に立つだけなので気づけない。

`tests/test_reprconv.py` はこの取り違えを明示的に測っている。

不可逆。損失は 3 つあり、どれも数字で測れる:

打ち切り —— 打ち切りは軸並行の箱(各軸 ±truncate*sigma)なので、

残る質量は `erf(t/sqrt(2))**3`。t = 3 で 99.194%

★ここは一度間違えた: 最初「3 sigma のの質量 97.07%」と書いたが、

実装は箱なので値が違う。刻みを 1.0 → 0.125 と細かくして極限を取ると

99.30% → 99.19% へ収束し、球の 97.07% には近づかないことで反証できた

(`tests/test_reprconv.py::test_gaussians_to_voxel_mass_matches_box_truncation`)。

例外も NaN も出ない、まさに「黙って間違った数字を返す」種類の誤り。

格子求積 —— 中点則なので刻みが sigma に対して粗いと上振れする

(実測: sigma = 1.5 で刻み 1.0 のとき 99.94%、0.125 で 99.30%)。

境界の切り落とし —— 箱が volume の外へ出た分は落ちる。中心が縁に

近いガウシアンでは打ち切りより遥かに大きい損失になる。

Args:

gaussians: `mu / sigma / w を持つ dict。mu` は (z, y, x)。

shape: (D, H, W)。

origin: 格子の (z, y, x) 原点(世界座標)。

spacing: 格子の (dz, dy, dx) 刻み(世界単位 / voxel)。

truncate: 何 sigma で打ち切るか(既定 3)。

Returns:

(D, H, W) float64 の密度(値は「voxel あたりの重み和」で、体積積分が

`sum(w)` に近づく)。

Raises:

ValueError: shape/spacing 不正 / truncate <= 0 / gaussians 不正。

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_roundtrippy -3.11 examples/representation_roundtrip.py

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

correlation_score

Same category (gaussians)

points_to_gaussians · gaussians_to_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.