<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Davis and thanks for the reply.<br>
<br>
So this isn't done automatically after all. After reading the
description of
vtkScalarsToColors::SetVectorMode(vtkScalarsToColors::MAGNITUDE), I
thought that it was doing this (taking the magnitude to get a
scalar) for me automatically.<br>
<blockquote>Change mode that maps vectors by magnitude vs.
component. ...<br>
</blockquote>
I guess that was naive of me! So when would I use this API? To color
a glyph?<br>
<br>
<div class="moz-cite-prefix">On 9/3/2013 5:56 PM, David E DeMarle
wrote:<br>
</div>
<blockquote
cite="mid:CANjZAi9C2ya5+oY26_Hq6DKjdS6ek7FtuWx9GdvcMCQa8V6XGQ@mail.gmail.com"
type="cite">
<div dir="ltr">ParaView transparently puts a vtkPVPostFilter into
the pipeline between the data and rendering which does this and
other simple conversions.</div>
<div class="gmail_extra"><br clear="all">
<div>David E DeMarle<br>
Kitware, Inc.<br>
R&D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: 518-881-4909</div>
<br>
<br>
<div class="gmail_quote">On Tue, Sep 3, 2013 at 3:02 PM, Serge
Lalonde <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:serge@infolytica.com" target="_blank">serge@infolytica.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Hello VTK users,<br>
<br>
This may seem like a simple question, but it seemed like
it was possible to display the magnitude of a vector field
(on an unstructured grid) without having to convert the
vector field to a scalar field simply by setting the
appropriate values in the lookup table and/or the mapper.
However, no matter what I try, I can't get this to work
and I can't find a VTK example that demonstrates this.<br>
<br>
Here's the code that I tried. Is there anything obvious
missing?<br>
<pre style="background:white;font-size:13;font-family:Consolas"> <span style="color:blue">vtkLookupTable</span> *<span style="color:navy">lookup</span> = <span style="color:blue">vtkLookupTable</span>::<span style="color:#880000">New</span>();
<span style="color:navy">lookup</span>-><span style="color:#880000">SetHueRange</span>(2.0/3.0, 0.0);
<span style="color:blue">if</span> (<span style="color:navy">PostField</span>)
<span style="color:navy">lookup</span>-><span style="color:#880000">SetTableRange</span>(<span style="color:navy">PostField</span>-><span style="color:#880000">getMini</span>(), <span style="color:navy">PostField</span>-><span style="color:#880000">getMaxi</span>());
<span style="color:blue">else</span>
<span style="color:navy">lookup</span>-><span style="color:#880000">SetTableRange</span>(0.0, 1.0);
<span style="color:navy">lookup</span>-><span style="color:#880000">Build</span>();
<span style="color:blue">vtkDataSetMapper</span> *<span style="color:navy">mapper</span> = <span style="color:blue">vtkDataSetMapper</span>::<span style="color:#880000">New</span>();
<span style="color:blue">vtkActor</span> *<span style="color:navy">actor</span> = <span style="color:blue">vtkActor</span>::<span style="color:#880000">New</span>();
<span style="color:navy">mapper</span>-><span style="color:#880000">SetInputConnection</span>(producer->GetOutputPort());
<span style="color:navy">mapper</span>-><span style="color:#880000">SetLookupTable</span>(<span style="color:navy">lookup</span>);
<span style="color:navy">mapper</span>-><span style="color:#880000">SetScalarRange</span>(<span style="color:navy">lookup</span>-><span style="color:#880000">GetTableRange</span>());
<span style="color:navy">actor</span>-><span style="color:#880000">SetMapper</span>(<span style="color:navy">mapper</span>);
<span style="color:navy">renderer</span>-><span style="color:#880000">AddActor</span>(<span style="color:navy">actor</span>);
<span style="color:navy">m_</span><span style="color:navy">m_vtk_render_window</span>-><span style="color:#880000">Render</span>();
</pre>
Any help would be appreciated!<br>
<br>
Note that I saw that it's done in ParaView, but maybe they
do the vector to scalar conversion invisibly to the user?<span
class="HOEnZb"><font color="#888888"><br>
<div>-- <br>
<a moz-do-not-send="true"
href="http:://www.infolytica.com" target="_blank">www.infolytica.com
</a><br>
300 Leo Pariseau, Suite 2222, Montreal, QC, Canada,
H2X 4B3<br>
<a moz-do-not-send="true"
href="tel:%28514%29%20849-8752%20x236"
value="+15148498752" target="_blank">(514)
849-8752 x236</a>, Fax: <a moz-do-not-send="true"
href="tel:%28514%29%20849-4239"
value="+15148494239" target="_blank">(514)
849-4239</a> </div>
</font></span></div>
<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
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
moz-do-not-send="true"
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 moz-do-not-send="true"
href="http://www.vtk.org/mailman/listinfo/vtkusers"
target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<title>Signature</title>
<a href="http:://www.infolytica.com">www.infolytica.com </a><br>
300 Leo Pariseau, Suite 2222, Montreal, QC, Canada, H2X 4B3<br>
(514) 849-8752 x236, Fax: (514) 849-4239
</div>
</body>
</html>