Yes, that was it, thanks a lot ! :-) Le jeu. 26 mars 2020 à 03:00, Patrick <patrick.tapp...@gmail.com> a écrit :
> Hi, > > I think you want to disable the (default) autoLevels when setting your > image data: > http://www.pyqtgraph.org/documentation/graphicsItems/imageitem.html#pyqtgraph.ImageItem.setImage > So just something like > my_imageItem.setImage(data, levels=(0, 100), lut=lut) > should do it, changing the levels to whatever limits of your integer data > are. > > On Wednesday, 25 March 2020 22:49:04 UTC+10:30, Manu wrote: >> >> 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 >> > -- > You received this message because you are subscribed to the Google Groups > "pyqtgraph" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pyqtgraph+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyqtgraph/d7dcf184-e538-4baa-8d6f-b5ac293845a8%40googlegroups.com > <https://groups.google.com/d/msgid/pyqtgraph/d7dcf184-e538-4baa-8d6f-b5ac293845a8%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "pyqtgraph" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/CAM40y_ZaKJU20mwLX22TJv7i7hjswGtnk47LB%2BLjPOv57foM9g%40mail.gmail.com.