[vtkusers] High memory cost of vtkDecimatePro for 3D model generation from DICOM series

Liu_tj tjlp at netease.com
Wed Mar 16 21:42:07 EDT 2016


Hi, VTK guys,

I use VTK 7.0 to generate 3D model from DICOM series. I just follow the code example from

http://www.vtk.org/pipermail/vtkusers/2013-November/082109.html. When I try to reduce the number of triangles by vtkDecimatePro, the Visual Studio 2015 monitor shows that the memory jump to over 10G and my computer has no response, I have to restart my computer rudely. See my code below, with my DICOM series, the marched->GetNumberOfPoints() return more than 20 millions:

   vtkSmartPointer<vtkMarchingCubes> surface = vtkSmartPointer<vtkMarchingCubes>::New();
  surface->SetInputData(volume);
  surface->ComputeNormalsOn();
  surface->ComputeScalarsOn();
  surface->SetValue(0, 1);

  // Create polydata from iso-surface
  vtkSmartPointer<vtkPolyData> marched = vtkSmartPointer<vtkPolyData>::New();
  surface->Update();
  marched->DeepCopy(surface->GetOutput());
  std::cout<<"Number of points: " << marched->GetNumberOfPoints() << std::endl;
  
  // Decimation to reduce the number of triangles
  vtkSmartPointer<vtkDecimatePro> decimator = vtkDecimatePro::New();
  decimator->SetInputData(marched);
  decimator->SetTargetReduction(0.5);
  decimator->SetPreserveTopology(1);
  decimator->Update(); <------------------memory cost jumps to more than 10G.

Any suggestions to decrease the memory cost? I only know that using vtkImageThreshold.
Thanks,
Liu Peng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160317/7826aaf8/attachment.html>


More information about the vtkusers mailing list