<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> "bmp" :
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<vtkBMPReader> m_read = vtkSmartPointer<vtkBMPReader>::New();<br>...<br><br>vtkSmartPointer<vtkDiscreteMarchingCubes> cube = <br>
vtkSmartPointer<vtkDiscreteMarchingCubes>::New() ;<br>
cube->SetInput((vtkDataObject*) m_read->GetOutput() );<br>cube->SetValue(0, 111);<br>cube->SetValue(1, 121);<br>...<br>cube->ReleaseDataFlagOn();<br>cube->ComputeNormalOff();<br><br>vtkSmartPointer<vtkWindowedSincPolyDataFilter> smoother= vtkSmartPointer<vtkWindowedSincPolyDataFilter>::New();<br>
smoother->SetInput(deci->GetOutput());<br>smoother->SetNumberOfIterations(30) ;<br>smoother->NonManifoldSmoothingOn();<br>smoother->NormalizeCoordinatesOn();<br>smoother->GenerateErrorScalarsOn() ;<br>smoother->ReleaseDataFlagOn();<br>
<br>vtkSmartPointer<vtkPolyDataNormals> triangleCellNormals = vtkSmartPointer<vtkPolyDataNormals>::New();<br>
triangleCellNormals->SetInput(smoother->GetOutput());<br>triangleCellNormals->ComputeCellNormalsOn();<br>triangleCellNormals->ComputePointNormalsOff();<br>triangleCellNormals->ConsistencyOn();<br>triangleCellNormals->AutoOrientNormalsOn();<br>
triangleCellNormals->ReleaseDataFlagOn();<br><br>vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();<br>mapper->SetInput(triangleCellNormals->GetOutput()); // #this is better for vis<br>
mapper->ScalarVisibilityOn() ;//#show colour <br>mapper->SetScalarRange(colorLookupTable->GetTableRange()); <br>mapper->SetScalarModeToUseCellData() ; // contains the label eg. 31<br>
mapper->SetLookupTable(colorLookupTable);<br>mapper->ReleaseDataFlagOn();<br><br><br>thanks,<br>Wenwu<br>
</div>