[vtkusers] High memory cost of vtkDecimatePro for 3D model generation from DICOM series
David Gobbi
david.gobbi at gmail.com
Fri Apr 1 15:41:45 EDT 2016
Hi Liu,
For a volume of that size, I'd guess an STL file size of around 150MB for a
smooth surface, so 520MB for a "rough" surface seems reasonable. As I
mentioned in my previous email, if vtkDecimatePro is running out of memory,
you can try reducing the resolution of the image before running marching
cubes.
- David
On Wed, Mar 30, 2016 at 7:45 AM, Liu_tj <tjlp at netease.com> wrote:
> Hi, David,
>
> I follow your advice and use the original vtkImageData for
> vtkMarchingCubes, and the isovalue is 1000. Then I try to save the
> generated 3D volume to stl file. For a 512*512*190 chest CT DICOM series,
> the STL file is about 520M. Do you think the file size is rather bigger?
>
> Thanks.
> Liu Peng
>
> 在2016-03-25,"Liu_tj" <tjlp at netease.com> 写道:
>
> -----原始邮件-----
> *发件人:*"Liu_tj" <tjlp at netease.com>
> *发送时间:*2016年03月25日 星期五
> *收件人:*"David Gobbi" <david.gobbi at gmail.com>
>
> *抄送:*"vtkusers" <vtkusers at vtk.org>
> *主题:*Re: [vtkusers] High memory cost of vtkDecimatePro for 3D model
> generation from DICOM series
>
> Hi, David,
>
> Continue this thread. For the 3D model generation, we have a preview
> function. That means we need quick 3D model generation speed and don't need
> high model precision. Only when really generating, we need a good 3D model
> quality. So, for the preview, how to accelerate the generation speed?
>
> 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 <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/20160401/0578538b/attachment.html>
More information about the vtkusers
mailing list