determine_motion_target#

petpal.preproc.motion_target.determine_motion_target(motion_target_option: str | tuple | list, input_image_path: str = None) str#

Produce a motion target given the motion_target_option from a method running registrations on PET, i.e. motion_correction() or register_pet().

The motion target option can be a string or a tuple. If it is a string, then if this string is a file, use the file as the motion target.

If it is the option weighted_series_sum, then run weighted_series_sum() and return the output path.

If it is the option mean_image, then compute the time-average of the 4D-PET image.

If it is a tuple, run a weighted sum on the PET series on a range of frames. The elements of the tuple are treated as times in seconds, counted from the time of the first frame, i.e. (0,300) would average all frames from the first to the frame 300 seconds later. If the two elements are the same, returns the one frame closest to the entered time.

Parameters:
  • motion_target_option (str | tuple | list) – Determines how the method behaves, according to the above description. Can be a file, a method (‘weighted_series_sum’ or ‘mean_image’), or a tuple range e.g. (0,600).

  • input_image_path (str) – Path to the PET image. This is intended to be supplied by the parent method employing this function. Default value None.

Returns:

out_image_file (str)

File to use as a target to compute

transformations on.

Raises:
  • ValueError – If motion_target_option is not a string, list, or tuple. If it is a string, but does not match one of the preset options or path to a file, the error will also be raised.

  • TypeError – If start and end time are incompatible with float type.