Thankyou, works a treat! Now I know what I was doing wrong.<div><br></div><div>Regards</div><div>   Andrew</div><div><br><br><div class="gmail_quote">On Sat, Jul 31, 2010 at 12:15 AM, Andy Bauer <span dir="ltr">&lt;<a href="mailto:andy.bauer@kitware.com">andy.bauer@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Something like the code below should work for the programmable filter.  Note that this assumes the input and output are polydata.<br>
<br>

<table style="margin:4px">
<tbody><tr>
<td style="border:medium none">
<p style="margin:0px;text-indent:0px">pdi = self.GetPolyDataInput()</p>
<p style="margin:0px;text-indent:0px">pdo =  self.GetPolyDataOutput()</p>
<p style="margin:0px;text-indent:0px">pdo.SetPoints(pdi.GetPoints())</p>
<p style="margin:0px;text-indent:0px">np = pdo.GetNumberOfPoints()</p>
<p style="margin:0px;text-indent:0px">a = vtk.vtkUnsignedCharArray()</p>
<p style="margin:0px;text-indent:0px">a.SetNumberOfComponents(3)</p>
<p style="margin:0px;text-indent:0px">a.SetNumberOfTuples(np)</p>
<p style="margin:0px;text-indent:0px">a.SetName(&quot;color&quot;)</p>
<p style="margin:0px;text-indent:0px">r = pdi.GetPointData().GetArray(&quot;r&quot;)</p>
<p style="margin:0px;text-indent:0px">g = pdi.GetPointData().GetArray(&quot;g&quot;)</p>
<p style="margin:0px;text-indent:0px">b = pdi.GetPointData().GetArray(&quot;b&quot;)</p>
<p style="margin:0px;text-indent:0px"></p>
<p style="margin:0px;text-indent:0px">for i in range(np):</p>
<p style="margin:0px;text-indent:0px">        a.SetValue(i*3, r.GetValue(i))</p>
<p style="margin:0px;text-indent:0px">        a.SetValue(i*3+1, g.GetValue(i))</p>
<p style="margin:0px;text-indent:0px">        a.SetValue(i*3+2, b.GetValue(i))</p>
<p style="margin:0px;text-indent:0px"></p>
<p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">pdo.GetPointData().AddArray(a)</p>
<p style="margin:0px;text-indent:0px"></p></td></tr></tbody></table><br><br><div class="gmail_quote"><div><div></div><div class="h5">On Fri, Jul 30, 2010 at 2:13 AM, Andrew Maclean <span dir="ltr">&lt;<a href="mailto:andrew.amaclean@gmail.com" target="_blank">andrew.amaclean@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div class="h5">I have a file that looks like this:<br>
x y z r g b px py<br>
<br>
-2.064749 -1.623789 5.264024 254 254 254 5.000000 7.000000<br>
<br>
-2.267242 -1.790226 5.803583 254 254 254 5.000000 8.000000<br>
<br>
-2.251401 -1.784915 5.786366 254 254 254 5.000000 9.000000<br>
<br>
-1.401535 -1.134097 3.676532 201 201 201 5.000000 14.000000<br>
<br>
-1.420374 -1.154109 3.741410 179 179 179 5.000000 15.000000<br>
<br>
...<br>
<br>
In ParaVew, I use the inbuilt CSV reader and get a table of labelled columns.<br>
In order tot get the points, I use a TableToPoints filter.<br>
The output of this filter is a table consisting of r,g,b, px, py,<br>
points, point ID.<br>
This plots OK in 3D.<br>
<br>
How can I transform the r, g, b arrays into a vtkUnsignedCharArray in<br>
order to add colour information to the points?<br>
I have been trying to use a programmable filter but don&#39;t seem to be<br>
able to access the r, g, b components.<br>
Also will the other components of the array be passed through, namely<br>
(points, and px, py)? Ultimately I want to create a 2d image of the<br>
px, py and colours.<br>
<br>
<br>
<br>
Any help appreciated.<br>
<br>
Thanks<br>
   Andrew<br>
<br>
--<br>
___________________________________________<br>
Andrew J. P. Maclean<br>
Centre for Autonomous Systems<br>
The Rose Street Building J04<br>
The University of Sydney  2006  NSW<br>
AUSTRALIA<br>
Ph: +61 2 9351 3283<br>
Fax: +61 2 9351 7474<br>
URL: <a href="http://www.acfr.usyd.edu.au/" target="_blank">http://www.acfr.usyd.edu.au/</a><br>
___________________________________________<br></div></div>
_______________________________________________<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 ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote></div><br>
</blockquote></div><br><br clear="all"><br>-- <br>___________________________________________<br>Andrew J. P. Maclean<br>Centre for Autonomous Systems<br>The Rose Street Building J04<br>The University of Sydney  2006  NSW<br>
AUSTRALIA<br>Ph: +61 2 9351 3283<br>Fax: +61 2 9351 7474<br>URL: <a href="http://www.acfr.usyd.edu.au/">http://www.acfr.usyd.edu.au/</a><br>___________________________________________<br>
</div>