ResampleBloodTACStep#

class petpal.pipelines.preproc_steps.ResampleBloodTACStep(input_raw_blood_tac_path: str, input_image_path: str, out_tac_path: str, lin_fit_thresh_in_mins=30.0, rescale_constant: float = 37000.0)#

Bases: petpal.pipelines.steps_base.FunctionBasedStep

A step in a processing pipeline for resampling blood Time Activity Curves (TACs) based on PET image timings.

This class facilitates the resampling of blood TACs to match the scanner’s time frames, providing properties and methods for handling the input and output paths, as well as the resampling thresholds. This class uses resample_blood_data_on_scanner_times to perform the resampling.

Variables:
  • raw_blood_tac_path (str) – Path to the input raw blood TAC file.

  • input_image_path (str) – Path to the 4D-PET image file.

  • resampled_tac_path (str) – Path where the resampled TAC will be saved.

  • lin_fit_thresh_in_mins (float) – Threshold in minutes for linear fitting.

Initializes a ResampleBloodTACStep with specified parameters.

Parameters:
  • input_raw_blood_tac_path (str) – Path to the input raw blood TAC file.

  • input_image_path (str) – Path to the PET image file.

  • out_tac_path (str) – Path where the resampled TAC will be saved.

  • lin_fit_thresh_in_mins (float) – Threshold in minutes for linear fitting.

__repr__()#

Provides an unambiguous string representation of the ResampleBloodTACStep instance.

Returns:

str – A string representation showing how the instance can be recreated.

property raw_blood_tac_path#

Gets the path to the input raw blood TAC file.

Returns:

str – The path to the input raw blood TAC file.

property input_image_path#

Gets the path to the PET image file.

Returns:

str – The path to the PET image file.

property resampled_tac_path#

Gets the path where the resampled TAC will be saved.

Returns:

str – The path where the resampled TAC will be saved.

set_input_as_output_from(*sending_steps)#

Sets the input image path based on the output from a specified sending step.

Parameters:

sending_step – The step from which to derive the input image path.

infer_outputs_from_inputs(out_dir: str, der_type, suffix='blood', ext='.tsv', **extra_desc)#

Infers the output file path for resampled TAC based on the input raw blood TAC path.

Parameters:
  • out_dir (str) – Directory where the outputs will be saved.

  • der_type – Type of derivatives.

  • suffix (str, optional) – Suffix for the output files. Defaults to ‘blood’.

  • ext (str, optional) – Extension for the output files. Defaults to ‘.tsv’.

  • **extra_desc – Additional descriptive parameters.

classmethod default_resample_blood_tac_on_scanner_times()#

Provides a class method to create an instance with default parameters. All paths are set to empty-strings and the fitting threshold is set to 30 minutes.

Returns:

ResampleBloodTACStep – A new instance with default parameters.

get_function_args_not_set_in_kwargs() ArgsDict#

Retrieves arguments of the function that are not set in the keyword arguments.

Returns:

ArgsDict – A dictionary of function arguments that have not been set in the keyword arguments.

get_empty_default_kwargs() list#

Identifies arguments that have not been provided and lack default values.

Returns:

list – A list of argument names that have no default values and are not provided.

validate_kwargs_for_non_default_have_been_set() None#

Validates that all mandatory arguments have been provided.

Raises:

RuntimeError – If any mandatory arguments are missing.

execute()#

Executes the function with the provided arguments and keyword arguments.

Raises:

The function may raise any exceptions that its implementation can throw.

generate_kwargs_from_args() ArgsDict#

Converts positional arguments into keyword arguments.

Returns:

ArgsDict – A dictionary where positional arguments are mapped to their corresponding parameter names.

__str__()#

Returns a detailed string representation of the FunctionBasedStep instance.

Returns:

str – A string describing the step, including its name, function, arguments, and keyword arguments.

all_args_non_empty_strings()#

Checks if all positional arguments are non-empty strings.

Returns:

bool – True if all positional arguments are non-empty strings, False otherwise.

all_kwargs_non_empty_strings()#

Checks if all keyword arguments are non-empty strings.

Returns:

bool – True if all keyword arguments are non-empty strings, False otherwise.

can_potentially_run()#

Determines if the step can potentially be executed based on argument validation. Very simply checks if all arguments and keyword arguments are non-empty strings.

Returns:

bool – True if the step can potentially run, False otherwise.

__call__(*args, **kwargs)#