[vtkusers] how to arrange memory in multi-iso reconstruction by using vtkDiscreteMarchingCubes

朱文武 cool.wenwu at gmail.com
Tue Apr 20 02:35:15 EDT 2010


Dear bill and all,

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!
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:
Error:in c:\vtk5.0\vtk\common\vtkDataArrayTemplate.cxx line 255
vtkIdTypeArray(0x...):unable to *allocate* 62300005 *elements* of size 2

The type of dataset is "bmp" : 300*349*500.  The developing tools are VC6.0
+ vtk5.1

I remember bill ever sent important information of reducing memory usage to
me, such as call 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 !

Here are the all related codes:

vtkSmartPointer<vtkBMPReader> m_read = vtkSmartPointer<vtkBMPReader>::New();
...

vtkSmartPointer<vtkDiscreteMarchingCubes> cube =
    vtkSmartPointer<vtkDiscreteMarchingCubes>::New() ;
cube->SetInput((vtkDataObject*) m_read->GetOutput() );
cube->SetValue(0, 111);
cube->SetValue(1, 121);
...
cube->ReleaseDataFlagOn();
cube->ComputeNormalOff();

vtkSmartPointer<vtkWindowedSincPolyDataFilter> smoother=
vtkSmartPointer<vtkWindowedSincPolyDataFilter>::New();
smoother->SetInput(deci->GetOutput());
smoother->SetNumberOfIterations(30) ;
smoother->NonManifoldSmoothingOn();
smoother->NormalizeCoordinatesOn();
smoother->GenerateErrorScalarsOn() ;
smoother->ReleaseDataFlagOn();

vtkSmartPointer<vtkPolyDataNormals> triangleCellNormals =
vtkSmartPointer<vtkPolyDataNormals>::New();
triangleCellNormals->SetInput(smoother->GetOutput());
triangleCellNormals->ComputeCellNormalsOn();
triangleCellNormals->ComputePointNormalsOff();
triangleCellNormals->ConsistencyOn();
triangleCellNormals->AutoOrientNormalsOn();
triangleCellNormals->ReleaseDataFlagOn();

vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInput(triangleCellNormals->GetOutput()); // #this is better for
vis
mapper->ScalarVisibilityOn() ;//#show colour
mapper->SetScalarRange(colorLookupTable->GetTableRange());
mapper->SetScalarModeToUseCellData() ; //  contains the label eg. 31
mapper->SetLookupTable(colorLookupTable);
mapper->ReleaseDataFlagOn();


thanks,
Wenwu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100420/9b49d842/attachment.htm>


More information about the vtkusers mailing list