[vtkusers] Using vtkLookupTable to assign an rgb color to each point of a 3D point cloud.

diego martinez damartinez80 at gmail.com
Mon Mar 30 12:16:24 EDT 2009


I have the same problem that Karima has,

I tried Jeff's solution but it does not work.
so I decided to tried  a vtkColorTransferFunction, but it does not work
either...
any other ideas.?




vtkColorTransferFunction * pColorTransferFunction =
vtkColorTransferFunction::New(); for (int i = 0; i < m_iNumberOfColors;

i++) { pColorTransferFunction->AddRGBPoint(value[i], red[i], green[i],
blue[i]); } // pColorTransferFunction->SetAlpha(0.1) does not work also!!

vtkPolyDataMapper * pPolyDataMapper = vtkPolyDataMapper::New();
pPolyDataMapper->SetInput(pPolyData);
pPolyDataMapper->SetLookupTable(pColorTransferFunction);


Karima,

> I have a 3d model and I have for each point(x,y,z) of my model its texture
> (r,g,b).

Do you mean color? Texture coordinates (i,j) should be assigned using
SetTCoords.

I assume instead you have RGB (0-255) colors for each point. These can
be assigned to a 3-component vtkUnsignedCharArray and added to the
PointData. Name the array, and call

mapper->SetColorModeToDefault();
mapper->SetScalarModeToUsePointFieldData();
mapper->SelectColorArray(name);




On Mon, Mar 30, 2009 at 9:30 AM, Jeff Baumes <jeff.baumes at kitware.com>wrote:

> Karima,
>
> > I have a 3d model and I have for each point(x,y,z) of my model
> its texture
> > (r,g,b).
>
> Do you mean color? Texture coordinates (i,j) should be assigned using
> SetTCoords.
>
> I assume instead you have RGB (0-255) colors for each point. These can
> be assigned to a 3-component vtkUnsignedCharArray and added to the
> PointData. Name the array, and call
>
> mapper->SetColorModeToDefault();
> mapper->SetScalarModeToUsePointFieldData();
> mapper->SelectColorArray(name);
>
> Jeff
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Diego Martinez
University of Nebraska at Lincoln
1110 S. 67st, PKI 108
Omaha, NE 68182
+1 - 402 - 575- 8881(Cell)
+1 - 402 - 554 - 3537(Lab)
+1 - 402 - 238 - 1908(SkypePC)



dmartinez at unomaha.edu
damartinez80 at gmail.com(personal)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090330/5f170e00/attachment.htm>


More information about the vtkusers mailing list