def _process(self, overlay, key=None): if len(overlay) != 2: raise Exception( "colorizeHSV required an overlay of two Image elements as input." ) if (len(overlay.get(0).vdims), len(overlay.get(1).vdims)) != (1, 1): raise Exception( "Each Image element must have single value dimension.") if overlay.get(0).shape != overlay.get(1).shape: raise Exception( "Mismatch in the shapes of the data in the Image elements.") hue = overlay.get(1) Hdim = hue.vdims[0] H = hue.clone(hue.data.copy(), vdims=[Hdim(cyclic=True, range=hue.range(Hdim.name))]) normfn = raster_normalization.instance() if self.p.input_ranges: S = normfn.process_element(overlay.get(0), key, *self.p.input_ranges) else: S = normfn.process_element(overlay.get(0), key) C = Image(np.ones(hue.data.shape), bounds=self.get_overlay_bounds(overlay), group='F', label='G') C.vdims[0].range = (0, 1) S.vdims[0].range = (0, 1) return HSV(H * C * S).relabel(group=self.p.group)
def init_data(self): self.hsv = HSV((self.xs, self.ys, self.hsv_array[:, :, 0], self.hsv_array[:, :, 1], self.hsv_array[:, :, 2]))
def init_data(self): self.hsv = HSV(self.hsv_array[::-1], bounds=(-10, 0, 10, 10))