Hello Steiner <span dir="ltr">,</span>thank you <span dir="ltr"></span>very much at first! If my undestanding is right,your code may be very suitable to catch exception! I will learn it !<br>However, the key problem of my app may not the bug, but how to manage memory more efficiently !<br>
<br><br><br><div class="gmail_quote">2009/11/14 Dipl.-Ing. Helmut Steiner <span dir="ltr"><<a href="mailto:office@shl.at">office@shl.at</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="DE-AT">
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Hello user cool.wenwu!</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">You are low on memory, try to encapsulate vtk calls with try
catch blocks.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Something like this:</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> CDlgBAPMessageWarn dlgwarn;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">try</span> </span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> </span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US">{</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> m_p3DRSurfExtractor->SetInput(pexVoi->GetOutput());</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> <span style="color: green;">//m_p3DRSurfExtractor->GenerateValues(2, contourRange);</span></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> m_p3DRSurfExtractor->SetValue(0,(<span style="color: blue;">double</span>) surfpegel);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> <span style="color: green;">//m_p3DRSurfExtractor->SetValue(0, dval-0.5);</span></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> m_p3DRSurfExtractor->ComputeScalarsOff();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> m_p3DRSurfExtractor->ComputeNormalsOn();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> VtkObserverProgressContour
*contourProgress =
VtkObserverProgressContour::New(pParentVolume->m_p3DRStatusText->GetTextMapper(),
pParentVolume->m_p3DRIren, <span style="color: rgb(163, 21, 21);">"Contour
Progress"</span>);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> m_p3DRSurfExtractor->AddObserver(vtkCommand::ProgressEvent,
contourProgress);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> contourProgress->Delete();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> m_p3DRSurfExtractor->Update();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> <span style="color: blue;">catch</span> (std::exception <span style="color: blue;">const</span>
&err)</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.mstrHeader
= CConstTxt::BAP_MSG_HEAD_054 [theApp.iLanguage];</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.mstrLine1
= CConstTxt::BAP_MSG_LIN1_054 [theApp.iLanguage];</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.mstrLine2
= CConstTxt::BAP_MSG_LIN2_054 [theApp.iLanguage];</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.DoModal();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> pexVoi->Delete();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> <span style="color: blue;">return</span> <span style="color: blue;">false</span>;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> <span style="color: blue;">catch</span> (...)</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.mstrHeader
= CConstTxt::BAP_MSG_HEAD_054 [theApp.iLanguage];</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.mstrLine1
= CConstTxt::BAP_MSG_LIN1_054 [theApp.iLanguage];</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.mstrLine2
= CConstTxt::BAP_MSG_LIN2_054 [theApp.iLanguage];</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> dlgwarn.DoModal();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> pexVoi->Delete();</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> <span style="color: blue;">return</span> <span style="color: blue;">false</span>;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-US"> </span><span style="font-size: 10pt; font-family: "Courier New";">}</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> pexVoi->Delete();</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Mfg</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">Helmut Steiner</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: black;"><img src="" alt="cid:image001.jpg@01C9D5CC.9F177890" height="45" width="207"></span><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span></p>
<p class="MsoNormal"><span style="font-size: 8pt; font-family: "Courier New"; color: rgb(31, 73, 125);" lang="EN-GB">*********************************************************<br>
* SHL - Solutions for Healthcare and Life-Sciences GmbH *<br>
* Bahnstraße 58, A-3481 Fels am Wagram,
Österreich *<br>
* Firmenbuch Nr.: 276073 s
*<br>
* Web:</span><span style="font-size: 8pt; font-family: "Courier New"; color: maroon;" lang="EN-GB"> </span><span style="font-size: 8pt; font-family: "Courier New"; color: black;" lang="EN-GB"> </span><span style="font-size: 8pt; font-family: "Courier New"; color: black;" lang="DE"><a href="http://www.shl.at/" title="blocked::http://www.shl.at/" target="_blank"><span style="color: blue;" lang="EN-GB">www.shl.at</span></a></span><span style="font-size: 8pt; font-family: "Courier New"; color: rgb(31, 73, 125);" lang="EN-GB">
*<br>
* </span><span style="font-size: 8pt; font-family: "Courier New"; color: black;" lang="EN-GB">Email: </span><span style="font-size: 8pt; font-family: "Courier New"; color: black;" lang="DE"><a href="mailto:office@shl.at" title="blocked::mailto:office@shl.at" target="_blank"><span style="color: blue;" lang="EN-GB">office@shl.at</span></a></span><span style="font-size: 8pt; font-family: "Courier New"; color: black;" lang="EN-GB">
*<br>
*********************************************************</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><br>
</span><span style="font-size: 8pt; font-family: "Courier New"; color: black;" lang="EN-GB">* DISCLAIMER
*<br>
* This eMail may contain confidential and/or *<br>
* privileged information. If you are not the *<br>
* intended recipient (or have received this eMail *<br>
* in error) please notify the sender immediately *<br>
* and destroy this eMail. Any
unauthorised *<br>
* copying, disclosure or distribution of the *<br>
* material in this eMail is strictly forbidden. </span><span style="font-size: 8pt; font-family: "Courier New"; color: black;" lang="DE">*<br>
*********************************************************</span><span style="color: black;" lang="DE"></span></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 10pt;" lang="DE">Von:</span></b><span style="font-size: 10pt;" lang="DE">
<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a> [mailto:<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a>] <b>Im Auftrag von </b>???<br>
<b>Gesendet:</b> Freitag, 13. November 2009 16:00<br>
<b>An:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Betreff:</b> [vtkusers] memory allocate problem of multi-iso
reconstruction(large data)</span></p>
</div><div><div></div><div class="h5">
<p class="MsoNormal"> </p>
<p class="MsoNormal">Hello all in mailing list,<br>
<br>
The develop tool of my application are VC6.0 + vtk5.1. And I'd
appreciate any advice to help me to soleve the problem.<br>
<br>
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!<br>
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:<br>
<br>
// the data set is bmp: 329*354*350<br>
<br>
std::vector<vtkMarchingCubes*> vskinExtractor;<br>
std::vector<vtkDecimatePro*> vdeci;//<br>
std::vector<vtkSmoothPolyDataFilter*> vsmoother;//<br>
std::vector<vtkPolyDataNormals*> vskinNormal;//<br>
std::vector<vtkPolyDataMapper*> vskinMapper;//<br>
std::vector<vtkActor*> vskin;<br>
<br>
//y is the number of the scalar value, here is 4<br>
for (size_t numIndex = 0; numIndex < y; numIndex++)<br>
{<br>
vskinExtractor.push_back(vtkMarchingCubes::New());<br>
vskinExtractor[numIndex]->SetInputConnection(m_read->GetOutputPort());<br>
vskinExtractor[numIndex]->SetValue(numIndex, vYuzhi[numIndex]);<br>
<br>
vdeci.push_back(vtkDecimatePro::New());<br>
vdeci[numIndex]->SetInputConnection(vskinExtractor[numIndex]->GetOutputPort());//<br>
vdeci[numIndex]->SetTargetReduction(0.5);//<br>
vdeci[numIndex]->PreserveTopologyOn();//<br>
<br>
vsmoother.push_back(vtkSmoothPolyDataFilter::New());<br>
vsmoother[numIndex]->SetInputConnection(vdeci[numIndex]->GetOutputPort());//<br>
vsmoother[numIndex]->SetNumberOfIterations(800);//Specify the number of
iterations for Laplacian smoothing<br>
<br>
vskinNormal.push_back(vtkPolyDataNormals::New());<br>
vskinNormal[numIndex]->SetInputConnection(vsmoother[numIndex]->GetOutputPort());//<br>
vskinNormal[numIndex]->SetFeatureAngle(60.0);//<br>
<br>
vskinMapper.push_back(vtkPolyDataMapper::New());<br>
vskinMapper[numIndex]->SetInputConnection(vskinNormal[numIndex]->GetOutputPort());<br>
vskinMapper[numIndex]->ScalarVisibilityOff();<br>
<br>
vskin.push_back(vtkActor::New());<br>
vskin[numIndex]->SetMapper(vskinMapper[numIndex]);
<br>
}<br>
<br>
<br>
After the app executing dozens of minutes, the vtkOutputWindow
output error messages:<br>
Error:in c:\vtk5.0\vtk\common\vtkDataArrayTemplate.cxx line 255<br>
vtkIdTypeArray(0x...):unable to allocate 62300005 elements of size 2<br>
<br>
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!<br>
I alse lookup information in "VTK FAQ" in KitWare web, and the
solution can't fit my problem. Thanks for any help!!<br clear="all">
</p>
</div></div></div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br>祝<br>工作愉快,身体健康!<br>