Skip to content

Commit

Permalink
Add vispy to requirements, add colormaps and blending to channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Draga Doncila Pop committed Nov 8, 2020
1 parent 63054c5 commit 9196872
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
21 changes: 20 additions & 1 deletion nd2_dask/nd2_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@
import toolz as tz
from napari_plugin_engine import napari_hook_implementation
import dask
from vispy.color import Colormap

CHANNEL_COLORS = {
"Alxa 647": (1.0, 0.5019607843137255, 1.0),
"GaAsP Alexa 568": (1.0, 0.0, 0.0),
"GaAsP Alexa 488": (0.0, 1.0, 0.0),
"TD": (1, 1, 1)
}
VISIBLE = [
"Alxa 647",
"GaAsP Alexa 568",
"GaAsP Alexa 488"
]


def get_pims_nd2_vol(nd2_data, c, frame):
Expand Down Expand Up @@ -176,10 +189,16 @@ def get_layer_list(channels, nd2_func, nd2_data, frame_shape, frame_dtype, n_tim

layer_list = []
for channel_name, channel in channel_dict.items():
visible = channel_name in VISIBLE
blending = 'additive' if visible else 'translucent'
channel_color = list(CHANNEL_COLORS[channel_name])
color = Colormap([[0, 0, 0],channel_color])
add_kwargs = {
"scale": [1, 1, 1, 1],
"name": channel_name,
"visible": channel_name == "Alxa 647"
"visible": visible,
"colormap": color,
"blending": blending
}
layer_type = "image"
layer_list.append(
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ numpy
nd2reader
pims-nd2
dask
toolz
toolz
vispy

0 comments on commit 9196872

Please sign in to comment.