# Diverging Log Lookup Table

**URL:** https://discourse.vtk.org/t/diverging-log-lookup-table/10216
**Category:** Support
**Created:** [December 15, 2022, 4:37pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216 "2022-12-15T16:37:26Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![BlueKnight7](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@BlueKnight7](https://discourse.vtk.org/u/BlueKnight7)
#### Post date: [December 15, 2022, 4:37pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/1 "2022-12-15T16:37:26Z")

</div>

This question is prompted from the MakeLUT function in the DisplacementPlot example:

[https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/DisplacementPlot/](https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/DisplacementPlot/)

The MakeLUT function shows how to generate LUT’s with diverging color schemes as described by Kenneth Moreland on his website (given on the example’s webpage).

Is there a way to create these diverging LUT’s using a **vtkLogLookupTable**?

I know that for scalars I could always take the log of the scalar and use a linear vtkLogLookupTable.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 20, 2022, 12:55pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/2 "2022-12-20T12:55:04Z")

</div>

Hi,

What are you getting? An error? Wrong colors or no rendering at all?

regards,

Paulo

---

<div class="post-metadata">

### Author: ![BlueKnight7](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@BlueKnight7](https://discourse.vtk.org/u/BlueKnight7)
#### Post date: [December 20, 2022, 2:49pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/3 "2022-12-20T14:49:44Z")

</div>

Hi Paulo,

I didn’t try it – yet. In looking at the code in MakeLUT, it didn’t appear that a log table would work.

I’m curious if anyone has diverging log tables working.

BK

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 20, 2022, 3:03pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/4 "2022-12-20T15:03:06Z")

</div>

Hello,

Well, give it a shot and see what happens. 🙂

best,

Paulo

---

<div class="post-metadata">

### Author: ![BlueKnight7](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@BlueKnight7](https://discourse.vtk.org/u/BlueKnight7)
#### Post date: [December 20, 2022, 3:58pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/5 "2022-12-20T15:58:15Z")

</div>

Will do. I should have tried it, but have been juggling too much – still am.

BK

---

<div class="post-metadata">

### Author: ![BlueKnight7](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@BlueKnight7](https://discourse.vtk.org/u/BlueKnight7)
#### Post date: [December 21, 2022, 11:13pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/6 "2022-12-21T23:13:14Z")

</div>

Well, I tweaked the displacement example that I mentioned before and the log LUT worked. At first there was the error:

vtkLookupTable.cxx:160 ERR| vtkLogLookupTable (0x1ee46f0): Bad table range for log scale: [-1, 1]

When I changed the range in the example, it worked and there was no error message. I need to check this on something more complex in the future. But, at least there is something.

BK

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 22, 2022, 1:16pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/7 "2022-12-22T13:16:36Z")

</div>

> [@BlueKnight7](#):
>
> Bad table range for log scale: [-1, 1]

The log function is undefied for negative arguments, thus the error.

---

<div class="post-metadata">

### Author: ![BlueKnight7](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@BlueKnight7](https://discourse.vtk.org/u/BlueKnight7)
#### Post date: [December 22, 2022, 2:12pm UTC](https://discourse.vtk.org/t/diverging-log-lookup-table/10216/8 "2022-12-22T14:12:30Z")

</div>

Yes, I knew that. I just didn’t see that the example was setting a definite range.
