roi_tac#

petpal.preproc.regional_tac_extraction.roi_tac(input_image_path: str, roi_image_path: str, region: list[int] | int, out_tac_path: str | None = None, time_frame_keyword: str = 'FrameReferenceTime') petpal.utils.time_activity_curve.TimeActivityCurve#

Function to write Tissue Activity Curves for a single region, given a mask, 4D PET image, and region mapping. Computes the average of the PET image within each region. Writes a tsv table with region name, frame start time, and mean value within region.

Parameters:
  • input_image_path (str) – Path to the 4D PET image from which the regional TAC will be extracted.

  • roi_image_path (str) – Path to the segmentation image containing ROIs. Must be in the same space as input_image.

  • region (list[int] | int) – The region or regions that will be extracted as a TAC. If a list of regions are provided, the function combines all listed regions and calculates the TAC from the merged region.

  • out_tac_dir (str) – Path to the TSV where the regional TAC will be written to.

  • time_frame_keyword (str) – Keyword corresponding to either ‘FrameReferenceTime’ or ‘FrameTimesStart’ to get the frame timing. Default ‘FrameReferenceTime’.

Returns:

region_tac (TimeActivityCurve) – The mean time activity curve for the region.