autods_pet.imaging.normalization#
SUV normalization for PET images.
Converts raw PET activity concentration (Bq/mL) to SUV body-weight (SUVbw) using patient weight and injected dose. Includes helpers for parsing DICOM timing metadata and computing decay-corrected dose.
- autods_pet.imaging.normalization.parse_dicom_time(tstr)[source]#
Parse a DICOM TM string into a
datetime.time.Handles missing leading zeros, fractional seconds, and hours >= 24 (wrapped modulo 24).
- Parameters:
tstr (
str) – DICOM TM-format string (e.g."143012.123456").- Return type:
- Raises:
ValueError – If tstr is empty.
Examples
>>> from autods_pet.imaging.normalization import parse_dicom_time >>> parse_dicom_time("143012.000000") datetime.time(14, 30, 12) >>> parse_dicom_time("090000") datetime.time(9, 0)
- autods_pet.imaging.normalization.parse_dicom_date(dstr)[source]#
Parse a DICOM DA string (
YYYYMMDD) into adatetime.date.- Parameters:
dstr (
str) – DICOM DA-format string (e.g."20230415").- Return type:
- Raises:
ValueError – If dstr is too short or contains invalid month/day.
Examples
>>> from autods_pet.imaging.normalization import parse_dicom_date >>> parse_dicom_date("20230415") datetime.date(2023, 4, 15)
- autods_pet.imaging.normalization.seconds_between(injection, acquisition, max_uptake_hours=6.0)[source]#
Seconds elapsed from injection to acquisition, handling midnight wrap.
If the elapsed time is slightly negative (0 to
-max_uptake_hours), assumes the acquisition crossed midnight and adds 24 h. If more negative than-max_uptake_hours, still corrects but logs a warning.- Parameters:
injection (
datetime) – Radiopharmaceutical injection time.acquisition (
datetime) – PET acquisition time.max_uptake_hours (
float(default:6.0)) – Maximum expected injection-to-scan interval in hours. Negative elapsed times within this window are assumed to be midnight wraparounds. The default of 6 h is appropriate for standard 18F-FDG protocols (typical uptake ~60 min). Increase for tracers with longer uptake periods (e.g. 68Ga-DOTATATE).
- Returns:
Elapsed seconds (always >= 0 after midnight correction).
- Return type:
Examples
>>> from datetime import datetime >>> from autods_pet.imaging.normalization import seconds_between >>> seconds_between(datetime(2023, 1, 1, 9, 0), datetime(2023, 1, 1, 10, 0)) 3600.0
- autods_pet.imaging.normalization.decay_dose(dose_bq, half_life_s, elapsed_s)[source]#
Apply radioactive decay:
dose * exp(-lambda * t).- Parameters:
- Returns:
Decayed dose in Bq.
- Return type:
Examples
>>> from autods_pet.imaging.normalization import decay_dose >>> round(decay_dose(370e6, 6586.2, 3600), 1) 253314180.2
- autods_pet.imaging.normalization.effective_dose(total_dose_bq, half_life_s, elapsed_s, decay_correction)[source]#
Determine the effective reference dose depending on the DICOM DecayCorrection tag.
- Parameters:
- Returns:
Dose in Bq to use as the SUV denominator.
- Return type: