RTMFittingAnalysisStep ============================================================== .. py:class:: petpal.pipelines.kinetic_modeling_steps.RTMFittingAnalysisStep(ref_tac_path: str, roi_tacs_dir: str, output_directory: str, output_prefix: str, rtm_model: str, bounds=None, k2_prime=None, fit_threshold_in_mins: float = 30.0) Bases: :py:obj:`petpal.pipelines.steps_base.ObjectBasedStep`, :py:obj:`TACAnalysisStepMixin` A step for fitting reference tissue models (RTMs) to TAC data using :class:`MultiTACRTMAnalysis`. This class sets up RTM fitting, initializes required paths and parameters. :ivar ref_tac_path: Path to the reference TAC file. :vartype ref_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 rtm_model: Reference tissue model to be used for fitting. :vartype rtm_model: str :ivar bounds: Bounds for the fitting parameters. Defaults to None. :ivar k2_prime: K2' value for the fitting. Defaults to None. :ivar fit_threshold_in_mins: Threshold in minutes for fitting. Defaults to 30.0. :vartype fit_threshold_in_mins: float Initializes the RTMFittingAnalysisStep with specified parameters. :param ref_tac_path: Path to the reference TAC file. :type ref_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 rtm_model: Reference tissue model to be used for fitting. :type rtm_model: str :param bounds: Bounds for the fitting parameters. Defaults to None. :type bounds: optional :param k2_prime: :math:`k_{2}^\prime` value for the fitting. Defaults to None. :type k2_prime: optional :param fit_threshold_in_mins: Threshold in minutes for fitting. Defaults to 30.0. :type fit_threshold_in_mins: float, optional .. 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:: 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`