[vtkusers] Generating mesh from contours : vtkIdTypeArray (0x4122f088): Unable to allocate 37589200 elements of si ze 4 bytes.

Ashika Umanga Umagiliya aumanga at biggjapan.com
Tue Oct 5 04:39:36 EDT 2010


greetings all,

I am constructing mesh from set of contour data.It worked fine for
first sample test, but for second sample set ,application crash giving
the error:

"
warning: ERROR: In C:\opt\vtk\Common\/vtkDataArrayTemplate.txx, line 142
warning:

warning: vtkIdTypeArray (0x4122f088): Unable to allocate 37589200
elements of size 4 bytes."

My code snippet generating mesh is:


vtkAppendPolyData *appPoly;

//populate PolyData into  appPoly
..
..
 vtkSmartPointer<vtkVoxelContoursToSurfaceFilter> contoursToSurface =
        vtkSmartPointer<vtkVoxelContoursToSurfaceFilter>::New();
    contoursToSurface->SetInput(appPoly->GetOutput());
    contoursToSurface->SetSpacing(4, 4, 4);
    contoursToSurface->Update();


    vtkActor *actor = vtkActor::New();
    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();

    vtkDecimatePro *deci=vtkDecimatePro::New();
    deci->SetInputConnection(contoursToSurface->GetOutputPort());
    deci->SetTargetReduction(0.8);
    deci->PreserveTopologyOn();


    vtkSmoothPolyDataFilter *smooth=vtkSmoothPolyDataFilter::New();
    smooth->SetInputConnection(deci->GetOutputPort());
    smooth->SetNumberOfIterations(20);
    mapper->SetInput(smooth->GetOutput());
    actor->SetMapper(mapper);

Any tips,

Thanks
umanga



More information about the vtkusers mailing list