vol_resize — 3D geom_transform op

데이터 종류: voxelvoxel

호출: import fullseye as fs; fs.ledger.vol_resize(vol, factor=None, shape=None, order=1, spacing=None, mode='nearest', cval=0.0)(구현을 직접 호출하려면 import volxform; volxform.vol_resize(vol, factor=None, shape=None, order=1, spacing=None, mode='nearest', cval=0.0), 원장에서 가져오려면 ops3d.get("vol_resize"))

원장 경유의 반환값: fullseye.ledger.vol_resize(...) 는 **선언된 out 형 voxel 의 값만** 반환합니다(실제 함수는 보조 정보도 반환). 버려진 쪽이 필요하면 fullseye.ledger.vol_resize.raw(...) 를 쓰거나 volxform.vol_resize 를 직접 호출하세요.

• 실제 반환: spacing 付き時

사용법

볼륨을 새 격자로 재표본화(`scipy.ndimage.zoom`, 셀 의미론).

> 아래 상세 설명은 원문입니다 —— 요약과 제목은 번역되어 있습니다.

Exactly one of *factor* / *shape* selects the target grid:

• `factor — a positive scalar or (fz, fy, fx)`; the output shape is

`round(dim * f) per axis (scipy's rule, each >= 1`).

• `shape — the exact output (D', H', W')` (positive integers).

Sampling uses `grid_mode=True` (cell semantics): a voxel is a *cell*, so

an integer upscale `f maps input voxel i` exactly onto the output

block `[f*i, f*(i+1)) (exact at order=0`), and the volume's physical

extent is preserved by the recomputed spacing — not the endpoint-aligned

convention of scipy's `grid_mode=False` default.

*mode* / *cval* set how samples that fall outside the input cells (the outer

half-voxel shell of every upscale at `order >= 1`) are filled. The default

`"nearest"` extends the border voxel, so **a constant volume resizes to

the same constant** and a ramp keeps its end values. Until 2026-09-03 the

call was hard-wired to `"grid-constant" with cval=0`, which blended

the outer shell toward 0 — an upscale x2 of an all-ones volume came back

with `min = 0.42` on its faces, an artefact that then leaked into every

downstream measurement. Other accepted modes: `"reflect", "mirror"`,

`"grid-mirror", "grid-wrap", and "grid-constant"` (with *cval*)

when a zero-padded border is genuinely wanted. `"constant" / "wrap"`

are rejected with a hint (scipy needs the `grid-` variants here).

The return shape depends on *spacing*:

• `spacing=None (default) — returns the resampled (D', H', W')`

float64 volume alone.

• *spacing* given (`(sz, sy, sx) or a VolumeMeta`) — returns a

2-tuple `(out, new_spacing)` where

`new_spacing = (sz * D/D', sy * H/H', sx * W/W')`, so

`out.shape * new_spacing == vol.shape * spacing` per axis: the physical

size in millimetres is invariant. Keep the new spacing — every

spacing-aware operator downstream needs it.

*order* is the spline degree (exact integer 0..5; 0 = nearest — the choice

for masks / labels, 1 = trilinear — the grey-value default; >1 can

overshoot, see the module notes). Shrinking aliases (no band-limiting) —

mean-pool with :func:volops.volume_downsample first for large reductions.

Raises `ValueError` when both or neither of *factor* / *shape* are given,

or when the output would exceed `MAX_VOXELS` (checked before any

allocation — a huge factor cannot balloon memory).

참고(샘플 데이터·문헌)

• 샘플 데이터 카탈로그(DL URL / 라이선스) —— 2-D 는 skimage.data(BSD/public)+ 합성, 3-D 는 실데이터 소스(Stanford/PDS 등)의 DL URL.

• 연산자의 내력·참고문헌 —— 이 연산자 족의 바탕이 된 연구/기법의 출처.

실행 가능한 예제(이 연산자를 실제로 호출하는 검증된 샘플)

vol_geometry_transformpy -3.11 examples_3d/vol_geometry_transform.py

타입이 이어지는 다음 연산자(voxel 를 입력으로 받는 것)

voxel_to_mips · voxel_to_mesh · signed_distance_field · to_points · sobel3d · hessian3d · curvature_maps · edt_jfa

같은 카테고리(geom_transform)

vol_rotate · vol_affine


*Provenance: volxform.py — 3D 연산자 레지스트리. 이 op 노트는 tools/opdocs.py md 가 자동 생성합니다(직접 편집하지 마세요).*

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