StepsContainer ================================================ .. py:class:: petpal.pipelines.steps_containers.StepsContainer(name: str, *steps: StepType) A container for managing and executing a sequence of steps in a pipeline. This class allows for the addition, removal, and execution of steps, as well as printing their details and combining multiple step containers. :ivar name: Name of the steps container. :vartype name: str :ivar step_objs: List of step objects in the container. :vartype step_objs: list[StepType] :ivar step_names: List of step names in the container. :vartype step_names: list[str] Initializes the StepsContainer with a name and an optional sequence of steps. :param name: Name of the steps container. :type name: str :param \*steps: Optional sequence of steps to add to the container. :type \*steps: StepType .. py:method:: __repr__() Provides an unambiguous string representation of the TACsFromSegmentationStep instance. :returns: *str* -- A string representation showing how the instance can be recreated. .. py:method:: add_step(step: StepType) Adds a step to the container if it is not already present. :param step: The step to add. :type step: StepType :raises TypeError: If the step is not of the correct type. :raises KeyError: If a step with the same name already exists. .. py:method:: remove_step(step: Union[int, str]) Removes a step from the container by index or name. :param step: The index or name of the step to remove. :type step: Union[int, str] :raises IndexError: If the step index does not exist. :raises KeyError: If the step name does not exist. .. py:method:: print_step_details() Prints the details of all steps in the container. .. py:method:: __str__() -> str Returns a detailed string representation of the StepsContainer instance. :returns: *str* -- A string describing the steps-container, including its name, and the names of the sequence of steps. .. py:method:: __call__() Executes all steps in the container in sequence. .. py:method:: __getitem__(step: Union[int, str]) Gets a step from the container by index or name. :param step: The index or name of the step to get. :type step: Union[int, str] :returns: *StepType* -- The requested step. :raises IndexError: If the step index does not exist. :raises KeyError: If the step name does not exist. :raises TypeError: If the key is not an integer or string. .. py:method:: __add__(other: StepsContainer) -> StepsContainer Combines this StepsContainer with another one. The other container cannot have steps with the same name. :param other: The other steps container to combine with. :type other: StepsContainer :returns: *StepsContainer* -- A new StepsContainer containing steps from both containers. :raises TypeError: If the other object is not a StepsContainer. :raises KeyError: If a step with the same name already exists. .. py:method:: default_preprocess_steps(name: str = 'preproc') :classmethod: Creates a default StepsContainer with common preprocessing steps. We have the following steps in sequence: - :meth:`Threshold Based Cropping`. - :meth:`Motion correct frames brighter than mean-image`. - :meth:`Register PET to Anatomical`. - :meth:`Write ROI TACs from segmentation`. - :meth:`Resample blood on scanner frame times`. :param name: Name of the steps container. Defaults to 'preproc'. :type name: str, optional :returns: *StepsContainer* -- A new StepsContainer with default preprocessing steps. .. py:method:: default_graphical_analysis_steps(name: str = 'km_graphical_analysis') :classmethod: Creates a default StepsContainer with common graphical analysis steps. We have the following steps in sequence: - :meth:`Patlak`. - :meth:`Logan`. - :meth:`Alt-Logan`. :param name: Name of the steps container. Defaults to 'km_graphical_analysis'. :type name: str, optional :returns: *StepsContainer* -- A new StepsContainer with default graphical analysis steps. .. rubric:: Notes The steps do not technically depend on each other and can be run out of sequence. .. py:method:: default_parametric_graphical_analysis_steps(name: str = 'km_parametric_graphical_analysis') :classmethod: Creates a default StepsContainer with common parametric graphical analysis steps. We have the following steps in sequence: - :meth:`Patlak`. - :meth:`Logan`. - :meth:`Alt-Logan`. :param name: Name of the steps container. Defaults to 'km_parametric_graphical_analysis'. :type name: str, optional :returns: *StepsContainer* -- A new StepsContainer with default parametric graphical analysis steps. .. rubric:: Notes The steps do not technically depend on each other and can be run out of sequence. .. py:method:: default_tcm_analysis_steps(name: str = 'km_tcm_analysis') :classmethod: Creates a default StepsContainer with common TCM analysis steps. We have the following steps in sequence: - :meth:`1TCM`. - :meth:`Serial 2TCM`. - :meth:`Irreversible 2TCM`. :param name: Name of the steps container. Defaults to 'km_tcm_analysis'. :type name: str, optional :returns: *StepsContainer* -- A new StepsContainer with default TCM analysis steps. .. py:method:: default_kinetic_analysis_steps(name: str = 'km') :classmethod: Creates a default StepsContainer with common kinetic analysis steps. We have the following steps in sequence: - :meth:`ROI TACs: Patlak`. - :meth:`ROI TACs: Logan`. - :meth:`ROI TACs: Alt-Logan`. - :meth:`Parametric: Patlak`. - :meth:`Parametric: Logan`. - :meth:`Parametric: Alt-Logan`. - :meth:`ROI TACs: 1TCM`. - :meth:`ROI TACs: Serial 2TCM`. - :meth:`ROI TACs: Irreversible 2TCM`. :param name: Name of the steps container. Defaults to 'km'. :type name: str, optional :returns: *StepsContainer* -- A new StepsContainer with default kinetic analysis steps. .. rubric:: Notes The steps do not technically depend on each other and can be run out of sequence.