CSV (ome_zarr.csv)

ome_zarr.csv.csv_to_zarr(csv_path: str, csv_id: str, csv_keys: str, zarr_path: str, zarr_id: str) None

Add keys:values from a CSV file to the label properties of a Plate or Image

For each labels properties dict in the Plate or Image at zarr_path, we pick the value of the property named zarr_id. This value should match a value from a row of the CSV table, with the column name given by csv_id. The row values under columns given by csv_keys (e.g. “col1,col2,col5”) will be added to the label properties. Column types can be specified with #d (float), #l (int) or #b (boolean) e.g. “col1#d,col2#l,col5”

Parameters:
  • csv_path – Path to the CSV file

  • csv_id – Name of the CSV column to use as a row ID

  • csv_keys – Names of the columns to add to properties.

  • zarr_path – Path to the ome-zarr Plate that has labels with properties

  • zarr_id – Key of the label property to use for picking csv row

ome_zarr.csv.dict_to_zarr(props_to_add: Dict[str | int, Dict], zarr_path: str, zarr_id: str) None

Add keys:values to the label properties of a ome-zarr Plate or Image.

For each labels properties dict in the Plate or Image at zarr_path, we pick the value of the property named zarr_id. This value should match a key of the props_to_add Dict to find a Dict who’s keys and values are added to the label properties.

Parameters:
  • props_to_add – Dict of id: {key:value}. id matches values of zarr_id prop

  • zarr_path – Path to the ome-zarr that has labels with properties

  • zarr_id – Key of label property, where value is key of props_to_add

ome_zarr.csv.parse_csv_value(value: str, col_type: str) str | float | int | bool

Parse string value from csv, according to COLUMN_TYPES