<div dir="ltr">Hi xVict,<div><br></div><div>I've never trusted that code either, a per-component shift and scale only</div><div>makes sense to me if the input data is RGB. I don't understand why</div><div>this class applies per-component shift and scale after vtkLookupTable.</div><div><br></div><div>Can anyone explain what's going on in this code?</div><div><br></div><div> - David</div><div> </div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 25, 2018 at 8:53 AM, xVict <span dir="ltr"><<a href="mailto:suharev@roentgenprom.ru" target="_blank">suharev@roentgenprom.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi David!<br>
<br>
Some code skeleton:<br>
// Image viewer creation<br>
this->imgViewer = vtkSmartPointer<<wbr>vtkImageViewer2>::New();<br>
<br>
// Lut creation<br>
if (colorLut == nullptr)<br>
colorLut = vtkSmartPointer<<wbr>vtkLookupTable>::New();<br>
int norm = Range[1] - Range[0] + 1;<br>
colorLut->SetRange(Range[0], Range[1]);<br>
colorLut->SetIndexedLookup(0);<br>
colorLut-><wbr>SetNumberOfTableValues(norm);<br>
colorLut->Build();<br>
for (int i = 0; i < norm; i++) {<br>
double cl = double(i) / (norm - 1);<br>
colorLut->SetTableValue(i, cl, cl, cl);<br>
}<br>
<br>
// change view option<br>
double c = 0.5*(this->Range[1] + this->Range[0]);<br>
double w = 1.0*(this->Range[1] - this->Range[0]);<br>
this->imgViewer-><wbr>GetWindowLevel()->SetLevel(c);<br>
this->imgViewer-><wbr>GetWindowLevel()->SetWindow(w)<wbr>;<br>
if (this->optycaltype == PSEUDO_COLOR) {<br>
createPseudoLUT();<br>
if (this->imgViewer-><wbr>GetWindowLevel()-><wbr>GetLookupTable() ==<br>
nullptr)<br>
this->imgViewer-><wbr>GetWindowLevel()-><wbr>SetLookupTable(colorLut);<br>
}<br>
else {<br>
if (this->imgViewer-><wbr>GetWindowLevel()-><wbr>GetLookupTable() !=<br>
nullptr)<br>
this->imgViewer-><wbr>GetWindowLevel()-><wbr>SetLookupTable(nullptr);<br>
}<br>
if (this->source != nullptr)<br>
imgViewer->Render();<br>
<br>
For 16bit image this code should show identical picture. But for<br>
PSEUDO_COLOR==8bit-gray (r=g=b in range [0...1] == [0...255]). <br>
<div class="HOEnZb"><div class="h5"><br>
Sincerely, Victor.<br></div></div></blockquote></div></div></div></div>