Skip to content

Commit

Permalink
load_zarr_stats.py handles bf2raw series. Add local flamingo.csv with…
Browse files Browse the repository at this point in the history
… extra cols
  • Loading branch information
will-moore committed Oct 15, 2024
1 parent 4e99b70 commit 57a4a6c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions samples/flamingo.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url,written,written_human_readable
https://radosgw.public.os.wwu.de/n4bi-goe/Platynereis-H2B-TL.ome.zarr,2352780058,2.35 GB
https://radosgw.public.os.wwu.de/n4bi-goe/Zebrafish-H2B-short-timelapse.ome.zarr,10417827625,10.42 GB
https://radosgw.public.os.wwu.de/n4bi-goe/Zebrafish-XSPIM-multiview.ome.zarr,7168396046,7.17 GB
22 changes: 20 additions & 2 deletions samples/load_zarr_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import argparse
import csv
import json

# import xml.etree.ElementTree as ET
from pathlib import Path

import requests
Expand Down Expand Up @@ -119,6 +121,21 @@ def load_rocrate(zarr_url):
}


def load_series(zarr_url):
# Load series from METADATA.ome.xml if available or /OME/zarr.json
series_url = zarr_url + "/OME/METADATA.ome.xml"
rsp = requests.get(series_url)
if (rsp.status_code // 100) != 2:
# load series from /OME/zarr.json
series_json = load_json(zarr_url + "/OME/zarr.json")
return series_json.get("attributes", {}).get("ome", {}).get("series", [])

# FIXME: not implemented yet!
# xml_string = rsp.text
# root = ET.fromstring(xml_string)
return ["0"]


# ...so we resort to using plain requests for now...
# load zarr.json for each row...
def load_zarr(zarr_url, average_count=5):
Expand Down Expand Up @@ -150,9 +167,10 @@ def load_zarr(zarr_url, average_count=5):
stats["written"] = avg_written * image_count
elif bf2raw:
# let's just get the first image...
bf_img_json = load_json(zarr_url + "/0/zarr.json")
series = load_series(zarr_url)
bf_img_json = load_json(zarr_url + f"/{series[0]}/zarr.json")
bf_img_ms = bf_img_json.get("attributes", {}).get("ome", {}).get("multiscales")
stats = get_array_values(zarr_url + "/0", bf_img_ms)
stats = get_array_values(zarr_url + f"/{series[0]}", bf_img_ms)
# combine the stats with the rocrate data...
stats.update(rocrate_data)
return stats
Expand Down
2 changes: 1 addition & 1 deletion samples/n4bi.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ source,url

Jülich,https://raw.githubusercontent.com/will-moore/ome2024-ngff-challenge/hierarchy_browser/samples/fzj.csv

Göttingen, https://radosgw.public.os.wwu.de/n4bi-wp1/challenge/flamingo.csv
Göttingen, https://raw.githubusercontent.com/will-moore/ome2024-ngff-challenge/hierarchy_browser/samples/flamingo.csv

University of Muenster, https://raw.githubusercontent.com/will-moore/ome2024-ngff-challenge/hierarchy_browser/samples/uni_muenster_samples.csv

0 comments on commit 57a4a6c

Please sign in to comment.