Hi David, Thanks for the reply, it works now, but I can't see the original RGB colors in renderview. In color map editor, I changed the settings to RGB but still the color scale is scaled based on color pallet. Is there any other settings that I missed?
Thanks. On Tue, Aug 8, 2017 at 1:46 PM, David E DeMarle <dave.dema...@kitware.com> wrote: > Try: > > inRArray = ids.GetPointData().GetArray("R") > inGArray = ids.GetPointData().GetArray("G") > inBArray = ids.GetPointData().GetArray("B") for x in range(0, > ids.GetNumberOfPoints()): > rF = inRArray.GetValue(x) > gF = inGArray.GetValue(x) > bF = inBArray.GetValue(x) > > > David E DeMarle > Kitware, Inc. > Principal Engineer > 21 Corporate Drive > Clifton Park, NY 12065-8662 > Phone: 518-881-4909 > > On Tue, Aug 8, 2017 at 7:08 AM, Shayan Nikoohemat < > shayan.nikoohe...@gmail.com> wrote: > >> I have a Paraview programmable filter written in python, that I am >> running on a table of points to assign RGB colors as UnsignedCharArray. >> I'm just stuck in one part of the code to get the value of R, G, B fields >> in the range. Here is the table example: >> >> [image: Inline image 1] >> >> ids = self.GetInput() >> ods = self.GetOutput() >> >> ocolors = vtk.vtkUnsignedCharArray() >> ocolors.SetName("colors") >> ocolors.SetNumberOfComponents(3) >> ocolors.SetNumberOfTuples(ids.GetNumberOfPoints()) >> >> inArray = ids.GetPointData().GetArray(0)for x in range(0, >> ids.GetNumberOfPoints()): >> rF = inArray.GetValue(x) # here I need something like GetValue(x, "R") >> gF = inArray.GetValue(x) # here I need something like GetValue(x, "G") >> bF = inArray.GetValue(x) # here I need something like GetValue(x, "B") >> >> ocolors.SetTuple3(x, rF,gF,bF) >> >> ods.GetPointData().AddArray(ocolors) >> >> Can anyone help me to fix this. >> >> The code source is from an old post from 2012. >> >> Thanks. >> >> Shayan >> >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=ParaView >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview