Page MenuHomePhabricator

Multilabel color map colors are not very nice
Open, LowPublic


Recently upgraded to

image.png (19×531 px, 7 KB)

(Ubuntu 18.04)

Now when I load segmentations and set the multilabel color map MITK correctly sets a unique color for each integer in the segmentation. Nice! (That didn't work before).
However, I can no longer change the colors in the level window slider and the default colors are not very nice, example:

image.png (501×1 px, 125 KB)

Here the vein (coming from the kidneys) has almost the same color as the kidneys. Both are very yellow and it is difficult to distinguish them.

a) it would be great to still have the option of somehow changing colors so that in situation like this colors can be adapted
b) it would be even more fantastic to get better colors by default. For example one should not allow the same color in different shades (intense yellow, fading yellow, dark yellow). I will try to come up with python code to demonstrate what I mean.



Event Timeline

import numpy as np
import colorsys
from skimage import io

if __name__ == "__main__":
    image = np.zeros((1, 256, 3))
    for i in range(256):
        color = np.array(colorsys.hsv_to_rgb(i / 256, 1, 0.8))
        image[:, i, :] = np.tile(color, (1, 1))
    io.imsave('tmp.png', (image * 255).astype(np.uint8))

    # sample X colors:
    x = 16  # must be a square if an int, examples: 16, 25, 36 etc
    colors = np.array([colorsys.hsv_to_rgb(i, 1, 0.8) for i in np.linspace(0, 1, x + 1)][:-1])
    colors = colors.reshape((int(x**0.5), int(x**0.5), 3))
    io.imsave('samples.png', (colors * 255).astype(np.uint8))


tmp.png (1×256 px, 133 B)


image.png (538×542 px, 9 KB)

Still has rather similar greens but you get what I mean :-)

(yes the python code is inefficient. This is a proof of concept and not representative of the programmers abilities :-D )

kislinsk added a subscriber: kislinsk.

I think I once looked into this specific issue and it turned out that your label values had quite some gaps between there values resulting in similar neighboring colors "by accident". Consecutive label values would be quite distinguishable. I am not sure if at least the first x colors follow a certain standard or not. This should be checked first before changing the colors.