<div dir="ltr">I wanted to generate a lookup table from vtkCOlor series using BuildLookupTable().<div>However the only way I can do it is to create a second lookup table and copy from the first to the second one.</div><div>
I thought I could do this:</div><div><div>    colorSeries = vtk.vtkColorSeries()</div><div>    colorSeriesEnum = colorSeries.BREWER_DIVERGING_BROWN_BLUE_GREEN_10</div><div>    colorSeries.SetColorScheme(colorSeriesEnum)</div>
<div>    lut = vtk.vtkLookupTable()</div><div>    colorSeries.BuildLookupTable(lut)</div><div><br></div><div>But I have to do this:</div><div><div>    colorSeries = vtk.vtkColorSeries()</div><div>    colorSeriesEnum = colorSeries.BREWER_DIVERGING_BROWN_BLUE_GREEN_10<br>
</div><div>    colorSeries.SetColorScheme(colorSeriesEnum)</div><div>    lut1 = vtk.vtkLookupTable()</div><div>    colorSeries.BuildLookupTable(lut1)</div><div>    lut = vtk.vtkLookupTable()<br></div><div>    lut.SetNumberOfTableValues(lut1.GetNumberOfTableValues())</div>
<div>    for i in range(0,lut1.GetNumberOfTableValues()):<br></div><div>        lut.SetTableValue(i,lut1.GetTableValue(i))</div></div><div><br></div><div>In looking at the code in vtkColorSeries.cxx, namely:</div><div><div>
<div>//-----------------------------------------------------------------------------</div><div>void vtkColorSeries::BuildLookupTable(vtkLookupTable* lkup)</div><div>{</div><div>  if (lkup)</div><div>    {</div><div>    lkup->SetNumberOfTableValues(this->GetNumberOfColors());</div>
<div>    lkup->IndexedLookupOn();</div><div>    for (int i = 0; i < this->GetNumberOfColors(); ++i)</div><div>      {</div><div>      vtkColor3ub colr = this->GetColor(i);</div><div>      lkup->SetTableValue(</div>
<div>        i, colr.GetRed()/255., colr.GetGreen()/255., colr.GetBlue()/255., 1.);</div><div>      }</div><div>    }</div><div>}</div></div></div><div>It seems lkup is built correctly.</div><div><br></div><div>I can't see any reason for building and then copying to a new table.</div>
<div><br></div><div>I would appreciate it if anyone could point out what I am missing.</div><div><br></div><div>I have also attached a Python script that illustrates this.</div><div><br></div><div>Regards</div><div>   Andrew</div>
-- <br>___________________________________________<br>Andrew J. P. Maclean<br><br>___________________________________________
</div></div>