scallops.io.get_image_spacing

scallops.io.get_image_spacing(attrs)

Get the physical spacing (resolution) of an image.

This function retrieves the physical spacing (resolution) of an image from its attributes. The spacing is typically defined in micrometers per pixel (µm/pixel) along the y and x dimensions.

Parameters:

attrs (dict) – Dictionary containing image attributes.

Returns:

A tuple containing the spacing along the y and x dimensions in micrometers (µm). Returns None if the spacing cannot be determined.

Return type:

tuple[float, float] | None

Example:

import scallops.io

# Define image attributes
attrs = {
    "processed": OME,
    "src_metadata": [
        {"attrs": {"processed": OME}},
        {"attrs": {"processed": OME}},
        {"attrs": {"processed": OME}},
    ],
}

# Get the image spacing
spacing = scallops.io.get_image_spacing(attrs)
print(spacing)  # Output: (0.25, 0.25)