[vtkusers] memory allocate problem of multi-iso reconstruction(large data)

Bill Lorensen bill.lorensen at gmail.com
Fri Nov 13 11:07:35 EST 2009


Wenwu,

You can reduce memory usage in the pipeline using:
vskinExtractor[numIndex]->ReleaseDataFlagOn();
vdeci[numIndex]->ReleaseDataFlagOn();
vsmoother[numIndex]->ReleaseDataFlagOn();
vskinNormal[numIndex]->ReleaseDataFlagOn();

These will release the data downstream in the pipeline. Since you are
not changing any of the filter's states, this should help.

Also, you can suppress the generation of normals and scalars by
marching cubes since you are creating new ones later in the pipeline:
vskinExtractor[numIndex]->ComputeNormalsOff();
vskinExtractor[numIndex]->ComputeGradientsOff();
vskinExtractor[numIndex]->ComputeScalarsOff();

See if these changes reduce your memory. There are other techniques
that can still be applied, but try these first.

Bill


On Fri, Nov 13, 2009 at 9:59 AM, 朱文武 <cool.wenwu at gmail.com> wrote:
> Hello all  in mailing list,
>
> The develop tool of  my application are VC6.0 + vtk5.1. And I'd  appreciate
> any advice to help me to soleve the problem.
>
> The state of mine is that when i use MC to reconstruct , and select one
> single contour value,  the number of image is 200(bmp: 329*354). of coucse ,
> the app is sucessfully executing!
> However, i'd like to reconstuct multi-isosurface. In addition, i hope the
> app can control property of each isosurface(vtkactor*). So I use
> multi-pipeline to reconstruct,each actor has private pipeline, but the
> result is error when there are many contour values ,for example the number
> of contour values is 4 , the main code and relevant information as follows:
>
> // the data set is bmp: 329*354*350
>
>     std::vector<vtkMarchingCubes*> vskinExtractor;
>     std::vector<vtkDecimatePro*> vdeci;//
>     std::vector<vtkSmoothPolyDataFilter*> vsmoother;//
>     std::vector<vtkPolyDataNormals*> vskinNormal;//
>     std::vector<vtkPolyDataMapper*> vskinMapper;//
>     std::vector<vtkActor*> vskin;
>
> //y is the number of the scalar value, here is 4
>     for (size_t numIndex = 0; numIndex < y; numIndex++)
>     {
>         vskinExtractor.push_back(vtkMarchingCubes::New());
>
> vskinExtractor[numIndex]->SetInputConnection(m_read->GetOutputPort());
>         vskinExtractor[numIndex]->SetValue(numIndex, vYuzhi[numIndex]);
>
>         vdeci.push_back(vtkDecimatePro::New());
>
> vdeci[numIndex]->SetInputConnection(vskinExtractor[numIndex]->GetOutputPort());//
>         vdeci[numIndex]->SetTargetReduction(0.5);//
>         vdeci[numIndex]->PreserveTopologyOn();//
>
>         vsmoother.push_back(vtkSmoothPolyDataFilter::New());
>
> vsmoother[numIndex]->SetInputConnection(vdeci[numIndex]->GetOutputPort());//
>         vsmoother[numIndex]->SetNumberOfIterations(800);//Specify the number
> of iterations for Laplacian smoothing
>
>         vskinNormal.push_back(vtkPolyDataNormals::New());
>
> vskinNormal[numIndex]->SetInputConnection(vsmoother[numIndex]->GetOutputPort());//
>         vskinNormal[numIndex]->SetFeatureAngle(60.0);//
>
>         vskinMapper.push_back(vtkPolyDataMapper::New());
>
> vskinMapper[numIndex]->SetInputConnection(vskinNormal[numIndex]->GetOutputPort());
>         vskinMapper[numIndex]->ScalarVisibilityOff();
>
>         vskin.push_back(vtkActor::New());
>         vskin[numIndex]->SetMapper(vskinMapper[numIndex]);
>     }
>
>
> After the app  executing  dozens of minutes, the vtkOutputWindow output
> error messages:
> Error:in c:\vtk5.0\vtk\common\vtkDataArrayTemplate.cxx line 255
> vtkIdTypeArray(0x...):unable to allocate 62300005 elements of size 2
>
> In my opinion,may be the reason  is that  data is too large or there are
> generating too many meshes while MC   extracting isosurface, but i do not
> know how to solve it!
> I alse lookup information in "VTK FAQ" in KitWare web, and the solution
> can't fit my problem. Thanks for any help!!
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list