VTK 7.1 issue with vtkPoints while rendering

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

VTK 7.1 issue with vtkPoints while rendering

afnanahmad
This post was updated on .
I'm reading a PointCloud data from LAS file using libLAS library into vtkPoints collection. I've verified the points in the collection to be correct, but when it is presented on the renderer, it is messing points on y axis.



As you can see points cloud is missing point between the lines. I checked these points in a 3rd party viewer and its rendering fine there.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 vtkPoints while rendering

Ken Martin
I'm guessing your cells are incorrect. You need to let us know what mapper you are using and assuming you are putting your vtkPoints into a vtkPolyData did you setup the cells correctly?

On Tue, Mar 14, 2017 at 8:03 AM, afnanahmad <[hidden email]> wrote:
I'm reading a PointCloud data from LAS file using libLAS library into
vtkPoints collection. I've verified the points in the collection to be
correct, but when it is presented on the renderer, it is messing points on y
axis.

<http://vtk.1045678.n5.nabble.com/file/n5742466/visualizer.png>

As you can see points cloud is missing point between the lines. I checked
these points in a 3rd party viewer and its rendering fine there.



--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-7-1-vtkPoints-while-rendering-tp5742466.html
Sent from the VTK - Dev 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

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers




--
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee.  Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message.  Thank you.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

afnanahmad
In reply to this post by afnanahmad
Here is the code I'm using, not sure which step is wrong.

vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> cell = vtkCellArray::New();

for (size_t i = 0; i < point_cloud->points.size(); i++)
{

        double point[3] = { point_cloud->points[i].x,
                point_cloud->points[i].y,
                point_cloud->points[i].z };

        vtkIdType id = points->InsertNextPoint(point);

        cell->InsertNextCell(1);
        cell->InsertCellPoint(id);
}

vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
polyData->SetPoints(points);
polyData->SetVerts(cell);

vtkSmartPointer<vtkVertexGlyphFilter> glyphFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();
glyphFilter->SetInputData(polyData);
glyphFilter->Update();

vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(glyphFilter->GetOutputPort());

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


for some of the files this code is working fine.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

Ken Martin
Looks fine to me except that you can yank the vertexglyph as it is not doing anything for you. The polydata can go directly into the mapper.  Maybe your points have a really large values and you are running into floating point issues. Look at the bounds on your points.  Could be something else but the basic code looks OK to me.

On Tue, Mar 14, 2017 at 9:11 AM, afnanahmad <[hidden email]> wrote:
Here is the code I'm using, not sure which step is wrong.

vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> cell = vtkCellArray::New();

for (size_t i = 0; i < point_cloud->points.size(); i++)
{

        double point[3] = { point_cloud->points[i].x,
                point_cloud->points[i].y,
                point_cloud->points[i].z };

        vtkIdType id = points->InsertNextPoint(point);

        cell->InsertNextCell(1);
        cell->InsertCellPoint(id);
}

vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
polyData->SetPoints(points);
polyData->SetVerts(cell);

vtkSmartPointer<vtkVertexGlyphFilter> glyphFilter =
vtkSmartPointer<vtkVertexGlyphFilter>::New();
glyphFilter->SetInputData(polyData);
glyphFilter->Update();

vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(glyphFilter->GetOutputPort());

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


for some of the files this code is working fine.




--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-7-1-issue-with-vtkPoints-while-rendering-tp5742466p5742468.html
Sent from the VTK - Dev 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

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers




--
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee.  Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message.  Thank you.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

afnanahmad
This is the info for file I extracted from a tool. Can you please point out the issue here?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

Ken Martin
Yeh, it is a data issue, large values but small deltas. You need to center your data using a transform filter (or in your code when creating it).



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

afnanahmad
the points are being added to vtkPoints collection as double. I think double should hold those points?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

afnanahmad
I was wondering if there is a way I can set the vtkPolyDataMappe's Precision to double?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

afnanahmad
In reply to this post by Ken Martin
I've scaled my point cloud using the transform filter but output still remains the same, I just have 10 points in my Point Cloud and renderer window flickers while interacting it with mouse.

Before applying transform filter
xMin = 289814.15
xMax = 289818.5

yMin = 4320978.61
yMax = 4320980.59

zMin = 170.58
zMax = 170.76


After applying transform filter Scale(0.01, 0.01, 0.01)
xMin = 2898.1415
xMax = 2898.185

yMin = 43209.786100000005
yMax = 43209.8059

zMin = 1.7058000000000002
zMax = 1.7076


I've also attached one of the file here for which I'm having issue while rendering the Point Cloud.
points.xyz
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

Ken Martin
The issue is the translation. Not the scale. Find the center of your data and translate by negative that amount. Give that a shot

Sent from my iPhone

> On Mar 18, 2017, at 7:52 PM, afnanahmad <[hidden email]> wrote:
>
> I've scaled my point cloud using the transform filter but output still
> remains the same, I just have 10 points in my Point Cloud and renderer
> window flickers while interacting it with mouse.
>
> Before applying transform filter
> /xMin = 289814.15
> xMax = 289818.5
>
> yMin = 4320978.61
> yMax = 4320980.59
>
> zMin = 170.58
> zMax = 170.76/
>
> After applying transform filter Scale(0.01, 0.01, 0.01)
> /xMin = 2898.1415
> xMax = 2898.185
>
> yMin = 43209.786100000005
> yMax = 43209.8059
>
> zMin = 1.7058000000000002
> zMax = 1.7076/
>
> I've also attached one of the file here for which I'm having issue while
> rendering the Point Cloud.
> points.xyz <http://vtk.1045678.n5.nabble.com/file/n5742515/points.xyz>  
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/VTK-7-1-issue-with-vtkPoints-while-rendering-tp5742466p5742515.html
> Sent from the VTK - Dev 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
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

afnanahmad
I tried finding the center using Center Of Mass Filter, and translated as you mentioned. Doing that renderer did stop flickering on mouse events but the out is still the same.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK 7.1 issue with vtkPoints while rendering

afnanahmad
This issue is fixed now. Sorry I forgot the set the data type of vtkPoints to Double. Thank you for your support! :)
Loading...