pandora.state_machine ===================== .. py:module:: pandora.state_machine .. autoapi-nested-parse:: This module contains class associated to the pandora state machine Attributes ---------- .. autoapisummary:: pandora.state_machine.FLAG_GRAPHVIZ Classes ------- .. autoapisummary:: pandora.state_machine.PandoraMachine Module Contents --------------- .. py:data:: FLAG_GRAPHVIZ :value: True .. py:class:: PandoraMachine Bases: :py:obj:`transitions.extensions.GraphMachine` PandoraMachine class to create and use a state machine .. py:attribute:: _transitions_run .. py:attribute:: _transitions_check .. py:attribute:: img_left_pyramid :type: List[xarray.Dataset] :value: [None] .. py:attribute:: img_right_pyramid :type: List[xarray.Dataset] :value: [None] .. py:attribute:: left_img :type: xarray.Dataset :value: None .. py:attribute:: right_img :type: xarray.Dataset :value: None .. py:attribute:: disp_min :type: numpy.ndarray :value: None .. py:attribute:: disp_max :type: numpy.ndarray :value: None .. py:attribute:: right_disp_min :type: numpy.ndarray :value: None .. py:attribute:: right_disp_max :type: numpy.ndarray :value: None .. py:attribute:: dmin_user :type: numpy.ndarray :value: None .. py:attribute:: dmax_user :type: numpy.ndarray :value: None .. py:attribute:: dmin_user_right :type: numpy.ndarray :value: None .. py:attribute:: dmax_user_right :type: numpy.ndarray :value: None .. py:attribute:: scale_factor :type: int :value: None .. py:attribute:: num_scales :type: int :value: 1 .. py:attribute:: current_scale :type: int :value: None .. py:attribute:: left_cv :type: xarray.Dataset :value: None .. py:attribute:: right_cv :type: xarray.Dataset :value: None .. py:attribute:: left_disparity :type: xarray.Dataset :value: None .. py:attribute:: right_disparity :type: xarray.Dataset :value: None .. py:attribute:: step :type: int :value: 1 .. py:attribute:: pipeline_cfg :type: Dict .. py:attribute:: margins .. py:attribute:: right_disp_map :value: None .. py:attribute:: matching_cost_ :type: Union[pandora.matching_cost.AbstractMatchingCost, None] :value: None .. py:method:: matching_cost_prepare(cfg: Dict[str, dict], input_step: str) -> None Matching cost computation :param cfg: user configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: matching_cost_run(_: Dict[str, dict], __: str) -> None Matching cost computation :return: None .. py:method:: aggregation_run(cfg: Dict[str, dict], input_step: str) -> None Cost (support) aggregation :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: semantic_segmentation_run(cfg: Dict[str, dict], input_step: str) -> None Building semantic segmentation computation :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: optimization_run(cfg: Dict[str, dict], input_step: str) -> None Cost optimization :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: disparity_run(cfg: Dict[str, dict], input_step: str) -> None Disparity computation and validity mask :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: filter_run(cfg: Dict[str, dict], input_step: str) -> None Disparity filter :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: refinement_run(cfg: Dict[str, dict], input_step: str) -> None Subpixel disparity refinement :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: validation_run(cfg: Dict[str, dict], input_step: str) -> None Validation of disparity map :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: run_multiscale(cfg: Dict[str, dict], input_step: str) -> None Compute the disparity range for the next scale :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: cost_volume_confidence_run(cfg: Dict[str, dict], input_step: str) -> None Confidence prediction :param cfg: pipeline configuration :type cfg: dict :param input_step: step to trigger :type input_step: str :return: None .. py:method:: run_prepare(cfg: Dict[str, dict], left_img: xarray.Dataset, right_img: xarray.Dataset, scale_factor: Union[None, int] = None, num_scales: Union[None, int] = None) -> None Prepare the machine before running :param cfg: configuration :type cfg: dict :param left_img: left Dataset image containing : - im: 2D (row, col) or 3D (band_im, row, col) xarray.DataArray float32 - disparity (optional): 3D (disp, row, col) xarray.DataArray float32 - msk (optional): 2D (row, col) xarray.DataArray int16 - classif (optional): 3D (band_classif, row, col) xarray.DataArray int16 - segm (optional): 2D (row, col) xarray.DataArray int16 :type left_img: xarray.Dataset :param right_img: right Dataset image containing : - im: 2D (row, col) or 3D (band_im, row, col) xarray.DataArray float32 - disparity (optional): 3D (disp, row, col) xarray.DataArray float32 - msk (optional): 2D (row, col) xarray.DataArray int16 - classif (optional): 3D (band_classif, row, col) xarray.DataArray int16 - segm (optional): 2D (row, col) xarray.DataArray int16 :type right_img: xarray.Dataset :param scale_factor: scale factor for multiscale :type scale_factor: int or None :param num_scales: scales number for multiscale :type num_scales: int or None :return: None .. py:method:: run(input_step: str, cfg: Dict[str, dict]) -> None Run pandora step by triggering the corresponding machine transition :param input_step: step to trigger :type input_step: str :param cfg: pipeline configuration :type cfg: dict :return: None .. py:method:: run_exit() -> None Clear transitions and return to state begin :return: None .. py:method:: matching_cost_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the matching cost configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: disparity_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the disparity computation configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: filter_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the filter configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: refinement_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the refinement configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: aggregation_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the aggregation configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: semantic_segmentation_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the semantic_segmentation configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: optimization_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the optimization configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: validation_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the validation configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: multiscale_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the disparity computation configuration :param cfg: disparity computation configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: cost_volume_confidence_check_conf(cfg: Dict[str, dict], input_step: str) -> None Check the confidence configuration :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: None .. py:method:: check_conf(cfg: Dict[str, dict], img_left: xarray.Dataset, img_right: xarray.Dataset, right_left_img_check: bool = False) -> None Check configuration and transitions :param cfg: pipeline configuration :type cfg: dict :param img_left: image left with metadata :type img_left: xarray.Dataset :param img_right: image right with metadata :type img_right: xarray.Dataset :param right_left_img_check: if right image has been checked :type right_left_img_check: bool :return: None .. py:method:: remove_transitions(transition_list: List[Dict[str, str]]) -> None Delete all transitions defined in the input list :param transition_list: list of transitions :type transition_list: dict :return: None .. py:method:: is_not_last_scale(_: str, __: Dict[str, dict]) -> bool Check if the current scale is the last scale :param cfg: configuration :type cfg: dict :param input_step: current step :type input_step: string :return: boolean .. py:method:: check_band_pipeline(band_list: numpy.ndarray, step: str, band_used: Union[None, str, List[str], Dict]) -> None :staticmethod: Check coherence band parameter between pipeline step and image dataset :param band_list: band names of image :type band_list: numpy.ndarray with bands :param step: pipeline step :type step: str :param band_used: band names for pipeline step :type band_used: None, str, List[str] or Dict :return: None