Skip to content

Commit

Permalink
implement NGFF source validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Schorb committed Mar 5, 2024
1 parent 7613641 commit f1f2044
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mobie/validation/metadata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os

# from elf.io import open_file
Expand Down Expand Up @@ -63,6 +64,14 @@ def bdv_check():
path = os.path.join(dataset_folder, storage["relativePath"])
assert_true(os.path.exists(path), f"Could not find data for {name} at {path}")

attr_path =os.path.join(path, ".zattrs")
assert_true(os.path.exists(attr_path), f"Could not find metadata for {name} at {path}")

with open(attr_path) as f:
zattr = json.load(f)

validate_with_schema(zattr, "NGFF")

# we disable the name check for the time being since it seems to not be necessary,
# AND restricting the name in this fashion prevents embedding existing ome.zarr files in mobie projects
# with open_file(path, "r", ext=".zarr") as f:
Expand Down
1 change: 1 addition & 0 deletions mobie/validation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"source": "https://raw.githubusercontent.com/mobie/mobie.github.io/master/schema/source.schema.json",
"view": "https://raw.githubusercontent.com/mobie/mobie.github.io/master/schema/view.schema.json",
"views": "https://raw.githubusercontent.com/mobie/mobie.github.io/master/schema/views.schema.json",
"NGFF": "https://raw.githubusercontent.com/ome/ngff/main/0.4/schemas/image.schema"
}


Expand Down

0 comments on commit f1f2044

Please sign in to comment.