{"action":"created","issue":{"url":"https://api.github.com/repos/Napari/napari-gui/issues/79","repository_url":"https://api.github.com/repos/Napari/napari-gui","labels_url":"https://api.github.com/repos/Napari/napari-gui/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/Napari/napari-gui/issues/79/comments","events_url":"https://api.github.com/repos/Napari/napari-gui/issues/79/events","html_url":"https://github.com/Napari/napari-gui/issues/79","id":386323726,"node_id":"MDU6SXNzdWUzODYzMjM3MjY=","number":79,"title":"Color blending across layers","user":{"login":"sofroniewn","id":6531703,"node_id":"MDQ6VXNlcjY1MzE3MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6531703?v=4","gravatar_id":"","url":"https://api.github.com/users/sofroniewn","html_url":"https://github.com/sofroniewn","followers_url":"https://api.github.com/users/sofroniewn/followers","following_url":"https://api.github.com/users/sofroniewn/following{/other_user}","gists_url":"https://api.github.com/users/sofroniewn/gists{/gist_id}","starred_url":"https://api.github.com/users/sofroniewn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofroniewn/subscriptions","organizations_url":"https://api.github.com/users/sofroniewn/orgs","repos_url":"https://api.github.com/users/sofroniewn/repos","events_url":"https://api.github.com/users/sofroniewn/events{/privacy}","received_events_url":"https://api.github.com/users/sofroniewn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-11-30T19:41:40Z","updated_at":"2018-12-03T05:35:51Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## ❓ Questions and Help\r\n\r\nA use case that I think will come up frequently is having multiple color channels of data that we want to visualize simultaneously (probably most commonly between 2-6 at a time). I think we want to create an independent image layer for each color channel, assign each it's own colormap with independently adjustable clims (which we can do now), but what we then lack is the ability to do any form of color blending (beyond a global opacity). FIJI does this quite nicely - see bellow two channels of information being blended together (one green / one magenta). Does anyone have any thoughts on how to implement this behaviour using vispy? @royerloic @freeman-lab - I tried digging around a bit to see if blending modes were present and I couldn't find any. I can imaging how we would do these computations in the cpu using numpy (but I'm guessing that's not a popular option!!!).\r\n\r\nAlso as side note vispy lacks a lot of the colormaps that we'll want for cell biology that go from black to a particular color (like red, green, blue, cyan, yellow, magenta), and I think we'll need to add them.\r\n\r\n![image](https://user-images.githubusercontent.com/6531703/49310763-0de13400-f494-11e8-9916-9a0b489a9780.png)\r\n"},"comment":{"url":"https://api.github.com/repos/Napari/napari-gui/issues/comments/443594307","html_url":"https://github.com/Napari/napari-gui/issues/79#issuecomment-443594307","issue_url":"https://api.github.com/repos/Napari/napari-gui/issues/79","id":443594307,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzU5NDMwNw==","user":{"login":"sofroniewn","id":6531703,"node_id":"MDQ6VXNlcjY1MzE3MDM=","avatar_url":"https://avatars1.githubusercontent.com/u/6531703?v=4","gravatar_id":"","url":"https://api.github.com/users/sofroniewn","html_url":"https://github.com/sofroniewn","followers_url":"https://api.github.com/users/sofroniewn/followers","following_url":"https://api.github.com/users/sofroniewn/following{/other_user}","gists_url":"https://api.github.com/users/sofroniewn/gists{/gist_id}","starred_url":"https://api.github.com/users/sofroniewn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofroniewn/subscriptions","organizations_url":"https://api.github.com/users/sofroniewn/orgs","repos_url":"https://api.github.com/users/sofroniewn/repos","events_url":"https://api.github.com/users/sofroniewn/events{/privacy}","received_events_url":"https://api.github.com/users/sofroniewn/received_events","type":"User","site_admin":false},"created_at":"2018-12-03T05:35:51Z","updated_at":"2018-12-03T05:35:51Z","author_association":"CONTRIBUTOR","body":"@royerloic - turns out this is pretty easy, thanks for turning me in the right direction though - it's implemented in vispy as `set_gl_state` on an `ImageVisual` (and other visuals). They have three presets `opaque`, `translucent`, and `additive`. Right now we're essentially using `translucent`. `additive` achieves the behavior I desired above. `opaque` doesn't allow for any blending and doesn't seem too useful, but might have a place.\r\n\r\nI propose to add a property `_gl_state` to `_base_layer` and a dropdown menu to the layers widget with the 3 different gl_state presets. It will default to `translucent`, but now it will be easy to change it to the others.\r\n\r\nIf you'd like to see it in action, just create a viewer as normal and then do the following:\r\n`viewer.layers[1]._node.set_gl_state('additive')`"}}
{"actor":{"display_login":"sofroniewn"}}