Coloring by properties (float)

Hi napari ppl,

Is it currently possible to color a label layer by a property that is continuous?
Let’s say I have a cell segmentation, and I want to color it by cell size.

Is there any easier way to do it that manually mapping sizes to colors in a color dict?

Many thanks

Hi Valentyna,

yes, there is an easy way using scikit image’s map_array. Give me a few minutes and I will provide an example.

Here is an example notebook

Note that this is also useful if you want to filter out labels based on several measurements.
You can turn the regionprops into a pandas DataFrame, do your filtering (i.e. a new column that only retains the labels you want to keep) and map this to a new label image.


Hi Volker,

That’s really neat, thanks a lot!