<div>Hi, David,<br><br>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?<br><br>Thanks.<br>Liu Peng<br></div>
 <span>
 </span>
<br>      在2016-03-25,"Liu_tj" <tjlp@netease.com> 写道:
        <blockquote id="isReplyContent" style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
        -----原始邮件-----<br>
        <b>发件人:</b>"Liu_tj" <tjlp@netease.com> <br>
        <b>发送时间:</b>2016年03月25日 星期五<br>
        <b>收件人:</b>"David Gobbi" <david.gobbi@gmail.com><br>
        <b>抄送:</b>"vtkusers" <vtkusers@vtk.org><br>
        <b>主题:</b>Re: [vtkusers] High memory cost of vtkDecimatePro for 3D model generation from DICOM series<br>
<br>Hi, David,<br><br>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?<br><br>Thanks<br>Liu Peng<br><div><br><br></div>
 <span>
 </span>
<br>      在2016-03-17,"David Gobbi" <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> 写道:
        <blockquote id="isReplyContent" style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
        -----原始邮件-----<br>
        <b>发件人:</b>"David Gobbi" <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> <br>
        <b>发送时间:</b>2016年03月17日 星期四<br>
        <b>收件人:</b>"Liu_tj" <<a href="mailto:tjlp@netease.com">tjlp@netease.com</a>><br>
        <b>抄送:</b>"vtkusers" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
        <b>主题:</b>Re: [vtkusers] High memory cost of vtkDecimatePro for 3D model generation from DICOM series<br>
<br><div dir="ltr">Hi Liu Peng,<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div> - David</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 7:42 PM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi, VTK guys,<br><br>I use VTK 7.0 to generate 3D model from DICOM series. I just follow the code example from <br><pre><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Modelling/MarchingCubes%22." target="_blank">http://www.vtk.org/pipermail/vtkusers/2013-November/082109.html</a>. 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:<br><br> 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.<br><br>Any suggestions to decrease the memory cost? I only know that using vtkImageThreshold.<br>Thanks,</pre></div></blockquote></div></div></div></div>
</blockquote></blockquote><br><br><span title="neteasefooter"><p> </p></span>