Von: "Kilgus, Thomas" <t.kil...@dkfz-heidelberg.de>
An: "Ingmar Wegner" <iweg...@gmx.de>, "Mitk Users" <mitk-users@lists.sourceforge.net>
Betreff: RE: [mitk-users] Visualization of Point Clouds?
Hi Ingmar,
I think you are doing everything fine. I wanted to do the same and it took me a while to realize that VTK needs the vertices and does nothing without the IDs. The representation property only affects a complete polydata with polys, vertices and points. For our ToF surfaces, we also disable the 2D rendering of the surfaces for performance reasons. But I never saw a crash. Is it just a single polydata or is the continuously rendered data? Could you provide the data causing the crash? We are currently working on the integration of a faster mapper into open source part.
Regards,
Thomas
Thomas Kilgus
German Cancer Research Center (DKFZ)
Div. Medical and Biological Informatics
Junior group: Computer-assisted Interventions (E131)
Im Neuenheimer Feld 280
69120 Heidelberg, Germany
Phone: +49(0) 6221-42-3545
From: Ingmar Wegner [mailto:iweg...@gmx.de]
Sent: Donnerstag, 3. April 2014 13:00
To: Mitk Users
Subject: [mitk-users] Visualization of Point Clouds?
Hi list,
I am trying to visualize a point cloud (>1000 points) that is increasing over time (recording tracking positions).
I didn't choose using mitk::PointSets as rendering performance quickly falls below regular FPS requirements.
So I tried using a mitk::Surface and setting up a vtkPolyData by initially calling:
_surface->SetVtkPolyData(vtkSmartPointer<vtkPolyData>::New());
_surface->GetVtkPolyData()->SetPoints(vtkSmartPointer<vtkPoints>::New());
_surface->GetVtkPolyData()->SetVerts(vtkSmartPointer<vtkCellArray>::New());
During recording of the positions I do:
//first, a point has to be added to the polydata
vtkIdType pid[1];
pid[0] = polyData->GetPoints()->InsertNextPoint(
vtkTrans->GetElement(0, 3),
vtkTrans->GetElement(1, 3),
vtkTrans->GetElement(2, 3));
vtkSmartPointer<vtkCellArray> verts = polyData->GetVerts();
verts->InsertNextCell ( 1 , pid);
polyData->Modified();
So I have to set the points array and the cell array. Otherwise the points won't be shown.
I even tried to set the material properties of the Surface node to explicitly showing points by:
surfaceNode->SetProperty("material.representation", mitk::VtkRepresentationProperty::New("Points"));
and then only setting the points, but this way the points weren't drawn.
So I set the cells and this causes an exception in the vtkCutter in line 570 once GlobalReinit is called for the second time!!!
At this code location the widget planes try to cut the sourface (point cloud) into a 2D slice during rendering. (StdMultiWidgets shows Big3D crosshair is disabled).
The cutter goes through the list of cells and usually receives cellType = 1 (the first parameter that I set when calling InsertNextCell).
Lets say I record X number of positions ( = no. points and cells in the surface).
Now I click onto GlobalReinit. Everything is fine.
I continue to record points and call GlobalReinit again.
Now vtkCutter runs into an error in line 570 because at index X+1 the cellType is 253 and not 1!
After a few times of throwing the error the applicaton crashes.
So I assume that through GlobalReinit the SurfaceMapper does anything to the vtkPolyData so I can't keep on recording.
When I disable 2D rendering with:
node->SetVisibility(false, mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget1")));
node->SetVisibility(false, mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget2")));
node->SetVisibility(false, mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget3")));
the error is solved, but this shouldn't be the proper solution, right?
Is there a different solution to this?
In the IGT section I din't find any sample code for using a vtkPolyData for recording.
Here everything is implemented with mitk::PointSets.
Is there a better mapper by now for rapid visualization of changing point sets?
below is the call stack when calling the error in vtkCutter line 570.
So disabling 2D rendering is ok, so far, but there should be a better way, right?
Best Regards and keep up the great work!
Ingmar
--------------------------------------
> vtkGraphics.dll!vtkCutter::DataSetCutter(vtkDataSet * input=0x000000000792da30, vtkPolyData * output=0x0000000007cceee0) Line 572 C++
vtkGraphics.dll!vtkCutter::RequestData(vtkInformation * request=0x0000000007cc4860, vtkInformationVector * * inputVector=0x0000000007ccdd30, vtkInformationVector * outputVector=0x0000000007ccdb80) Line 381 C++
vtkFiltering.dll!vtkPolyDataAlgorithm::ProcessRequest(vtkInformation * request=0x0000000007cc4860, vtkInformationVector * * inputVector=0x0000000007ccdd30, vtkInformationVector * outputVector=0x0000000007ccdb80) Line 91 + 0x22 bytes C++
vtkGraphics.dll!vtkCutter::ProcessRequest(vtkInformation * request=0x0000000007cc4860, vtkInformationVector * * inputVector=0x0000000007ccdd30, vtkInformationVector * outputVector=0x0000000007ccdb80) Line 1123 C++
vtkFiltering.dll!vtkExecutive::CallAlgorithm(vtkInformation * request=0x0000000007cc4860, int direction=1, vtkInformationVector * * inInfo=0x0000000007ccdd30, vtkInformationVector * outInfo=0x0000000007ccdb80) Line 747 + 0x39 bytes C++
vtkFiltering.dll!vtkDemandDrivenPipeline::ExecuteData(vtkInformation * request=0x0000000007cc4860, vtkInformationVector * * inInfo=0x0000000007ccdd30, vtkInformationVector * outInfo=0x0000000007ccdb80) Line 507 + 0x2d bytes C++
vtkFiltering.dll!vtkDemandDrivenPipeline::ProcessRequest(vtkInformation * request=0x0000000007cc4860, vtkInformationVector * * inInfoVec=0x0000000007ccdd30, vtkInformationVector * outInfoVec=0x0000000007ccdb80) Line 279 + 0x22 bytes C++
vtkFiltering.dll!vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation * request=0x0000000007cc4860, vtkInformationVector * * inInfoVec=0x0000000007ccdd30, vtkInformationVector * outInfoVec=0x0000000007ccdb80) Line 276 + 0x25 bytes C++
vtkFiltering.dll!vtkDemandDrivenPipeline::UpdateData(int outputPort=0) Line 450 C++
vtkFiltering.dll!vtkStreamingDemandDrivenPipeline::Update(int port=0) Line 326 + 0x1e bytes C++
vtkFiltering.dll!vtkExecutive::Update() Line 315 + 0x15 bytes C++
vtkFiltering.dll!vtkDemandDrivenPipeline::Update() Line 313 C++
vtkFiltering.dll!vtkStreamingDemandDrivenPipeline::Update() Line 307 C++
vtkFiltering.dll!vtkAlgorithm::Update() Line 1287 C++
Mitk.dll!mitk::SurfaceGLMapper2D::Paint(mitk::BaseRenderer * renderer=0x0000000004864960) Line 289 C++
Mitk.dll!mitk::GLMapper::MitkRender(mitk::BaseRenderer * renderer=0x0000000004864960, mitk::VtkPropRenderer::RenderType type=Opaque) Line 44 C++
Mitk.dll!mitk::VtkPropRenderer::Render(mitk::VtkPropRenderer::RenderType type=Opaque) Line 207 + 0x23 bytes C++
Mitk.dll!vtkMitkRenderProp::RenderOpaqueGeometry(vtkViewport * __formal=0x000000000487f510) Line 49 C++
vtkRendering.dll!vtkRenderer::UpdateGeometry() Line 630 + 0x41 bytes C++
vtkRendering.dll!vtkOpenGLRenderer::DeviceRender() Line 250 C++
vtkRendering.dll!vtkRenderer::Render() Line 352 C++
vtkRendering.dll!vtkRendererCollection::Render() Line 53 C++
vtkRendering.dll!vtkRenderWindow::DoStereoRender() Line 726 C++
vtkRendering.dll!vtkRenderWindow::DoFDRender() Line 694 C++
vtkRendering.dll!vtkRenderWindow::DoAARender() Line 581 C++
vtkRendering.dll!vtkRenderWindow::Render() Line 394 C++
Mitk.dll!mitk::RenderingManager::ForceImmediateUpdate(vtkRenderWindow * renderWindow=0x000000000485ad10) Line 297 C++
Mitk.dll!mitk::RenderingManager::ExecutePendingRequests() Line 680 C++
...
------------------------------------------------------------------------------
_______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users