Spaces:
Running on Zero
Running on Zero
File size: 1,023 Bytes
ab1db83 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | from __future__ import annotations
from dataclasses import dataclass, field
from typing import Literal, Optional
ModelKey = Literal["ct", "mr", "mr_brain"]
@dataclass
class GenerationRequest:
model: ModelKey
output_size: tuple[int, int, int]
spacing: tuple[float, float, float]
seed: int = 0
num_steps: int = 30
cfg_guidance_scale: float = 0.0
# CT-only
body_region: Optional[list[str]] = None
anatomy_list: Optional[list[str]] = None
generate_masks: bool = True
# MR-only (modality int from configs/modality_mapping.json: 8/9/10/11/...)
modality_class: Optional[int] = None
# MR-Brain-only (mapped to a modality int)
contrast: Optional[str] = None # "T1" / "T2" / "FLAIR" / "SWI" / "T1_skull_stripped" / ...
@dataclass
class GenerationResult:
volume_path: str
mask_path: Optional[str] = None
used_anatomy_labels: dict[int, str] = field(default_factory=dict)
runtime_seconds: float = 0.0
seed: int = 0
modality: Optional[int] = None
|