<div dir="ltr">That works too :-)</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 27, 2015 at 12:17 PM, Richard Brown <span dir="ltr"><<a href="mailto:richard.j.brown@live.co.uk" target="_blank">richard.j.brown@live.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Cory, <div><br></div><div>Thanks for the help. </div><div><br></div><div>Found a long-winded way a few days ago, which would work for any colour lookup table that exists in imageJ.</div><div><br></div><div>In case this helps anyone in the future, here’s what I did:</div><div><br></div><div>In ImageJ,</div><div><span style="white-space:pre-wrap"> </span>Image -> LookupTables -> Fire</div><div><span style="white-space:pre-wrap"> </span>Image -> Color -> Show LUT -> List</div><div><br></div><div>The list is of the form:</div><div><span style="white-space:pre-wrap"> </span>index, R, G, B </div><div>where RGB are 0 to 255. vtkLookupTable expects RGB between 0 and 1 so divide by 255 in the code</div><div><br></div><div>With a little bit of copy and paste jiggerypokery for the SetTableValue(index,R,G,B), the vtkLookupTable then looks as follows:</div><div><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">vtkSmartPointer</span><<span style="color:#800080">vtkLookupTable</span>><span style="color:#c0c0c0"> </span>l_p_fireLookupTable<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span><span style="color:#800080">vtkSmartPointer</span><<span style="color:#800080">vtkLookupTable</span>>::New();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">if</span><span style="color:#c0c0c0"> </span>(a_cutoffLimit<span style="color:#c0c0c0"> </span>==<span style="color:#c0c0c0"> </span>-<span style="color:#000080">1</span>)<span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetRange</span>(a_low,<span style="color:#c0c0c0"> </span>a_high);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">else</span><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetRange</span>(a_low,<span style="color:#c0c0c0"> </span>a_cutoffLimit);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetNumberOfColors</span>(<span style="color:#000080">256</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetTableValue</span>(<span style="color:#000080">0</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetTableValue</span>(<span style="color:#000080">1</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">7.</span>/<span style="color:#000080">255.</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetTableValue</span>(<span style="color:#000080">2</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">15.</span>/<span style="color:#000080">255.</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetTableValue</span>(<span style="color:#000080">3</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">22.</span>/<span style="color:#000080">255.</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> <span style="white-space:pre-wrap"> </span></span>...</pre><pre style="margin-top:0px;margin-bottom:0px"></pre><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="white-space:pre-wrap"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetTableValue</span>(<span style="color:#000080">253</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetTableValue</span>(<span style="color:#000080">254</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">SetTableValue</span>(<span style="color:#000080">255</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">255.</span>/<span style="color:#000080">255.</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>l_p_fireLookupTable-><span style="font-style:italic">Build</span>();</pre><div><br></div></div></div><div>Richard</div><div><div class="h5"><div><br><div><blockquote type="cite"><div>On 27 Oct 2015, at 16:15, Cory Quammen <<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>> wrote:</div><br><div><div dir="ltr">Richard,<div><br></div><div>It's actually a little bit involved.</div><div><br></div><div>Here's Python code to generate ParaView's Black-Body Radiation color map, which I think is similar to ImageJ's 'hot' lookup table.</div><div><br></div><div><div>import vtk</div><div><br></div><div>cmap = vtk.vtkDiscretizableColorTransferFunction()</div><div>cmap.SetColorSpaceToRGB()</div><div>cmap.AddRGBPoint(0.0, 0.0, 0.0, 0.0) # black</div><div>cmap.AddRGBPoint(0.4, 1.0, 0.9, 0.0) # reddish</div><div>cmap.AddRGBPoint(0.8, 0.9, 0.9, 0.0) # yellow</div><div>cmap.AddRGBPoint(1.0, 1.0, 1.0, 1.0) # white</div><div><br></div><div>scalarValues = vtk.vtkFloatArray()</div><div>scalarValues.SetNumberOfComponents(1)</div><div>scalarValues.SetNumberOfTuples(256)</div><div>for i in xrange(256):</div><div> scalarValues.SetTupleValue(i, [i / 255.0])</div><div><br></div><div>table = cmap.MapScalars(scalarValues, 0, -1)</div><div><br></div><div>for i in xrange(table.GetNumberOfTuples()):</div><div> print table.GetTuple(i)</div></div><div><br></div><div>Note that this defines a colormap for scalar values in the range [0, 1]. You can rescale the first arguments to AddRGBPoints() above for a different scalar range.</div><div><br></div><div>Hope that helps,</div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 21, 2015 at 5:22 AM, mbcx9rb9 <span dir="ltr"><<a href="mailto:richard.j.brown@live.co.uk" target="_blank">richard.j.brown@live.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I imagine this is a very simple question, but I haven't found the answer<br>
already in the group.<br>
<br>
I have greyscale data that I want to apply a lookup table to. Currently, my<br>
lowest value is red and my highest is blue, but I would like something that<br>
looks more like the 'fire' lookup table in imageJ.<br>
<br>
In essence, I think I want my lowest value to be black and my highest to be<br>
a red/white. Can anyone give me any pointers?<br>
<br>
Thanks in advance,<br>
Richard Brown<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/simple-vtkLookupTable-question-tp5734493.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/simple-vtkLookupTable-question-tp5734493.html</a><br>
Sent from the VTK - Users mailing list archive at <a href="http://Nabble.com" target="_blank">Nabble.com</a>.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>