[Paraview] I: 3D point cloud with color

David Pont David.Pont at scionresearch.com
Mon Feb 27 16:41:29 EST 2012


Hi all,
  Thanks for the excellent info, I had missed the earlier discussion. Using the tiny example txt file from Giulio, TableToPoints, ProgrammableFilter (with the script from Andrew, changed array names from r,g,b to Field 3,Field 4,Field 5), Display tab, uncheck Map Scalars, Color by: color and it works! I'm definitely tucking away this tip for future reference in case I have RGB info in arbitrary fields. But even better: create a vtp file with a 3 component UnsignedChar array and it is good to go!

  thanks again to all, Dave


-----Original Message-----
From: David E DeMarle [mailto:dave.demarle at kitware.com]
Sent: Tuesday, 28 February 2012 10:08 a.m.
To: Pat Marion
Cc: David Pont; paraview at paraview.org
Subject: Re: [Paraview] I: 3D point cloud with color

And here is an example python programmable filter that you can adapt
to produce a 3 component unsigned char RGB array.

ids = self.GetInput()
ods = self.GetOutput()

ocolors = vtk.vtkUnsignedCharArray()
ocolors.SetName("colors")
ocolors.SetNumberOfComponents(3)
ocolors.SetNumberOfTuples(ids.GetNumberOfPoints())

inArray = ids.GetPointData().GetArray(0)
maxV = inArray.GetRange()[1]
for x in range(0, ids.GetNumberOfPoints()):
  rF = 0.0;
  gF = 0.5;
  bF = inArray.GetValue(x)/maxV
  rC = rF*256
  gC = gF*256
  bC = bF*256
  ocolors.SetTuple3(x, rC,gC,bC)

ods.GetPointData().AddArray(ocolors)

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909



On Mon, Feb 27, 2012 at 3:44 PM, Pat Marion <pat.marion at kitware.com> wrote:
> ParaView does indeed display points with RGB color values.  The colors must
> be in a unsigned char array (not any other data type) with 3 components.
> Then go to the display tab and uncheck the "map scalars" box, and you will
> see the points with color.  You can read more about the map scalars option
> in the online documentation here:
> http://paraview.org/OnlineHelpCurrent/Display.html
>
> Giulio, did you try the python programmable source that I posted in your
> original email?  It works for me on your supplied file, rgb.txt.  If you use
> this python programmable source, you can then use File -> Save Data to
> re-save the data as a VTP file that can be loaded using a standard reader in
> the future.
>
> Pat
>
>
> On Mon, Feb 27, 2012 at 3:19 PM, David Pont <David.Pont at scionresearch.com>
> wrote:
>>
>> Hi Giulio,
>>  I am also very interested in viewing XYZRGB data, and I have not had any
>> success in Paraview so far. I think the suggestion to use a vtp file instead
>> of a text file was simply another way to get data in to Paraview. But I
>> think the issue is how to use RGB values for coloring, regardless of how the
>> information is read.
>>
>> I hope I am wrong, but I don't think this is supported. Paraview (vtk)
>> uses lookup tables to map scalar attribute data to RGB values. It also
>> supports vector data, by using only one of the values, or magnitude, ie
>> still a scalar to RGB mapping. When I load your example vtp file the RGB
>> triplet is loaded as Normals_, and color options are then to use, X or Y or
>> Z or Magnitude.
>>
>> It seems like this should be easy, really we want to bypass the mapping of
>> scalars to color and have Paraview (vtk) use the provided RGB directly. But
>> I think this might require a completely new Mapper and/or other parts of the
>> rendering subsystem. Probably quite do-able for someone that understands the
>> inner workings of the rendering system?
>>
>> In the meantime you might be better looking for other tools that are
>> designed to display point clouds with RGB? This kind of data is becoming
>> more common. My interest is for LiDAR data where XYZRGB data is starting to
>> become available, but I have not actually encountered this yet so I have not
>> found a solution.
>>
>> Here's hoping I'm wrong and someone has a clever solution in Paraview...
>> otherwise perhaps it could be a feature request?
>>
>>  regards, Dave
>>
>> David Pont
>> Scientist - Forest Management Science
>> Scion
>> 49 Sala Street, Private Bag 3020, Rotorua 3046, New Zealand
>> DDI +64 7 343 5663
>> www.scionresearch.com
>>
>>
>>
>> -----Original Message-----
>> From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org]
>> On Behalf Of Giulio Reina
>> Sent: Monday, 27 February 2012 8:57 p.m.
>> To: paraview at paraview.org
>> Cc: andrew.amaclean at gmail.com
>> Subject: [Paraview] I: 3D point cloud with color
>>
>> Hi all,
>>
>> Following  David's suggestion, I came up with the code attached that turns
>> the starting data file (rgb.txt, of the type [X Y Z R G B] (the first three
>> vector columns specify the location of the single point and the last three
>> one its color in RGB space)) into a parsed vtp format. Unfortunately, when I
>> try to open the VTP file in Paraview (after applying a Glyph filter) the
>> results are not what I expect, i.e. one point red, one point green, two
>> points blue.
>>
>> I would greatly appreciate if someone could help me put reading correctly
>> the VTP file, I should admit that I'm not very familiar with the use of vtp
>> files in Paraview,
>>
>> Cheers
>>
>> Giulio
>>
>>
>>
>>
>> -----Messaggio originale-----
>> Da: David Doria [mailto:daviddoria at gmail.com]
>> Inviato: giovedì 23 febbraio 2012 02:48
>> A: giulio.reina at unisalento.it
>> Cc: paraview at paraview.org
>> Oggetto: Re: [Paraview] 3D point cloud with color
>>
>> >> I have been working with 3D stereo reconstruction. So, I have huge 3d
>> point clouds co-registered with color in this format [X Y Z R G B] (the
>> first three vector columns specify the location of the single point and the
>> last three one its color in RGB space). I have been trying to display the
>> data in Paraview without success.
>>
>> >>
>> >>
>> >>
>> >> I use the "table to points" filter to show the 3D coordinates but
>> >> then I
>> do not know  how to specify the color of each single point using its RGB
>> components. Can you please help me out?
>>
>> If you're more comfortable in c++ you could use VTK to parse the file,
>> construct a polydata, and then write a vtp file. Here are the examples you'd
>> need:
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/InfoVis/ReadDelimitedFile
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/WriteVTP
>>
>> Then Paraview can easily read this vtp file.
>>
>> David
>>
>>
>>
>> This e-mail and any attachments may contain information which is
>> confidential or subject to copyright. If you receive this e-mail in error,
>> please delete it.
>> Scion does not accept responsibility for anything in this e-mail which is
>> not provided in the  course of Scion's usual business or for any computer
>> virus, data corruption, interference or delay arising from this e-mail.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>



This e-mail and any attachments may contain information which is confidential or subject to copyright. If you receive this e-mail in error, please delete it.
Scion does not accept responsibility for anything in this e-mail which is not provided in the  course of Scion's usual business or for any computer virus, data corruption, interference or delay arising from this e-mail.


More information about the ParaView mailing list