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

David Gobbi david.gobbi at gmail.com
Wed Mar 16 22:26:49 EDT 2016


Hi Liu Peng,

The vtkMarchingCubes algorithm is for greyscale images. Using
vtkImageThreshold before vtkMarchingCubes will give a poor result, because
the algorithm won't be able to properly interpolate the voxels to find the
best surface if it is given a binary image.

When you call SetValue(0, isovalue), make sure that "isovalue" is set to
the value that corresponds to the desired isosurface.  If you don't know
what value to use, you can start at 1000, then try 250, then 125, etc.
until you get a reasonable result.  But the best way to choose a value is
to use Otsu's method or something similar.

 - David


On Wed, Mar 16, 2016 at 7:42 PM, Liu_tj <tjlp at netease.com> wrote:

> 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 <http://www.vtk.org/Wiki/VTK/Examples/Cxx/Modelling/MarchingCubes%22.>. 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,
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160316/53e9b267/attachment.html>


More information about the vtkusers mailing list