GraphicalAnalysisStep ============================================================= .. py:class:: petpal.pipelines.kinetic_modeling_steps.GraphicalAnalysisStep(input_tac_path: str, roi_tacs_dir: str, output_directory: str, output_prefix: str, method: str, fit_threshold_in_mins: float = 30.0, **run_kwargs) Bases: :py:obj:`petpal.pipelines.steps_base.ObjectBasedStep`, :py:obj:`TACAnalysisStepMixin` A step for performing graphical analysis on TACs using various methods. Uses :class:`MultiTACGraphicalAnalysis`. This class sets up graphical analysis, initializes required paths and parameters, and provides class methods for creating default steps with common graphical analysis methods like Patlak, Logan, and Alternative Logan. :ivar input_tac_path: Path to the input TAC file. :vartype input_tac_path: str :ivar roi_tacs_dir: Directory containing the ROI TAC files. :vartype roi_tacs_dir: str :ivar output_directory: Directory where output files will be saved. :vartype output_directory: str :ivar output_prefix: Prefix for the output files. :vartype output_prefix: str :ivar method: Graphical analysis method. :vartype method: str :ivar fit_threshold_in_mins: Threshold in minutes for fitting. Defaults to 30.0. :vartype fit_threshold_in_mins: float Initializes the GraphicalAnalysisStep with specified parameters. :param input_tac_path: Path to the input TAC file. :type input_tac_path: str :param roi_tacs_dir: Directory containing the ROI TAC files. :type roi_tacs_dir: str :param output_directory: Directory where output files will be saved. :type output_directory: str :param output_prefix: Prefix for the output files. :type output_prefix: str :param method: Graphical analysis method. :type method: str :param fit_threshold_in_mins: Threshold in minutes for fitting. Defaults to 30.0. :type fit_threshold_in_mins: float, optional :param run_kwargs: Additional keyword arguments passed on to GraphicalAnalysis.__call__(). .. py:method:: __repr__() Provides an unambiguous string representation of the ResampleBloodTACStep instance. :returns: *str* -- A string representation showing how the instance can be recreated. .. py:method:: default_patlak() :classmethod: Creates a default instance for Patlak graphical analysis of ROI TACs in a directory using :class:`MultiTACGraphicalAnalysis`. All paths are set to empty strings. :returns: *GraphicalAnalysisStep* -- A new instance for Patlak graphical analysis. .. py:method:: default_logan() :classmethod: Creates a default instance for Logan graphical analysis of ROI TACs in a directory using :class:`MultiTACGraphicalAnalysis`. All paths are set to empty strings. :returns: *GraphicalAnalysisStep* -- A new instance for Logan graphical analysis. .. py:method:: default_alt_logan() :classmethod: Creates a default instance for Alt-Logan (New Plot) graphical analysis of ROI TACs in a directory using :class:`MultiTACGraphicalAnalysis`. All paths are set to empty strings. :returns: *GraphicalAnalysisStep* -- A new instance for Alt-Logan (New Plot) graphical analysis. .. py:method:: default_logan_ref() :classmethod: Creates a default instance for Logan graphical analysis of ROI TACs with reference region input in a directory using :class:`MultiTACGraphicalAnalysis`. All paths are set to empty strings. :returns: *GraphicalAnalysisStep* -- A new instance for Logan graphical analysis with reference region. .. py:method:: validate_kwargs() Validates that all mandatory initialization and call arguments have been provided. :raises RuntimeError: If any mandatory arguments are missing. .. py:method:: get_args_not_set_in_kwargs(sig: inspect.Signature, kwargs: dict) -> dict :staticmethod: Retrieves arguments of the signature that are not set in the keyword arguments. :param sig: The signature of the function or method. :type sig: inspect.Signature :param kwargs: The keyword arguments provided. :type kwargs: dict :returns: *dict* -- A dictionary of arguments that are not set in the keyword arguments. .. py:method:: get_empty_default_kwargs(sig: inspect.Signature, set_kwargs: dict) -> list Identifies arguments that have not been provided and lack default values. :param sig: The signature of the function or method. :type sig: inspect.Signature :param set_kwargs: The keyword arguments provided. :type set_kwargs: dict :returns: *list* -- A list of argument names that have no default values and are not provided. .. py:method:: execute() -> None Instantiates the class and invokes it with the provided arguments. :raises The function may raise any exceptions that its implementation can throw.: .. py:method:: __str__() Returns a detailed string representation of the ObjectBasedStep instance. :returns: *str* -- A string describing the step, including its name, class, initialization, and call arguments. .. py:method:: all_init_kwargs_non_empty_strings() Checks if all initialization keyword arguments are non-empty strings. :returns: *bool* -- True if all initialization keyword arguments are non-empty strings, False otherwise. .. py:method:: all_call_kwargs_non_empty_strings() Checks if all call keyword arguments are non-empty strings. :returns: *bool* -- True if all call keyword arguments are non-empty strings, False otherwise. .. py:method:: can_potentially_run() Determines if the step can potentially be executed based on argument validation. Very simply checks if all __init__ and __call__ keyword arguments for the object are non-empty strings. :returns: *bool* -- True if the step can potentially run, False otherwise. .. py:method:: set_input_as_output_from(*sending_steps) :abstractmethod: Sets the input of the current step as the output from a list of steps. :param \*sending_steps: The previous steps from which the output will be used as input for the current step. :raises NotImplementedError: This method should be implemented by subclasses. .. rubric:: Notes For a concrete example, take a look at: :meth:`TACsFromSegmentationStep` .. important:: If a step takes multiple input steps. the implementation will have a defined order for steps. .. py:method:: infer_outputs_from_inputs(out_dir: str, der_type: str, suffix: str = None, ext: str = None, **extra_desc) :abstractmethod: Infers output files from input data based on the specified output directory, derivative type, optional suffix and extension, plus any extra descriptions. :param out_dir: The directory where the output files will be saved. :type out_dir: str :param der_type: The type of derivative being produced. :type der_type: str :param suffix: An optional suffix for the output files. :type suffix: str, optional :param ext: An optional extension for the output files. :type ext: str, optional :param \*\*extra_desc: Additional keyword arguments for extra descriptions to be included. :raises NotImplementedError: This method should be implemented by subclasses. .. rubric:: Notes For a concrete example, take a look at: :meth:`TACsFromSegmentationStep` .. py:method:: __call__(*args, **kwargs) .. py:property:: input_tac_path :type: str Gets the path to the input TAC file. :returns: *str* -- Path to the input TAC file. .. py:property:: reference_tac_path :type: str Gets the path to the reference TAC file. :returns: *str* -- Path to the reference TAC file. .. py:property:: tacs_dir :type: str Gets the directory containing the TAC files to be analyzed. :returns: *str* -- Directory containing the TAC files to be analyzed. .. py:property:: roi_tacs_dir :type: str Gets the directory containing the ROI TAC files to be analyzed. :returns: *str* -- Directory containing the ROI TAC files to be analyzed. .. py:property:: output_directory :type: str Gets the directory where output files will be saved. :returns: *str* -- Directory where output files will be saved. .. py:property:: output_prefix :type: str Gets the prefix for the output files. Usually something like ``sub-XXXX_ses-XX`` if BIDS compliant output. :returns: *str* -- Prefix for the output files. .. py:property:: out_path_and_prefix Gets the tuple of output directory and prefix. :returns: *tuple* -- A tuple containing output directory and prefix. .. py:method:: infer_prefix_from_input_tac_path() Infers the output prefix based on the input/reference TAC file path. Gets the subject and session from the path if possible. .. seealso:: :func:`parse_path_to_get_subject_and_session_id` .. py:method:: infer_output_directory_from_input_tac_path(out_dir: str, der_type: str = 'km') Infers the output directory based on the input/reference TAC file path. Gets the subject and session from the path is possible. :param out_dir: Root output directory. :type out_dir: str :param der_type: Type of derivatives. Defaults to 'km'. :type der_type: str .. seealso:: :func:`parse_path_to_get_subject_and_session_id` :func:`gen_bids_like_dir_path`