From b7b8adc61225d86e8f0f28ea46f1fef0d4e67220 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Mon, 25 Nov 2024 10:02:55 -0800 Subject: [PATCH 1/3] init ImageArray with kwargs --- iohub/ngff/nodes.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/iohub/ngff/nodes.py b/iohub/ngff/nodes.py index 311d02e7..d07a5e3b 100644 --- a/iohub/ngff/nodes.py +++ b/iohub/ngff/nodes.py @@ -310,20 +310,24 @@ def close(self): class ImageArray(zarr.Array): """Container object for image stored as a zarr array (up to 5D)""" - def __init__(self, zarray: zarr.Array): - super().__init__( - store=zarray._store, - path=zarray._path, - read_only=zarray._read_only, - chunk_store=zarray._chunk_store, - synchronizer=zarray._synchronizer, - cache_metadata=zarray._cache_metadata, - cache_attrs=zarray._attrs.cache, - partial_decompress=zarray._partial_decompress, - write_empty_chunks=zarray._write_empty_chunks, - zarr_version=zarray._version, - meta_array=zarray._meta_array, - ) + def __init__(self, zarray: zarr.Array = None, **kwargs): + if zarray is not None: + kwargs.update( + { + "store": zarray._store, + "path": zarray._path, + "read_only": zarray._read_only, + "chunk_store": zarray._chunk_store, + "synchronizer": zarray._synchronizer, + "cache_metadata": zarray._cache_metadata, + "cache_attrs": zarray._attrs.cache, + "partial_decompress": zarray._partial_decompress, + "write_empty_chunks": zarray._write_empty_chunks, + "zarr_version": zarray._version, + "meta_array": zarray._meta_array, + } + ) + super().__init__(**kwargs) self._get_dims() def _get_dims(self): From 08775980ba19b6871dcfd030f9443ad66e8aedf9 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Wed, 27 Nov 2024 15:19:30 -0800 Subject: [PATCH 2/3] add documentation on ImageArray.__init__ --- iohub/ngff/nodes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iohub/ngff/nodes.py b/iohub/ngff/nodes.py index d07a5e3b..ff27887d 100644 --- a/iohub/ngff/nodes.py +++ b/iohub/ngff/nodes.py @@ -311,6 +311,9 @@ class ImageArray(zarr.Array): """Container object for image stored as a zarr array (up to 5D)""" def __init__(self, zarray: zarr.Array = None, **kwargs): + """Keyword arguments are passed to the zarr.Array constructor. + If a zarr.Array is provided, the constructor will use its attributes. + """ if zarray is not None: kwargs.update( { From 40ac524d1989faf9975226581fc48260d2e3eb43 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Wed, 27 Nov 2024 15:23:47 -0800 Subject: [PATCH 3/3] expand on documentation --- iohub/ngff/nodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iohub/ngff/nodes.py b/iohub/ngff/nodes.py index ff27887d..efdbd820 100644 --- a/iohub/ngff/nodes.py +++ b/iohub/ngff/nodes.py @@ -312,7 +312,8 @@ class ImageArray(zarr.Array): def __init__(self, zarray: zarr.Array = None, **kwargs): """Keyword arguments are passed to the zarr.Array constructor. - If a zarr.Array is provided, the constructor will use its attributes. + If a zarr.Array is provided, the constructor will use its attributes + to initialize the ImageArray. """ if zarray is not None: kwargs.update(