Hello,
I want to enlarge a line by adding the points in each iteration, i did it like this :
vtkSmartPointer<vtkPoints> points = realTimeInsertion->getPoints();
vtkSmartPointer<vtkPolyData> poly = vtkSmartPointer<vtkPolyData>::New();
poly->SetPoints(points);
vtkIdType nbPoints = points->GetNumberOfPoints();
if(nbPoints > 1)
{
vtkSmartPointer<vtkPolyLine> polyLine = vtkSmartPointer<vtkPolyLine>::New();
polyLine->GetPointIds()->SetNumberOfIds(nbPoints);
for(int i=0; i<nbPoints; i++)
polyLine->GetPointIds()->SetId(i,i);
vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
cells->InsertNextCell(polyLine);
poly->SetLines(cells);
}
vtkMRMLModelNode::SafeDownCast(realTimeTrajectory)->SetAndObservePolyData(poly);
realTimeTrajectory->Modified();
But i got this error :
error: [/RealTimeAblation/Slicer/Slicer-SuperBuild/Slicer-build/bin/Slicer.app/Contents/MacOS/./Slicer] exit abnormally - Report the problem.
16:48:17: /RealTimeAblation/Slicer/Slicer-SuperBuild/Slicer-build/Slicer exited with code 1
How can i replace the vtkPolyData of this node ?
I have also another question, how can i delete a vtkMRMLModelNode ?
Thank you.