pandora2d.state_machine ======================= .. py:module:: pandora2d.state_machine .. autoapi-nested-parse:: This module contains class associated to the pandora state machine Classes ------- .. autoapisummary:: pandora2d.state_machine.Machine pandora2d.state_machine.MarginsProperties pandora2d.state_machine.BaseMachine pandora2d.state_machine.CheckMachine pandora2d.state_machine.Pandora2DMachine Module Contents --------------- .. py:class:: Machine(*args, **kwargs) Bases: :py:obj:`transitions.extensions.GraphMachine` A GraphMachine which defaults to graphviz engine. .. py:class:: MarginsProperties Bases: :py:obj:`TypedDict` Properties of Margins used in Margins transitions. .. py:attribute:: type :type: Literal['aggregate', 'maximum'] .. py:attribute:: margins :type: Annotated[list[int], ["left, "up", "right", "down"]] .. py:class:: BaseMachine Bases: :py:obj:`transitions.Machine`, :py:obj:`abc.ABC` Base model and state machine for pandora2d. .. py:attribute:: step :type: list | None :value: None .. py:attribute:: pipeline_cfg :type: dict .. py:attribute:: window_size :type: int | None :value: None .. py:attribute:: margins_img .. py:attribute:: margins_disp .. py:method:: check_conf(cfg) :abstractmethod: Check configuration and transitions :param cfg: pipeline configuration :return: .. py:method:: estimation_run(cfg, input_step) :abstractmethod: Estimation's computation step. :param cfg: configuration :param input_step: current step :return: None .. py:method:: matching_cost_run(cfg, input_step) :abstractmethod: Matching cost computation step. :param cfg: configuration :param input_step: current step :return: None .. py:method:: cost_volume_confidence_run(cfg, input_step) :abstractmethod: Cost volume confidence's computation. :param cfg: configuration :param input_step: current step :return: None .. py:method:: disparity_run(cfg, input_step) :abstractmethod: Disparity's computation. :param cfg: configuration :param input_step: current step :return: None .. py:method:: refinement_run(cfg, input_step) :abstractmethod: Refinement's configuration. :param cfg: configuration :param input_step: current step :return: None .. py:class:: CheckMachine Bases: :py:obj:`BaseMachine` State Machine that checks Pandora2d configuration. .. py:method:: check_conf(cfg: dict[str, dict]) -> None Check configuration and transitions :param cfg: pipeline configuration :return: .. py:method:: estimation_run(cfg: dict[str, dict], input_step: str) -> None Check the estimation computation configuration :param cfg: configuration :param input_step: current step :return: None .. py:method:: matching_cost_run(cfg: dict[str, dict], input_step: str) -> None Check the matching cost computation configuration :param cfg: configuration :param input_step: current step :return: None .. py:method:: cost_volume_confidence_run(cfg: dict[str, dict], input_step: str) -> None Check the cost volume confidence computation configuration :param cfg: configuration :param input_step: current step :return: None .. py:method:: disparity_run(cfg: dict[str, dict], input_step: str) -> None Check the disparity computation configuration :param cfg: configuration :param input_step: current step :return: None .. py:method:: refinement_run(cfg: dict[str, dict], input_step: str) -> None Check the refinement configuration :param cfg: configuration :param input_step: current step :return: None .. py:class:: Pandora2DMachine Bases: :py:obj:`BaseMachine` Pandora2DMachine class to create and use a state machine .. py:attribute:: left_img :type: xarray.Dataset | None :value: None .. py:attribute:: right_img :type: xarray.Dataset | None :value: None .. py:attribute:: completed_cfg :type: dict .. py:attribute:: cost_volumes :type: xarray.Dataset .. py:attribute:: dataset_disp_maps :type: xarray.Dataset .. py:attribute:: matching_cost_ :type: pandora2d.matching_cost.BaseMatchingCost | None :value: None .. py:method:: run_prepare(img_left: xarray.Dataset, img_right: xarray.Dataset, cfg: dict) -> None Prepare the machine before running :param img_left: left Dataset image containing : - im : 2D (row, col) xarray.DataArray - msk : 2D (row, col) xarray.DataArray :param img_right: right Dataset image containing : - im : 2D (row, col) xarray.DataArray - msk : 2D (row, col) xarray.DataArray :param cfg: configuration .. py:method:: run(input_step: str, cfg: dict[str, dict]) -> None Run pandora 2D step by triggering the corresponding machine transition :param input_step: step to trigger :param cfg: pipeline configuration :return: None .. py:method:: run_exit() -> None Clear transitions and return to state begin :return: None .. py:method:: check_conf(cfg: dict[str, dict]) -> None Check configuration and transitions :param cfg: pipeline configuration :return: .. py:method:: remove_transitions(transition_list: dict[str, dict]) -> None Delete all transitions defined in the input list :param transition_list: list of transitions :return: None .. py:method:: matching_cost_prepare(cfg: dict[str, dict], input_step: str) -> None Matching cost prepare :param cfg: pipeline configuration :param input_step: step to trigger :return: None .. py:method:: estimation_run(cfg: dict[str, dict], input_step: str) -> None Shift's estimation step :param cfg: pipeline configuration :param input_step: step to trigger :return: None .. py:method:: matching_cost_run(_, __) -> None Matching cost computation :return: None .. py:method:: cost_volume_confidence_run(cfg: dict[str, dict], input_step: str) -> None Cost volume confidence computation :return: None .. py:method:: disparity_run(cfg: dict[str, dict], input_step: str) -> None Disparity computation and validity mask :param cfg: pipeline configuration :param input_step: step to trigger :return: None .. py:method:: refinement_run(cfg: dict[str, dict], input_step: str) -> None Subpixel disparity refinement :param cfg: pipeline configuration :param input_step: step to trigger :return: None