openlifu.nav.photoscan.run_reconstruction

openlifu.nav.photoscan.run_reconstruction(images: list[Path], pipeline_name: str = 'default_pipeline', input_resize_width: int = 3024, use_masks: bool = True, matching_mode: str = 'exhaustive', window_radius: int | None = None, num_neighbors: int | None = None, locations: List[Tuple[float, float, float]] | None = None, return_durations: bool = False, progress_callback: Callable[[int, str], None] | None = None, download_masking_model: bool = True) Tuple[Photoscan, Path] | Tuple[Photoscan, Path, Dict[str, float]][source]

Run Meshroom with the given images and pipeline. :param images: List of image file paths. :type images: list[Path] :param pipeline_name: Name of the Meshroom pipeline in meshroom_pipelines folder.

See also get_meshroom_pipeline_names.

Parameters:
  • input_resize_width (int) – Width to which input images will be resized, in pixels.

  • use_masks (bool) – Whether to include a background removal step to filter the dense reconstruction.

  • matching_mode (str) – Strategy for generating image pairs. One of: - ‘exhaustive’: Match every image with every other image. - ‘sequential’: Match each image with the previous and next window_radius images (no wrap-around). - ‘sequential_loop’: Like ‘sequential’ but wraps around at the end of the sequence. - ‘spatial’: Match each image with its num_neighbors nearest neighbors based on 3D location.

  • window_radius (int | None) – Required for ‘sequential’ and ‘sequential_loop’ matching_mode. Number of images forward and backward in the sequence to try and match with.

  • num_neighbors (int | None) – Required for ‘spatial’ matching_mode. Number of nearest neighbors to match based on 3D distance in locations.

  • locations (List[Tuple[float, float, float]]] | None) – Required for ‘spatial’. Must be the same length as images. Provides 3D coordinates for spatial matching.

  • return_durations (bool) – If True, also return a dictionary mapping node names to durations in seconds.

  • progress_callback – An optional function that will be called to report progress. The function should accept two arguments: an integer progress value from 0 to 100 followed by a string message describing the step currently being worked on.

  • download_masking_model – Whether to auto-download the masking model weights if they are not present; only relevant if use_masks is enabled.

Returns:

  • If return_durations is False: returns the Photoscan and the data directory path.

  • If return_durations is True: also returns a dictionary of node execution times.

Return type:

Union[Tuple[Photoscan, Path], Tuple[Photoscan, Path, Dict[str, float]]]