Skip to content

Commit

Permalink
Add tutorial layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Nov 21, 2024
1 parent 4068171 commit c9ef4df
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
55 changes: 52 additions & 3 deletions docs/tutorial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,55 @@
# # Tutorial

from ome_zarr_models.v04 import Image as OMEZarrImage
# from ome_zarr_models.v04 import Image as OMEZarrImage

my_image = OMEZarrImage(path="path/to/ome/zarr/directory.ome.zarr")
print(my_image.multiscales)
# my_image = OMEZarrImage(path="path/to/ome/zarr/directory.ome.zarr")
# print(my_image.multiscales)

# ## Creating
#
# TODO: exmaple of creating a model from a remote store
# TODO: example of

import gcsfs
import zarr.storage
import zarr

bucket = "ucl-hip-ct-35a68e99feaae8932b1d44da0358940b"
fs = gcsfs.GCSFileSystem(project=bucket, token="anon", access="read_only")
store = zarr.storage.FSStore(url=bucket, fs=fs)
group = zarr.open_group(
store=store, path="S-20-28/heart/25.27um_complete-organ_bm05.ome.zarr"
)
print(group)
exit()

# ## Updating models
#
# All the fields in the models can be updated in place.
# When you do this, any validation on the individual field
# you are updating will take place.
#
# For example, we can [do something valid]:


# but if you try and [do something invalid] it raises an error:

# This means validation happens early, allowing you to catch errors
# before getting too far.

# ## Writing metadata
#
# TODO: example of writing out the metadata again

# ## Accessing data
#
# Although these models do not handle reading or writing data,
# they do expose the zarr arrays.

# ## Not using validation
#
# If you *really* want to create models that are not validated against
# the OME-zarr specifciation, you can use the ``model_construct`` method.
# For example:

# Put some bad code here
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ docs = [
"mkdocstrings-python>=1.12.2",
"mkdocs-material",
"mkdocs-jupyter",
"gcsfs",
"zarr<3",
]
dev = [
"jupyter[notebook]>=1.1.1",
Expand Down

0 comments on commit c9ef4df

Please sign in to comment.