Saving an OMNI Image

omni.Image.save_metadata() can be used to save a new .omni metadata file. omni.Image.save_pixels() can be used to save the raw pixels file of an OMNI image. omni.Image.save_all() can be used to save the metadata and the raw pixels.

For example Lucid.CLIP.Threshold creates a new .omni metadata file for the raw pixels file created by CLIP:

import pathlib

import cliputil
import omni
from typing import Optional

def thres_image(
        image: omni.Image,
        min: Optional[float],
        max: Optional[float],
        result_omni_path: pathlib.Path,
        result_raw_path: pathlib.Path,
        temp_folder_path: pathlib.Path) -> omni.Image:
    """CLIP Threshold Segmentation"""

    input_float32_raw_path = cliputil.get_or_extract_raw_float32_pixels_file(image, temp_folder_path)


    result_segments = image.save_derived_segments(result_omni_path, result_raw_path)
    return result_segments

See Saving output in a task type for how to save an OMNI provided as an output parameter.

See also Import external data / Export Data.