resample_segmentation#

petpal.preproc.segmentation_tools.resample_segmentation(input_image_path: str, segmentation_image_path: str, out_seg_path: str, verbose: bool)#

Resamples a segmentation image to the resolution of a 4D PET series image. Takes the affine information stored in the PET image, and the shape of the image frame data, as well as the segmentation image, and applies NiBabel’s resample_from_to to resample the segmentation to the resolution of the PET image. This is used for extracting TACs from PET imaging where the PET and ROI data are registered to the same space, but have different resolutions.

Parameters:
  • input_image_path (str) – Path to a .nii or .nii.gz file containing a 4D PET image, registered to anatomical space, to which the segmentation file is resampled.

  • segmentation_image_path (str) – Path to a .nii or .nii.gz file containing a 3D segmentation image, where integer indices label specific regions.

  • out_seg_path (str) – Path to a .nii or .nii.gz file to which the resampled segmentation image is written.

  • verbose (bool) – Set to True to output processing information.