From 241fdbda05d50fad12d7661c1fdf5d716d759dd8 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Thu, 7 Mar 2024 07:59:22 -0500 Subject: [PATCH] Add structure --- docs/source/how-to/register.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/source/how-to/register.md b/docs/source/how-to/register.md index f66e65110..62411c72f 100644 --- a/docs/source/how-to/register.md +++ b/docs/source/how-to/register.md @@ -78,24 +78,33 @@ Use the Python client, as in this example. from tiled.client import from_uri from tiled.structures.core import StructureFamily from tiled.structures.data_source import Asset, DataSource, Management +from tiled.structures.array import ArrayStructure, BuiltinDtype # You can pass the api_key in explicitly as shown here, but for security, it # is best to set the API key in the environment variable TILED_API_KEY, which # from_uri(...) will automatically detect and use. client = from_uri("http://localhost:8000", api_key="...") +structure = ArrayStructure( + dtype=BuiltinDtype.from_numpy_dtype(numpy.int32), + shape=(2, 512, 512), + chunks=((1, 1), (512,), (512,)), + dims=("time", "x", "y"), # optional +) + # POST /api/v1/register/{path} client.new( structure_family=StructureFamily.array, data_sources=[ DataSource( + management=Management.external, + mimetype="multipart/related;type=image/tiff", + structure_family=StructureFamily.array, + structure=structure, assets=[ Asset(data_uri="file:///...", num=1), - Asset(data_uri="file:///...", num=2) + Asset(data_uri="file:///...", num=2), ], - mimetype="multipart/related;type=image/tiff", - structure_family=StructureFamily.array, - management=Management.external, ), ], metadata={},