[vtkusers] High memory cost of vtkDecimatePro for 3D model generation from DICOM series
Liu_tj
tjlp at netease.com
Thu Mar 17 00:35:48 EDT 2016
Hi,David,
If using vtkImageThreshold before vtkMarchingCubes is not a good option, what other better way do you have?
Beside, for the isovalue, I try 2,3,4 and marched->GetNumberOfPoints() return 0, only isovalue is 1 and marched->GetNumberOfPoints() return a number greater than 0. I have no idea this is relating to the DICOM series or other problem.
Thanks.
Liu Peng
在2016-03-17,"David Gobbi" <david.gobbi at gmail.com> 写道: -----原始邮件-----
发件人:"David Gobbi" <david.gobbi at gmail.com>
发送时间:2016年03月17日 星期四
收件人:"Liu_tj" <tjlp at netease.com>
抄送:"vtkusers" <vtkusers at vtk.org>
主题:Re: [vtkusers] High memory cost of vtkDecimatePro for 3D model generation from DICOM series
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. 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/20160317/516731b5/attachment.html>
More information about the vtkusers
mailing list