From 76c1e87a1d2b207fe02173deee29823c153caee5 Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Sun, 18 Aug 2024 10:46:29 +0200 Subject: [PATCH 1/3] bugfix: animations of RGBA data didn't work --- stackview/_animate.py | 3 +++ stackview/_image_widget.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/stackview/_animate.py b/stackview/_animate.py index 538bdfd..fcfbc46 100644 --- a/stackview/_animate.py +++ b/stackview/_animate.py @@ -35,6 +35,9 @@ def animate(timelapse, filename:str=None, overwrite_file:bool=True, frame_delay_ from stackview._image_widget import _img_to_rgb from ._utilities import numpy_to_gif_bytestream, _gif_to_html + if isinstance(timelapse, list): + timelapse = np.asarray(timelapse) + if 0 <= timelapse.min() <= 1 and 0 <= timelapse.max() <= 1: warnings.warn("The timelapse has a small intensity range between 0 and 1. Consider normalizing it to the range between 0 and 255.") if timelapse.min() < 0 or timelapse.max() > 255: diff --git a/stackview/_image_widget.py b/stackview/_image_widget.py index a65f05c..5d911fd 100644 --- a/stackview/_image_widget.py +++ b/stackview/_image_widget.py @@ -72,7 +72,7 @@ def _img_to_rgb(image, display_max=None): from ._colormaps import _labels_lut, create_colormap - if len(image.shape) > 2 and image.shape[-1] == 3: + if len(image.shape) > 2 and (image.shape[-1] == 3 or image.shape[-1] == 4): return image if image.dtype == bool: From cfbd9f62f6acdb7e43b0347c19d967ccab17fd4e Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Sun, 18 Aug 2024 10:47:17 +0200 Subject: [PATCH 2/3] fix lists passed to animate_curtain --- stackview/_animate.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stackview/_animate.py b/stackview/_animate.py index fcfbc46..9dddb1a 100644 --- a/stackview/_animate.py +++ b/stackview/_animate.py @@ -118,6 +118,13 @@ def animate_curtain(timelapse, timelapse_curtain, import numpy as np from ._image_widget import _img_to_rgb + + if isinstance(timelapse, list): + timelapse = np.asarray(timelapse) + + if isinstance(timelapse_curtain, list): + timelapse_curtain = np.asarray(timelapse_curtain) + max_size = timelapse.shape[1] images = [] From 627504bec45b2eca635def67dcd460ac348efd1b Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Sun, 18 Aug 2024 10:47:40 +0200 Subject: [PATCH 3/3] bump version --- setup.py | 2 +- stackview/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f7ac314..d18135e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="stackview", - version="0.8.0", + version="0.8.1", author="Robert Haase", author_email="robert.haase@uni-leipzig.de", description="Interactive image stack viewing in jupyter notebooks", diff --git a/stackview/__init__.py b/stackview/__init__.py index 2228465..8bed0a0 100644 --- a/stackview/__init__.py +++ b/stackview/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.8.0" +__version__ = "0.8.1" from ._static_view import jupyter_displayable_output, insight from ._utilities import merge_rgb