Extract color information per vertex

#1

I have a quick question about reading the color information stored in a ply file.

The following code extracts the xyz coordinate of a given vertex, but how to read the RGB value associated to each vertex?

vtkSmartPointer reader = vtkSmartPointer::New();

reader->SetFileName(“input_with_color.ply”);

reader->Update();

vtkSmartPointer polyData = reader->GetOutput();

vtkSmartPointer vertices = polyData->GetPoints();

double xyz[3];

vertices->GetPoint(idx, xyz);

I guess we can use

polyData->GetPointData()->GetArray("???")

but not sure how to do that. Would appreciate any pointers or examples!

Thanks,
Bing