Refine registration series defaults and mapping controls

This commit is contained in:
Codex
2026-05-29 00:33:40 +08:00
parent c4f0fd54d6
commit f9063b674c
4 changed files with 404 additions and 70 deletions

View File

@@ -799,7 +799,9 @@ def dicom_fusion_volume(
series_uid: str,
center_index: int = 0,
window: str = "soft",
radius: int = Query(default=24, ge=4, le=48),
radius: int = Query(default=96, ge=4, le=512),
range_start: int | None = None,
range_end: int | None = None,
_: str = Depends(require_auth),
) -> dict[str, Any]:
stack_data = load_stack_data(ct_number, series_uid)
@@ -807,10 +809,17 @@ def dicom_fusion_volume(
datasets = stack_data["datasets"]
total = int(stack.shape[0])
center_index = min(max(0, center_index), total - 1)
start = max(0, center_index - radius)
end = min(total - 1, center_index + radius)
if end - start + 1 > 48:
step = int(np.ceil((end - start + 1) / 48))
if range_start is not None and range_end is not None:
start = min(max(0, int(range_start)), total - 1)
end = min(max(0, int(range_end)), total - 1)
if start > end:
start, end = end, start
else:
start = max(0, center_index - radius)
end = min(total - 1, center_index + radius)
max_frames = 72
if end - start + 1 > max_frames:
step = int(np.ceil((end - start + 1) / max_frames))
indices = list(range(start, end + 1, step))
else:
indices = list(range(start, end + 1))