This repository is deprecated and not being updated anymore.
The code was integrated into the
qim3d
library, with some extra features: https://platform.qim.dk/qim3d/viz/#qim3d.viz.colormaps.objectsYou can install with
pip install qim3d
And easily create a colormap:
import qim3d cmap = qim3d.viz.colormaps.objects(nlabels=100, style='bright', first_color_background=True, background_color="black")
Creates a custom random colormap to be used together with matplotlib, useful for segmentation tasks. You may choose the first or last colors to be black. Also, two types of colormap can be generated, 'bright' and 'soft'. On both cases, the generated colors are restricted to never be too bright or too dark.
keywords: python, ipython, matplotlib, plt, color map, random, colors, segmentation
Generating a colormap for 100 labels, with first as black
new_cmap = rand_cmap(100, type='bright', first_color_black=True, last_color_black=False, verbose=True)
Generating a colormap for 50 labels, with last as black
new_cmap = rand_cmap(50, type='soft', first_color_black=False, last_color_black=True, verbose=True)