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