question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix the number of cell colors

See original GitHub issue

Hello,

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:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Tai-Hsiencommented, Sep 24, 2020

You save my day, my friend! Vedo is a fantastic package!

1reaction
marcomusycommented, Sep 24, 2020

Happy to help!, thanks for your interest and for the feedback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add or change the background color of cells
Select the cell or range of cells you want to format. · Click Home > Format Cells dialog launcher, or press Ctrl+Shift+F. ·...
Read more >
How to Count COLORED Cells in Excel [Step-by-Step Guide + ...
In this tutorial, learn how to count colored cells in Excel. It will show you how to do this using three methods: Filter...
Read more >
6 Ways to Count Colored Cells in Microsoft Excel [Illustrated ...
What is this? Press Ctrl + A to select all the cells and then press the Close button and you can then change...
Read more >
Excel: count and sum cells by color - Ablebits
A quick way to sum and count colored cells in Excel by using custom functions and macros: in a range or across entire...
Read more >
Top 3 Methods to Count Colored Cells In Excel
Guide to Count Colored Cells in Excel. Here we learn count colored cells by using auto filter option, VBA code and FIND method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found