openlifu.nav.photoscan

Functions

apply_exif_orientation_numpy(image, orientation)

Transforms an image array to undo or redo EXIF orientation.

convert_between_ras_and_lps(mesh)

Converts a mesh (polydata, unstructured grid or even just a point cloud) between the LPS (left-posterior-superior) coordinate system and RAS (right-anterior-superior) coordinate system.

convert_numpy_to_vtkimage(image_numpy)

Converts a numpy array with dimensions [HxWx3] representing an RGB image into vtkImageData

get_meshroom_config_info(pipeline_path)

Extract the node names and downscale factor used in the DepthMap_1 node from a Meshroom pipeline.

get_meshroom_pipeline_names()

Get a list of names of valid meshroom pipelines that can be used in run_reconstruction

load_data_from_filepaths(model_abspath, ...)

This function returns the data directly from the model and texture filepaths without requiring a photoscan object. param model_abspath: absolute filepath to model data texture abspath: absolute filepath to texture data Returns: Photoscan data as (model_vtkpolydata, texture_vtkimagedata).

load_data_from_photoscan(photoscan, parent_dir)

param parent_dir: parent directory containing model and texture data filepaths Returns: Photoscan data as (model_vtkpolydata, texture_vtkimagedata)

load_model(file_name)

This function assumes that the model is saved to file in LPS coordinates.

load_texture(file_name)

make_masks(image_paths, output_dir[, ...])

Runs MODNet on a list of image paths and saves the output masks.

merge_textures(input_obj_path, output_path)

Merge the UDIM textures output by meshroom into a single large texture

preprocess_image_modnet(image[, ref_size])

Preprocess an input image for MODNet inference.

preprocess_image_paths(paths[, sort_by, ...])

Sorts and sub-samples a list of image file paths.

read_as_vtkimagedata(file_name)

read_as_vtkpolydata(file_name)

run_reconstruction(images[, pipeline_name, ...])

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. :type pipeline_name: str :param input_resize_width: Width to which input images will be resized, in pixels. :type input_resize_width: int :param use_masks: Whether to include a background removal step to filter the dense reconstruction. :type use_masks: bool :param matching_mode: 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. :type matching_mode: str :param window_radius: Required for 'sequential' and 'sequential_loop' matching_mode. Number of images forward and backward in the sequence to try and match with. :type window_radius: int | None :param num_neighbors: Required for 'spatial' matching_mode. Number of nearest neighbors to match based on 3D distance in locations. :type num_neighbors: int | None :param locations: Required for 'spatial'. Must be the same length as images. Provides 3D coordinates for spatial matching. :type locations: List[Tuple[float, float, float]]] | None :param return_durations: If True, also return a dictionary mapping node names to durations in seconds. :type return_durations: bool :param 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. :param download_masking_model: Whether to auto-download the masking model weights if they are not present; only relevant if use_masks is enabled.

subprocess_stream_output(args, ...[, check, ...])

Run a subprocess and stream its stdout and stderr output to separate handlers/loggers.

udim_to_tile(udim_str)

Convert UDIM string to tile coordinates

write_pair_file(images, pairs, ...)

Convert image index-based pairs to Meshroom internal view ID pairs using the provided camera_init_file.

Classes

Photoscan([id, name, model_filename, ...])