The PLY file is not working.

Hi all.

I have a question about PLY file load.

I have two PLY files.
(A) PLY file: It made by 3D Scanner.
(B) PLY file: The sample PLY file from the link.
Link: http://graphics.im.ntu.edu.tw/~robin/courses/cg04/model/index.html

The B file work normally but A file is not working on the same code.

My code snippet is as below:

vtkSmartPointer pPLYReader =
vtkSmartPointer::New();
pPLYReader->SetFileName(“myPLY.ply”);
pPLYReader->Update();

vtkSmartPointer mapper =
vtkSmartPointer::New();
mapper->SetInputConnection(pPLYReader->GetOutputPort());

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

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

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

I don’t know why A file is not working.

Unfortunately, I can’t upload the file.

Could you please advise me about loading the PLY file?

Thank you.

Have a good day :slight_smile:

Kim,
What version of VTK are you using? Can you try with master?

Thanks,

Dan

Hi Dan Lipsa.

My VTK version is 8.2.0.

Thank you.

Kim,

Can you try with VTK from the master branch

https://gitlab.kitware.com/vtk/vtk

We had a PLY fix going in that did not make it in 8.2

Thanks,

Dan

Hi Dan.

I tried to load my PLY file with VTK from the master branch.

But the symptom is the same…

Do you think, does the code have no problem?

I want to check the code is okay.
If yes, I think the PLY file has a problem.

Thank you :slight_smile:

What is the error you are seeing?

You can try loading that file in meshlab, to see if that program loads it.

If you can share your file privately, I can take a look at it. My email is my first name dot my last name at kitware.com

Thanks,

Dan

I sent you my PLY file by email.

Thank you :slight_smile:

Note that you never need to reveal your email address if you use discourse. You can send private message by clicking on the user’s photo then on the “Message” button in the top-right corner.

Hi Kim,

Thanks for sending me the file.

I took a look at it in ParaView. The problem with it is that it does not have any cells, so the default representation - surface shows nothing.

The Point Gaussian representation works.

For VTK, try

https://vtk.org/doc/nightly/html/classvtkPointGaussianMapper.html

instead of

vtkPolyDataMapper.

Dan

Thanks Andras, I’ll keep this in mind.
I use discourse through email, so I have not seen the actual site that much.

Dan

Hi Dan.

Thank you for your support!

Finally, I can be rendering my PLY file.

But why my PLY file is only used by vtkPointGaussianMapper?
(Why the data has not any cells?)

Thank you :slight_smile:

Raw data that surface scanners acquire is just a point cloud (no cells). Some surface scanners come with sophisticated surface reconstruction software (that can merge surfaces, filter outliers, map texture, etc.). If you don’t have access to such software then you may try the few basic surface reconstructor filters that are available in VTK (vtkSurfaceReconstructionFilter, PoissonExtractSurface, PowercrustExtractSurface).

There are several examples that process points…Take a look at:
https://lorensen.github.io/VTKExamples/site/Cxx/#point-cloud-operations

Bill

Thank you everyone so much!

It was very helpful for me!

Thank you :slight_smile: