From 9ec11cc52325c579c42054ed21bb996869052ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <alan.munoz@ed.ac.uk> Date: Fri, 24 Feb 2023 17:37:17 +0000 Subject: [PATCH] feat(image): Add instatiate_image wrapper --- src/aliby/io/image.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/aliby/io/image.py b/src/aliby/io/image.py index cff89977..48ad0841 100644 --- a/src/aliby/io/image.py +++ b/src/aliby/io/image.py @@ -33,6 +33,22 @@ def get_examples_dir(): return files("aliby").parent.parent / "examples" / "tiler" +def instatiate_image(source: t.Union[str, int, t.Dict[str, str], PosixPath]): + """Wrapper to instatiate the appropiate image + + Parameters + ---------- + source : t.Union[str, int, t.Dict[str, str], PosixPath] + Image identifier + + Examples + -------- + FIXME: Add docs. + + """ + return dispatch_image(source)(source) + + def dispatch_image(source: t.Union[str, int, t.Dict[str, str], PosixPath]): """ Wrapper to pick the appropiate Image class depending on the source of data. @@ -235,7 +251,7 @@ class ImageDir(BaseLocalImage): super().__init__(path) self.image_id = str(self.path.stem) - self._meta = dir_to_meta(self.path, **kwargs) + self._meta = dir_to_meta(self.path) def get_data_lazy(self) -> da.Array: """Return 5D dask array. For lazy-loading local multidimensional tiff files""" -- GitLab