Hi Matt,
I suggest you to write your own "FastPointSetVtkMapper3D". It should be quite
easy to do so. Here are some tricks to really speed things up:
1. Create only one vtkPoints, vtkCellArray, vtkPolyData, vtkPolyDataMapper,
vtkActor and don't do it in every frame. That's a one shot initialization.
2. Prefer the SetData() method of vtkPoints and hence create a vtkFloatArray
(or vtkDoubleArray) during initialization as well. You can tell the
vtkFloatArray to use your point-array without copying it.
Pseudo-code:
vector<Point> points; // Your point list
vtkFloatArray->SetNumberOfComponents(3)
vtkFloatArray->SetArray(&points[0], points.size() * 3, 1); // 1 means VTK does
not free your array
vtkPoints->SetData(vtkFloatArray);
3. You can also pre-generate your vtkCellArray during initialization (and
extend it on-the-fly if necessary):
vector<vtkIdType> m_Indices;
m_Indices.reserve(2000000);
for (i = 0; i < 1000000; ++i)
{
m_Indices.push_back(1);
m_Indices.push_back(i);
}
Usage is like this:
vtkIdTypeArray->SetArray(&m_Indices[0], points.size() * 2, 1);
vtkCellArray->SetCells(points.size(), vtkIdTypeArray);
4. Create the VTK-pipeline
vtkPolyData->SetPoints(vtkPoints);
vtkPolyData->SetVerts(vtkCellArray);
vtkPolyDataMapper->SetInputConnection(0, vtkPolyData->GetProducerPort());
vtkActor->SetMapper(vtkPolyDataMapper);
5. You can set point size through the properties of the vtkActor:
vtkActor->GetProperty()->SetPointSize(pointSize);
This is very fast and you should be able to render millions of points at a very
high frame rate. Maybe you can even get VTK to render your points without the
need of indices... Should be possible somehow I guess.
The points are rendered as squares which is kind of ugly. Solution: Add
mitkWorkbench to your AMD/NVidia application profiles and enable MSAA.
Best,
Stefan
-----Ursprüngliche Nachricht-----
Von: Clarkson, Matt [mailto:[email protected]]
Gesendet: Mittwoch, 8. Mai 2013 15:15
An: Engelhardt, Sandy
Cc: mitk-users
Betreff: Re: [mitk-users] Bug 14890: Very Slow Rendering of PointSets
Please can you remind me.. when was the ITKv4 commit?
Is it possible to upgrade MITK to include 8150+14932, without ITKv4?
However, I suspect that the problem also lies with the fact that for each point
a sphere is rendered, and the resolution is set to 20 in both latitude and
longitude.
Is there any way to litterally just render a single point for each point in the
point set?
We are using 2 million points, and 2 million spheres is a bit ... optimistic.
:-)
Thanks
M
On 8 May 2013, at 13:42, "Engelhardt, Sandy"
<[email protected]>
wrote:
> Dear Matt,
> the bug, which occurred in the latest release, has been fixed within the
> scope of bug 8150. The merge of "GenerateDataForRenderer" and "GenerateData"
> methods caused performance issues in a couple of other mappers too (see bug
> 14932).
>
> Please let us know whether you still have problems with rendering large
> pointsets.
>
> Kind regards,
>
> Sandy
>
> -----Ursprüngliche Nachricht-----
> Von: Clarkson, Matt [mailto:[email protected]]
> Gesendet: Mittwoch, 8. Mai 2013 14:13
> An: mitk-users
> Betreff: [mitk-users] Bug 14890: Very Slow Rendering of PointSets
>
> Hi there,
>
> Does anyone have an update on this:
> http://bugs.mitk.org/show_bug.cgi?id=14890
>
> We are running into a problem rendering large pointsets, and so would be
> REALLY interested to know if anyone had taken a look at this, or had
> suggestions.
>
> Thanks
>
> Matt
>
>
>
> ----------------------------------------------------------------------
> -------- Learn Graph Databases - Download FREE O'Reilly Book "Graph
> Databases" is the definitive new guide to graph databases and their
> applications. This 200-page book is written by three acclaimed leaders in the
> field. The early access version is available now.
>
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the
definitive new guide to graph databases and their applications. This 200-page
book is written by three acclaimed leaders in the field. The early access
version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users