Skip to content

Commit

Permalink
Merge pull request #66 from haesleinhuepf/bugfix_rgba_animations
Browse files Browse the repository at this point in the history
Bugfix RGBA animations didn't work
  • Loading branch information
haesleinhuepf authored Aug 18, 2024
2 parents c92c1c5 + 627504b commit 3b7aa31
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion stackview/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions stackview/_animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -115,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 = []
Expand Down
2 changes: 1 addition & 1 deletion stackview/_image_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3b7aa31

Please sign in to comment.