<div class="gmail_quote">Dear bill and all,<br><span><br>I have sent this message last night ! However, no one responded! So i sent it again. I hope vtk users can forgive me if it disturbed you!<br>The problem of mine is that when i use vtkDiscreteMarchingCubes to extract multi-iso surfaces , the number of scalar value sometimes is more than ten and vtk will report error. The error message likes that:<br>


</span><span>Error:in c:\vtk5.0\vtk\common\vtkDataArrayTemplate.cxx line 255</span><br><span>vtkIdTypeArray(0x...):unable to <b>allocate</b> 62300005 <b>elements</b> of size 2</span><br>
<br>The type of dataset is<span> &quot;bmp&quot; :
300*349*500.  </span><span>The developing tools are VC6.0 + vtk5.1</span><br><br>I remember bill ever sent important information of reducing memory usage to me, such as call <span>ReleaseDataFlagOn(). However, the memory problem is still existed.  I believe this problem existed commonly in the 3D reconstruction. Could any one provide efficient solutions? Thanks in advance !<br>


</span><br>Here are the all related codes:<br><br>vtkSmartPointer&lt;vtkBMPReader&gt; m_read = vtkSmartPointer&lt;vtkBMPReader&gt;::New();<br>...<br><br>vtkSmartPointer&lt;vtkDiscreteMarchingCubes&gt; cube =           <br>


    vtkSmartPointer&lt;vtkDiscreteMarchingCubes&gt;::New() ;<br>

cube-&gt;SetInput((vtkDataObject*) m_read-&gt;GetOutput() );<br>cube-&gt;SetValue(0, 111);<br>cube-&gt;SetValue(1, 121);<br>...<br>cube-&gt;ReleaseDataFlagOn();<br>cube-&gt;ComputeNormalOff();<br><br>vtkSmartPointer&lt;vtkWindowedSincPolyDataFilter&gt; smoother= vtkSmartPointer&lt;vtkWindowedSincPolyDataFilter&gt;::New();<br>




smoother-&gt;SetInput(deci-&gt;GetOutput());<br>smoother-&gt;SetNumberOfIterations(30) ;<br>smoother-&gt;NonManifoldSmoothingOn();<br>smoother-&gt;NormalizeCoordinatesOn();<br>smoother-&gt;GenerateErrorScalarsOn() ;<br>smoother-&gt;ReleaseDataFlagOn();<br>




<br>vtkSmartPointer&lt;vtkPolyDataNormals&gt; triangleCellNormals = vtkSmartPointer&lt;vtkPolyDataNormals&gt;::New();<br>

triangleCellNormals-&gt;SetInput(smoother-&gt;GetOutput());<br>triangleCellNormals-&gt;ComputeCellNormalsOn();<br>triangleCellNormals-&gt;ComputePointNormalsOff();<br>triangleCellNormals-&gt;ConsistencyOn();<br>triangleCellNormals-&gt;AutoOrientNormalsOn();<br>




triangleCellNormals-&gt;ReleaseDataFlagOn();<br><br>vtkSmartPointer&lt;vtkPolyDataMapper&gt; mapper = vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();<br>mapper-&gt;SetInput(triangleCellNormals-&gt;GetOutput()); // #this is better for vis<br>




mapper-&gt;ScalarVisibilityOn() ;//#show colour <br>mapper-&gt;SetScalarRange(colorLookupTable-&gt;GetTableRange()); <br>mapper-&gt;SetScalarModeToUseCellData() ; //  contains the label eg. 31<br>

mapper-&gt;SetLookupTable(colorLookupTable);<br>mapper-&gt;ReleaseDataFlagOn();<br><br><br>thanks,<br>Wenwu<br>
</div>