<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div><br></div><div>Hi Everyone,</div><div><br></div><div>I'm trying to set the lookup-table to give me blue for the minimum and red for the maximum value with linear interpolation between them.</div><div><br></div><div>When I run my program it gives me different colors each time. Here is my code, can anyone help me to figure out what I'm doing wrong?</div><div><br></div><div>vtkLookupTable *lut = vtkLookupTable::New();</div><div>lut->SetNumberOfTableValues(256);</div><div><span style="font-size: 12pt;">vtkColorTransferFunction *TF = vtkColorTransferFunction::New();</span></div><div>TF->SetColorSpaceToDiverging();</div><div>TF->AddRGBPoint(reader->GetOutput()->GetScalarRange()[0],0.0,0.0,1.0);</div><div><font size="3">TF->AddRGBPoint(</font>reader->GetOutput()->GetScalarRange()<font size="3">[1],1.0,0.0,0.0);</font></div><div> TF->SetScaleToLinear();</div><div><br></div><div> double myValue;</div><div> for(int i=0; i<256;i++)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> { </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> myValue = GetLinearInterploation(i/1.0,0, 256, reader->GetOutput()->GetScalarRange()[0], reader->GetOutput()->GetScalarRange()[1]);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> lut->SetTableValue(myValue,TF->GetColor(myValue));<span class="Apple-tab-span" style="font-size: 12pt; white-space: pre;"> </span><span style="font-size: 12pt;"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> }</div><div><br></div><div><br></div><div><div>lut->Build();</div><div>SliceMapper->SetLookupTable(lut);</div></div><div><span style="font-size: 12pt;">SliceMapper</span>->SetScalarRange(reader->GetOutput()->GetScalarRange()[0],reader->GetOutput()->GetScalarRange()[1]);</div><div><div>vtkRenderer *ren = vtkRenderer::New();</div><div>vtkRenderWindow *renwin = vtkRenderWindow::New();</div></div><div>renwin->AddRenderer(ren); </div><div>ren->AddActor(SliceActor);</div><div><div>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</div><div> iren->SetRenderWindow(renwin);</div></div><div><div>renwin->Render();</div><div><span style="font-size: 12pt;">iren->Start();</span></div></div><div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;">Thanks!</span></div> </div></body>
</html>