[vtkusers] Surface Rendering from point set.

Cory Quammen cory.quammen at kitware.com
Mon Nov 21 09:59:09 EST 2016


Alex,

vtkPolyDataNormals doesn't do any kind of normal estimation for vertex
cells. It works only for cell types that connect 3 or more points.

Will, is there anything you've been working on lately that can do
normal estimation for point clouds representing surfaces?

Thanks,
Cory

On Mon, Nov 21, 2016 at 3:36 AM, Alex Liu via vtkusers <vtkusers at vtk.org> wrote:
> Hello World!
> I'm working on a project in which I'm given DICOM files. I've extracted the
> DICOM images to openCV.
> From openCV I've extracted Points for each DICOM Image/Slice. I'm trying to
> construct a 3D view of the detected face Points. As I'm new to VTK I'm
> facing some problems.
>
> I've Points(x,y,z) for all the images right now. and I can display the
> points on the screen, please see the attachment.
>
> Point Cloud Face
> <http://vtk.1045678.n5.nabble.com/file/n5741245/Point_Cloud_Face.png>
>
> Right now I want to calculate Normals for all the points with Normals facing
> out from the face. In MeshLab there is a function to calculate Normals for
> points set. And i get this result
>
> MeshLab Point set Normals
> <http://vtk.1045678.n5.nabble.com/file/n5741245/MeshLab_Points_With_Normals.png>
>
> My Code.
>
> vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
> polyData->SetPoints(vtkPts);  // vtkPts contains all the points in x, y, z
> of the face.
>
> vtkSmartPointer<vtkVertexGlyphFilter> glyphFilter =
> vtkSmartPointer<vtkVertexGlyphFilter>::New();
> glyphFilter->SetInputData(polyData);
> glyphFilter->Update();
>
> // Im not sure here if Im using the right function to calculate Points
> Normals
> // But I get the same output in blue as in attached image
> MeshLab_Points_With_Normals.png
> vtkSmartPointer<vtkPolyDataNormals> polyDataNormals =
> vtkSmartPointer<vtkPolyDataNormals>::New();
> polyDataNormals->SetInputConnection(glyphFilter->GetOutputPort());
> polyDataNormals->FlipNormalsOff();
> polyDataNormals->ComputePointNormalsOn();
> polyDataNormals->Update();
>
>
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInputConnection(glyphFilter->GetOutputPort());
>
>
> // Display image
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInputConnection(glyphFilter->GetOutputPort());
>
> vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
> actor->SetMapper(mapper);
> actor->GetProperty()->SetColor(0.0, 0.0, 0.9); //(R,G,B)
>
> vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
> renderer->AddActor(actor);
> renderer->SetBackground(0.9, 0.9, 0.9); // Background color Gray
>
> vtkSmartPointer<vtkRenderWindow> renderWindow =
> vtkSmartPointer<vtkRenderWindow>::New();
> renderWindow->AddRenderer(renderer);
> renderWindow->SetPosition(400, 200);
> renderWindow->SetSize(612, 612);
>
> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
> vtkSmartPointer<vtkRenderWindowInteractor>::New();
> renderWindowInteractor->SetRenderWindow(renderWindow);
> renderWindowInteractor->Start();
>
>
> I'm trying to get output like in MeshLab, with a smooth surface.
> Help will be really appreciated.
>
> Thank you.
> Alex
>
>
>
> -----
> Alex Liu
> +15574855474
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Surface-Rendering-from-point-set-tp5741245.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list