How to change the color of the Point Cloud Data?

Hi all.

This is my 2nd question about VTK! :slight_smile:

Last time, I have inquired on loading the PLY file.
link: The PLY file is not working.

I can change the color of Point Cloud Data by applying the parameter of Color Map Editor on ParaView program.

So, I want to it also works on my code.

I have tested the sample code(below links), but I couldn’t apply color.
link1: Filled contours / discrete number of colors
link2: https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/ColorCells/
link3:

The my test code is as below:

vtkSmartPointer<vtkPLYReader> pPLYReader =
	vtkSmartPointer<vtkPLYReader>::New();
pPLYReader->SetFileName("myPLY.ply");
pPLYReader->Update();

vtkSmartPointer<vtkPointGaussianMapper> mapper =
	vtkSmartPointer<vtkPointGaussianMapper>::New();

mapper->SetInputConnection(pPLYReader->GetOutputPort());
mapper->SetScaleFactor(0);
mapper->ScalarVisibilityOn();
mapper->SetScalarRange(0, 1500);
mapper->SetScalarModeToUsePointFieldData();
mapper->ColorByArrayComponent("VelocityMagnitude", 0);

vtkSmartPointer<vtkActor> actor =
	vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);

vtkSmartPointer<vtkRenderer> renderer =
	vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
renderer->SetBackground(.1, .2, .3);
renderer->ResetCamera();

m_vtkWindow->AddRenderer(renderer);
m_vtkWindow->Render();

Could you please asvise me what is the problem?

Thank you.

Best regards,
William Kim

Finally, I can change the color of Point Cloud Data.

The ‘ScalarBarActorColor’ sample code will be helpful.
https://lorensen.github.io/VTKExamples/site/Java/Visualization/ScalarBarActorColorSeries/