Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix RGBA animations didn't work #66

Merged
merged 3 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading