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

朱文武 cool.wenwu at gmail.com
Sat Nov 14 03:24:48 EST 2009


Hello Steiner ,thank you  very much at first! If my undestanding is
right,your code may be very suitable to catch exception! I will learn it !
However, the key problem of my app  may not the bug, but how to manage
memory more efficiently !



2009/11/14 Dipl.-Ing. Helmut Steiner <office at shl.at>

>  Hello user cool.wenwu!
>
>
>
> You are low on memory, try to encapsulate vtk calls with try catch blocks.
>
>
>
> Something like this:
>
>
>
>       CDlgBAPMessageWarn dlgwarn;
>
>       try
>
>       {
>
>             m_p3DRSurfExtractor->SetInput(pexVoi->GetOutput());
>
>             //m_p3DRSurfExtractor->GenerateValues(2, contourRange);
>
>             m_p3DRSurfExtractor->SetValue(0,(double) surfpegel);
>
>             //m_p3DRSurfExtractor->SetValue(0, dval-0.5);
>
>             m_p3DRSurfExtractor->ComputeScalarsOff();
>
>             m_p3DRSurfExtractor->ComputeNormalsOn();
>
>             VtkObserverProgressContour *contourProgress =
> VtkObserverProgressContour::New(pParentVolume->m_p3DRStatusText->GetTextMapper(),
> pParentVolume->m_p3DRIren, "Contour Progress");
>
>             m_p3DRSurfExtractor->AddObserver(vtkCommand::ProgressEvent,
> contourProgress);
>
>             contourProgress->Delete();
>
>             m_p3DRSurfExtractor->Update();
>
>       }
>
>       catch (std::exception const &err)
>
>       {
>
>             dlgwarn.mstrHeader = CConstTxt::BAP_MSG_HEAD_054
> [theApp.iLanguage];
>
>             dlgwarn.mstrLine1  = CConstTxt::BAP_MSG_LIN1_054
> [theApp.iLanguage];
>
>             dlgwarn.mstrLine2  = CConstTxt::BAP_MSG_LIN2_054
> [theApp.iLanguage];
>
>             dlgwarn.DoModal();
>
>             pexVoi->Delete();
>
>             return false;
>
>       }
>
>       catch (...)
>
>       {
>
>             dlgwarn.mstrHeader = CConstTxt::BAP_MSG_HEAD_054
> [theApp.iLanguage];
>
>             dlgwarn.mstrLine1  = CConstTxt::BAP_MSG_LIN1_054
> [theApp.iLanguage];
>
>             dlgwarn.mstrLine2  = CConstTxt::BAP_MSG_LIN2_054
> [theApp.iLanguage];
>
>             dlgwarn.DoModal();
>
>             pexVoi->Delete();
>
>             return false;
>
>       }
>
>       pexVoi->Delete();
>
>
>
>
>
> Mfg
>
> Helmut Steiner
>
>
>
>
>
> [image: cid:image001.jpg at 01C9D5CC.9F177890]
>
> *********************************************************
> * SHL - Solutions for Healthcare and Life-Sciences GmbH *
> * Bahnstraße 58,  A-3481 Fels am Wagram,  Österreich    *
> * Firmenbuch Nr.: 276073 s                              *
> * Web:   www.shl.at                                     *
> * Email: office at shl.at                                  *
> *********************************************************
> * DISCLAIMER                                            *
> * This eMail may contain confidential and/or            *
> * privileged information. If you are not the            *
> * intended recipient (or have received this eMail       *
> * in error) please notify the sender immediately        *
> * and destroy this eMail. Any unauthorised              *
> * copying, disclosure or distribution of the            *
> * material in this eMail is strictly forbidden.         *
> *********************************************************
>
>
>
> *Von:* vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] *Im
> Auftrag von *???
> *Gesendet:* Freitag, 13. November 2009 16:00
> *An:* vtkusers at vtk.org
> *Betreff:* [vtkusers] memory allocate problem of multi-iso
> reconstruction(large data)
>
>
>
> 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!!
>



-- 
祝
工作愉快,身体健康!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091114/a42e03b0/attachment.htm>


More information about the vtkusers mailing list