From b7b8adc61225d86e8f0f28ea46f1fef0d4e67220 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Mon, 25 Nov 2024 10:02:55 -0800 Subject: [PATCH] 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):