def _on_colormap_change(self): cmap = self.layer.colormap[1] if self.layer.gamma != 1: # when gamma!=1, we instantiate a new colormap with 256 control points from 0-1 cmap = Colormap(cmap[np.linspace(0, 1, 256)**self.layer.gamma]) if self.layer.dims.ndisplay == 3: self.node.view_program['texture2D_LUT'] = (cmap.texture_lut() if ( hasattr(cmap, 'texture_lut')) else None) self.node.cmap = cmap
def _on_colormap_change(self, event=None): if self.layer.gamma != 1: # when gamma!=1, we instantiate a new colormap with 256 control # points from 0-1 colors = self.layer.colormap.map( np.linspace(0, 1, 256)**self.layer.gamma) cmap = VispyColormap(colors) else: cmap = VispyColormap(*self.layer.colormap) if self.layer.dims.ndisplay == 3: self.node.view_program['texture2D_LUT'] = (cmap.texture_lut() if ( hasattr(cmap, 'texture_lut')) else None) self.node.cmap = cmap