Skip to content

Commit

Permalink
Merge pull request #13 from haesleinhuepf/dev
Browse files Browse the repository at this point in the history
insight update: colors and < 100 pixels
  • Loading branch information
haesleinhuepf authored Jan 15, 2023
2 parents 7b2a827 + b2f613f commit be23b40
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 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.4.0",
version="0.5.0",
author="Robert Haase",
author_email="[email protected]",
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.4.0"
__version__ = "0.5.0"

import warnings
from ._static_view import jupyter_displayable_output, insight
Expand Down
6 changes: 3 additions & 3 deletions stackview/_image_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def _labels_lut():
lut = rs.rand(65537, 3)
lut[0, :] = 0
# these are the first four colours from matplotlib's default
lut[1] = [1.0, 0.4980392156862745, 0.054901960784313725]
lut[2] = [0.12156862745098039, 0.4666666666666667, 0.7058823529411765]
lut[1] = [0.12156862745098039, 0.4666666666666667, 0.7058823529411765]
lut[2] = [1.0, 0.4980392156862745, 0.054901960784313725]
lut[3] = [0.17254901960784313, 0.6274509803921569, 0.17254901960784313]
lut[4] = [0.8392156862745098, 0.15294117647058825, 0.1568627450980392]
return lut
return lut
16 changes: 6 additions & 10 deletions stackview/_static_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,12 @@ def _repr_html_(self):
from ._image_widget import _is_label_image
labels = _is_label_image(self)

# In case the image is 2D, 3D and larger than 100 pixels, turn on fancy view
if len(self.shape) in (2, 3) and size_in_pixels >= 100:
import matplotlib.pyplot as plt
_imshow(self,
labels=labels,
continue_drawing=True,
colorbar=not labels)
image = _png_to_html(_plt_to_png())
else:
return "<pre>numpy.ndarray(" + str(np.asarray(self)) + ", dtype=" + str(self.dtype) + ")</pre>"
import matplotlib.pyplot as plt
_imshow(self,
labels=labels,
continue_drawing=True,
colorbar=not labels)
image = _png_to_html(_plt_to_png())

if size_in_bytes > 1024:
size_in_bytes = size_in_bytes / 1024
Expand Down

0 comments on commit be23b40

Please sign in to comment.