MotionTarget#

class petpal.preproc.motion_target.MotionTarget(image_loader: petpal.io.image.ImageLoader | None = None)#

Create a static target representing a dynamic PET image, to be used for optimizing co-registration.

set_input_scan_properties(input_image_path: str)#

Load input image and get half life and scan timing. Set as MotionCorrect attributes.

Parameters:

input_image_path (str) – Path to dynamic PET image.

mean_target(input_image_path: str)#
frame_target(input_image_path: str, frame: int)#
sum_target(input_image_path: str, start_time: float = 0, end_time: float = -1)#
__call__(input_image_path: str, out_image_path: str, operation: str = 'sum', frame: int = 70, start_time: float = 0, end_time: float = -1) ants.ANTsImage#

Create a static target representing a dynamic PET image, to be used for optimizing co-registration.

Parameters:
  • input_image_path (str) – Path to dynamic PET image.

  • out_image_path (str) – Path to where static target is saved.

  • operation (str) – Setting to use for retrieving the static target. Options include ‘mean’, ‘frame’, and ‘sum’. ‘mean’ calculates the mean over the dynamic image without weighting frames, ‘frame’ extracts a single, specified frame (indexing from zero), and ‘sum’ calculates the weighted sum over a specified time window. Default ‘sum’.

  • frame (int) – Frame to extract if operation is ‘frame’. Indexes from zero, meaning use 0 for the first frame. Default ‘70’.

  • start_time (float) – Beginning of window to sum over if operation is ‘sum’. Measured in seconds from scan start. Default 0.

  • end_time (float) – End of window to sum over if operation is ‘sum’. Measured in seconds from scan start. Default -1 (refers to end of scan).

Returns:

target_img (ants.ANTsImage) – The target image.