Skip to content

Commit 5c8a8a3

Browse files
authored
Merge pull request #400 from Carifio24/cmap-colors-list
Make volume viewer colormap construction more flexible
2 parents b394db6 + 5d50aa2 commit 5c8a8a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

glue_vispy_viewers/volume/colors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ def get_mpl_cmap(cmap, stretch):
5757
if isinstance(cmap, ListedColormap):
5858
colors = cmap.colors
5959
n_colors = len(colors)
60-
ts = stretch([index / n_colors for index in range(len(colors))])
61-
colors = [color + [t] for t, color in zip(ts, colors)]
60+
ts = stretch([index / n_colors for index in range(n_colors)])
61+
colors = [[*color, t] for t, color in zip(ts, colors)]
6262
else:
6363
n_colors = 256
6464
ts = stretch([index / n_colors for index in range(n_colors)])
65-
colors = [cmap(t)[:3] + (t,) for t in ts]
65+
colors = [[*cmap(t)[:3], t] for t in ts]
6666

6767
stretch_glsl = glsl_for_stretch(stretch)
6868
template = create_cmap_template(n_colors, stretch_glsl)

0 commit comments

Comments
 (0)