itasc.contact_analysis.pixel_size

Resolve a position’s physical pixel size (µm per pixel).

Backend-only (no Qt / napari) so the standalone wheel and headless batch runs can use it. The cell-shape build needs µm/px to turn pixel-unit regionprops measurements into physical µm / µm². Two sources are consulted, in order:

  1. The position’s itasc_config.jsonmetadata.pixel_size_um — the key the main pipeline widget already writes (main_widget.py).

  2. The segmented label TIFF’s resolution tags — ImageJ unit + resolution or the baseline XResolution / ResolutionUnit tags.

Returns None when neither yields a positive value; callers treat that as “pixel size unknown” (the cell-shape build is then blocked until one is set).

Functions

pixel_size_from_config(position_dir)

metadata.pixel_size_um from itasc_config.json in position_dir.

pixel_size_from_tiff(cell_labels_path)

µm/px from a TIFF's resolution tags (ImageJ unit, else ResolutionUnit).

resolve_pixel_size_um(position_dir, ...)

µm/px for a position, from its config first, then the label TIFF tags.

itasc.contact_analysis.pixel_size.resolve_pixel_size_um(position_dir, cell_labels_path)[source]

µm/px for a position, from its config first, then the label TIFF tags.

Returns None when no positive pixel size can be found.

Return type:

float | None

Parameters:
  • position_dir (Path | str | None)

  • cell_labels_path (Path | str | None)

itasc.contact_analysis.pixel_size.pixel_size_from_config(position_dir)[source]

metadata.pixel_size_um from itasc_config.json in position_dir.

Return type:

float | None

Parameters:

position_dir (Path | str | None)

itasc.contact_analysis.pixel_size.pixel_size_from_tiff(cell_labels_path)[source]

µm/px from a TIFF’s resolution tags (ImageJ unit, else ResolutionUnit).

Return type:

float | None

Parameters:

cell_labels_path (Path | str | None)