lupoutil

Lucid LUPO.

This module implements utilities for running the LUPO image processing tool.

lupoutil.convert_or_move_raw_float32_pixels_file_to(source_float32_raw_path: Path, target_raw_path: Path, target_pixel_type: str, pixel_count: int)

Convert (or move if no conversion is required) a raw float32 file to some other pixel type.

lupoutil.detect_lupo_version() Tuple[int, int, int, int] | None

Detect the version of the installed LUPO.

lupoutil.extract_raw_pixels_file(image: Image, output_path: Path)

Copy the OMNI image pixels to a raw file without offset / trailing data.

lupoutil.extract_raw_uint8_pixels_file(image: Image, output_path: Path)

Copy and convert the OMNI image pixels to a raw uint8 (or int8) file without offset / trailing data.

lupoutil.get_exe_path(exe_filename: str = 'LUPO.exe') Path

Get path of LUPO executable using environment variable LUCID_LUPO.

lupoutil.get_or_extract_raw_float32_pixels_file(image: Image, temp_folder_path: Path) Path

Copy and convert the OMNI image pixels to a raw float32 file without offset / trailing data, or just get the existing pixels file if not needed.

lupoutil.get_or_extract_raw_pixels_file(image: Image, output_path: Path) Path

Copy the OMNI image pixels to a raw file without offset / trailing data, or just get the existing pixels file if not needed.

lupoutil.get_or_extract_raw_uint8_pixels_file(image: Image, temp_folder_path: Path) Path

Copy and convert the OMNI image pixels to a raw uint8 (or int8) file without offset / trailing data, or just get the existing pixels file if not needed.

lupoutil.is_lupo_version_compatible(version: Tuple[int, int, int, int] | None) bool

Check if the version is compatible.

lupoutil.lupo_version_not_expected_message(version: Tuple[int, int, int, int] | None) str

Format a message about an unexpected LUPO version

lupoutil.run_crop_pad_target_voi(image: Image, result_omni_path: Path, result_raw_path: Path, temp_unpadded_raw_path: Path, voi_pos_3d: List[int], voi_size_3d: List[int]) Image

Use LUPO crop and / or pad to adjust the image size to the target VOI. (Or return original image if no cropping or padding is needed.)

lupoutil.run_label_components(input_path: Path, output_path: Path, output_metadata_path: Path, sizex: int, sizey: int, sizez: int, *, by_slice: bool = False, input_pixeldata_offset: int = None, topology: int = None, min_size: int = None, max_size: int = None, min_rank: int = None, max_rank: int = None, label_type: int = None, output_segmented: bool = False, background: bool = False, ntasks: int = None)

Use LUPO for component labeling.

lupoutil.run_label_components_intersected_by_seed(input_segments_raw_path, seed_segments_raw_path, result_segments_raw_path, temp_labels_raw_path, temp_labels_metadata_path, sizex: int, sizey: int, sizez: int, *, topology: int = None)

Use LUPO for component labeling and select components that intersect with seed segments.

lupoutil.run_lupo(subcommand_and_arguments: List[str], **kwargs) None

Execute LUPO subcommand

lupoutil.run_lupo_mpi(subcommand_and_arguments: List[str], **kwargs) None

Execute LUPO subcommand via MPI

lupoutil.run_lupom(subcommand_and_arguments: List[str], **kwargs) None

Execute LUPOM subcommand

lupoutil.run_morph_dilate_erode(inout_int8_raw_path: Path, tmp_raw_path: Path, xsize: int, ysize: int, zsize: int, margin: float, *, scalex: float = 1, scaley: float = 1, scalez: float = 1, by_slice: bool = False)

Use LUPO for morphological operations: * dilate: with margin > 0 * erode: with margin < 0

lupoutil.run_morph_open_close(inout_int8_raw_path: Path, tmp_raw_path: Path, xsize: int, ysize: int, zsize: int, margin: float, *, scalex: float = 1, scaley: float = 1, scalez: float = 1, by_slice: bool = False)

Use LUPO for morphological operations: * open: with margin > 0 * close: with margin < 0

lupoutil.run_pad_only_target_voi(image: Image, result_omni_path: Path, result_raw_path: Path, voi_pos_3d: List[int], voi_size_3d: List[int]) Image

Use LUPO pad to adjust the image size to the target VOI. (Or return original image if no padding is needed.) But don’t crop, so the result image might be larger than the target.

lupoutil.version_to_string(version: Tuple[int, int, int, int]) str

Convert a version tuple to a string.