<div dir="ltr">Hi Alexis,<div><br></div><div>1-</div><div>vtkColorTransferFunction::AddRGBPoint() takes RGB components from 0. to 1. (double), not 0 to 255 (unsigned char).</div><div><br></div><div>Julien.</div><div class="gmail_extra">


<br><br><div class="gmail_quote">On Thu, Aug 15, 2013 at 3:37 PM, Girault, Alexis <span dir="ltr">&lt;<a href="mailto:girault@email.unc.edu" target="_blank">girault@email.unc.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">







<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi,
<br>
<br>
I try to display colors to describe the scalars value of points in surfaces. When doing this, I&#39;d like to choose between different color spaces to interpolate points color to create the colormap.<br>
<br>
I am using the vtkColorTransferFunction::SetColorSpaceTo...() to choose between Divergingm Lab, RGB and HSV.<br>
<br>
<b>1- Problem : Diverging and Lab do their job, RGB and HSV don&#39;t : </b><br>
<ul>
<li>Diverging : <a href="http://hpics.li/ba7907f" target="_blank">http://hpics.li/ba7907f</a></li><li>Lab : <a href="http://hpics.li/a36da83" target="_blank">http://hpics.li/a36da83</a></li><li>RGB &amp; HSV : <a href="http://hpics.li/53b5d5d" target="_blank">http://hpics.li/53b5d5d</a></li>


</ul>
<br>
<i>My code :</i><br>
****************************************************************************************************************************      
<br>
        //Range<br>
        double *rangeLUT = mapper-&gt;GetInput()-&gt;GetPointData()-&gt;GetScalars()-&gt;GetRange();<br>
        double range = fabs(rangeLUT[1] - rangeLUT[0]);<br>
<br>
        //LookUpTable<br>
        vtkSmartPointer&lt;vtkColorTransferFunction&gt; DistanceMapTFunc = vtkSmartPointer&lt;vtkColorTransferFunction&gt;::New();<br>
        DistanceMapTFunc-&gt;AddRGBPoint(rangeLUT[0], 0, 255, 0);                           // Min value to green<br>
        DistanceMapTFunc-&gt;AddRGBPoint(rangeLUT[0] + range/2.0, 255, 255, 0);  // Middle of the range to yellow<br>
        DistanceMapTFunc-&gt;AddRGBPoint(rangeLUT[1], 255, 0, 0);                           // Max value to red<br>
<br>
        //Color Space<br>
        if(cspace == &quot;Diverging&quot;)       DistanceMapTFunc-&gt;SetColorSpaceToDiverging();<br>
        else if(cspace == &quot;Lab&quot;)         DistanceMapTFunc-&gt;SetColorSpaceToLab();<br>
        else if(cspace == &quot;RGB&quot;)        DistanceMapTFunc-&gt;SetColorSpaceToRGB();<br>
        else if(cspace == &quot;HSV&quot;)        DistanceMapTFunc-&gt;SetColorSpaceToHSV();<br>
<br>
        //Mapper Update<br>
        mapper-&gt;SetLookupTable( DistanceMapTFunc );<br>
        mapper-&gt;ScalarVisibilityOn();<br>
        mapper-&gt;Update();<br>
****************************************************************************************************************************      
<br>
<br>
<br>
<b>2- Black value at minimum Range :<br>
<br>
</b>Even if I add a Green point at rangeLUT[0], my min value is black, as you can see both on the surface and the scalarbar :<br>
<a href="http://hpics.li/2ce35fb" target="_blank">http://hpics.li/2ce35fb</a><br>
<br>
I tought it might be because something was rounding when displaying colors, so I evaluated the error as the the range divided by the number of colors, which gives us range/256. Then I add it to the max and remove it to the min.<br>



By doing this I actually &quot;erased&quot; the black values from the surface, but not the scalarbar : I only have a lower min and still black :<br>
<a href="http://hpics.li/9315fec" target="_blank">http://hpics.li/9315fec</a><br>
<b><br>
<br>
</b><b>3- Are those functions useful? Nothing seems to change in my code (already implemented):</b><br>
        mapper-&gt;SetScalarRange(rangeLUT[0],rangeLUT[1]);<br>
        mapper-&gt;SetScalarModeToUsePointData();<br>
        mapper-&gt;SetColorModeToMapScalars();<br>
<br>
<br>
If you have the answer to any of those questions, please let me know!<br>
Thanks all.<br>
<br>
</div>
</div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" 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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div></div>