Fix the number of cell colors
See original GitHub issueHello,
I plan to use vedo to visualize and manipulate the in-house dental model datasets (all are VTP file). Each cell/triangle has its own label (between 0 to 24). For example, the “gingiva” cells is labeled as 0, and “molar” cells are labeled as 1. The total number of labels are 25, from 0 to 24, across different models, but most of them only have 15 labels. All cell labels are stored in a cell array (named “Label”). Could you guide me how to fixed the color of cells based on their label? For example, cell with label of 0 always show [255, 162, 143], cells with label of 1 always show [170, 255, 255], cells with label of 2 always show [255, 0, 127], and so on, even though the model might not have some labels.
I started from some examples. Now, I have made an lookup table with total 25 classes (see below).
lut = makeLUT(colorlist=[(0, [255, 162, 143]), (1, [170, 255, 255]), (2, [255, 0, 127]),
(3, [170, 255, 127]), (4, [0, 0, 127]), (5, [255, 255, 127]),
(6, [255, 170, 255]), (7, [255, 255, 255]), (8, [0, 0, 0]),
(9, [255, 0, 255]), (10, [255, 255, 0]), (11, [0, 0, 255]),
(12, [0, 255, 0]), (13, [255, 0, 0]), (14, [0, 255, 255]),
(15, [68, 114, 196]), (16, [255, 80, 80]), (17, [0, 51, 0]),
(18, [102, 102, 255]), (19, [204, 204, 0]), (20, [102, 0, 51]),
(21, [231, 232, 228]), (22, [95, 95, 95]), (23, [102, 0, 204]),
(24, [255, 153, 0]),],
vmin=0,
vmax=24,
aboveColor='black',
belowColor='white',
interpolate=False)
I fed this LUT in the cmap function on a mesh object, as below.
mesh.cmap(cname=lut, arrayName='Label', on='cells', n=25).addScalarBar()
I found that the color of cells still changes in different models due to the different numbers of teeth (or classes).
I am looking forward to hearing your response! Many thanks!
Best,
Bruce Wu
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
You save my day, my friend! Vedo is a fantastic package!
Happy to help!, thanks for your interest and for the feedback.