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

朱文武 cool.wenwu at gmail.com
Sat Nov 14 04:25:19 EST 2009


Hello Bill,

         thank you very much ! In fact, the solution you metioned i once
tested, but i set the flag
of vtkBMPReader object. The relevant code as follows:

vtkBMPReader * m_read = vtkBMPReader::New();
......
this->m_read->GetOutput()->GlobalReleaseDataFlagOn();

I set the “global flag” instead of “object flag“ due to the explanation in
the VTK FAQ:

if GlobalReleaseDataFlag is set on ANY data object, all data objects will
release their memory once their dependent filter has finished executing.

The result you can guess the  there was nothing in the render window. So i
thought the solution can't work,then i turened to mail list for help !.....
Just now I take your idea for practice, and the performance of app improved
greatly. I can gain satisfied result when the data set is 329*354*350, and
the number of contour values is three. But  when the data set is
329*354*500, and the number of contour values increased to
8,the memory error is appearing again.
Now i have no idea to  improve the app further. In short, my problem is as
follows:
1、How to manage memory when the data is *augment*ing?for
example:329*354*500,and contour value is 8 or more。
2、May be my architecture of generating multi-actor is not suitable, could
any one provide more efficient code or idea to help me?

Additional ,there is 8 GB physical memory and 4 processors in workstation!

Thanks All!


2009/11/14 Bill Lorensen <bill.lorensen at gmail.com>

> 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091114/d7abd15c/attachment.htm>


More information about the vtkusers mailing list