autods_pet.patient#

Patient case: resolved paths and lazy image loading for a single patient.

autods_pet.patient.resolve_paths(cfg, patient_id)[source]#

Build concrete file paths for a patient from config path templates.

Output paths (NIfTI, segmentations, metadata, results) are resolved relative to output_dir. The input_dir key points to the source data directory (basepath / patient_id).

Parameters:
Returns:

Mapping of logical names to resolved Path objects.

Return type:

dict[str, Path]

class autods_pet.patient.PatientCase(cfg, patient_id)[source]#

Bases: object

Represents a single patient with resolved paths and lazy image loading.

Parameters:
property ct_path: Path#

Path to the CT NIfTI file.

property pet_path: Path#

Path to the PET NIfTI file.

property pet_suv_path: Path#

Path to the PET SUV file.

property pet_registered_path: Path#

Path to the registered PET file.

property seg_dir: Path#

Path to the segmentation directory.

property vert_body_seg_path: Path#

Path to the vertebral body segmentation file.

property metadata_path: Path#

Path to the PET metadata file.

property input_dir: Path#

Path to the source data directory (DICOM/NIfTI).

property input_seg_dir: Path#

Path to the input segmentations directory.

property output_dir: Path#

Path to the global output directory.

property elastix_report_path: Path#

Path to the Elastix registration report.

property deauville_csv_path: Path#

Path to the per-patient Deauville scores CSV.

property suv_csv_path: Path#

Path to the per-patient SUV values CSV.

property pet_series_uid: str | None#

Read the PET SeriesInstanceUID from PET_metadata.json.

Returns None when the metadata file does not exist or does not contain the field (e.g. patients converted before this field was captured). Cached after the first read.

load_ct()[source]#

Load the CT NIfTI image (cached).

Return type:

Any

load_pet_suv()[source]#

Load the SUV-normalised PET image (cached).

Return type:

Any

load_pet_registered()[source]#

Load the registered PET SUV image (cached).

Return type:

Any

load_segmentation()[source]#

Load the TotalSegmentator multilabel segmentation (cached).

Searches for TOTSEG_FILENAME (or legacy whole_seg.nii[.gz]) in seg_dir.

Return type:

Any

load_vert_body_seg()[source]#

Load the vertebral body segmentation, or None if unavailable.

Return type:

Any | None

clear_cache()[source]#

Release all cached images to free memory.

Return type:

None