widgetti / ipyvolume

3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
MIT License
1.95k stars 236 forks source link

feat: discrete transfer functions #439

Open maartenbreddels opened 1 year ago

maartenbreddels commented 1 year ago

Maps integer data to a single color, and gives a dropdown to select which layers to show Example usage:

ipv.figure()

light = ipv.light_ambient(intensity=0.4);
ipv.light_hemisphere(intensity=1);
tf = ipv.transfer_function_discrete(2, labels=["gap", "solid"], enabled=[False, True], colors=["#ff0000", "#00ff00"])

volume = ipv.volshow(solid, tf=tf)
ipv.show()

discrete-transfer-function