autods_pet.roi.brain#

Brain reference ROI: cortical gray matter extraction and PET statistics.

class autods_pet.roi.brain.BrainROI(brain_label=90, grey_matter_only=True, cortical_thickness_mm=5.0, stats=None)[source]#

Bases: object

Brain reference ROI extraction and refinement.

When grey_matter_only is True (default), the brain mask is refined to isolate cortical gray matter using a shell extraction: the mask is eroded by cortical_thickness_mm to obtain the white-matter core, then subtracted from the original to yield the cortical shell.

Parameters:
  • brain_label (int (default: 90)) – TotalSegmentator label for brain (default 90).

  • grey_matter_only (bool (default: True)) – If True, extract cortical gray matter shell. If False, use the full brain mask.

  • cortical_thickness_mm (float (default: 5.0)) – Erosion radius used for the shell extraction (only when grey_matter_only is True).

  • stats (list[str] | None (default: None)) – Statistics to compute (e.g. ["median"]). Defaults to ["median"].

refine(whole_seg)[source]#

Refine TotalSegmentator brain label.

If grey_matter_only is True, produces a cortical shell mask (original minus eroded). Otherwise returns the cleaned brain mask.

Parameters:

whole_seg (Image) – TotalSegmentator multilabel segmentation.

Returns:

Result with refined_mask and shrinkage populated, or None if the brain label is absent from the segmentation.

Return type:

ROIResult | None

extract(whole_seg, pet)[source]#

Refine mask and compute PET statistics in one call.

Parameters:
  • whole_seg (Image) – TotalSegmentator multilabel segmentation.

  • pet (Image) – PET SUV image (must share geometry with whole_seg).

Returns:

Result with refined_mask, shrinkage, and stats populated, or None if the brain label is absent from the segmentation.

Return type:

ROIResult | None

Raises:

ValueError – If whole_seg and pet have mismatched geometry.