Hello,
I am displaying an image of integers, a so-called label map. Each integer corresponds to a different class and should have its own color. It works fine when the image does not change. However in my application, the label map changes and new integer values are added. When this happens, the color assigned to already existing integer values change. I want them to stay the same.
What happens in practice: in current label map, '1' corresponds to blue. When I add the new value '2' : '1' changes to red, and '2' adopts blue. I want '1' to keep its initial color blue, and '2' to adopt a new color.
Any idea?
If it helps, here is how I create the lookuptable (I use a method found in this group to convert from matplotlib):
colormap = matplotlib.cm.get_cmap('CMRmap')
colormap._init()
lut = (colormap._lut * 255).view(np.ndarray)
# edit alpha channel so that '0'->transparent
alpha = np.ones(lut.shape[0]) * 255
alpha[0] = 0
lut[:,3] = alpha
my_imageItem.setLookupTable(lut)
Best,
Manu