[vtkusers] vtkidtypearray exception

Ali Habib ali.mahmoud.habib at gmail.com
Sun Oct 11 19:14:08 EDT 2009


I just read  question regard finite element mesh, I face the same problem I
created 3D bone of skull from 2d slices (CT)
I wanted to create mesh and I used the following code , but it always throw
a bug of vtkidtypearray.. can't allocate ...  what shall I do:

voxeldata is the output of the render winow

ren1 = gcnew vtk::vtkRenderer();
                       renwM = r;
                       renwM::AddRenderer(ren1);
                       iren::SetRenderWindow(renwM);


          vtk::vtkMarchingCubes ^mcubes = gcnew vtk::vtkMarchingCubes();
               mcubes->GetOutput()->ReleaseDataFlagOff();
               mcubes->SetInput(VoxelData);
               mcubes->SetValue(0, 4);
               mcubes->ComputeGradientsOn();
               mcubes->Update();

               vtk::vtkSmoothPolyDataFilter ^smoother = gcnew
vtk::vtkSmoothPolyDataFilter();
               smoother->GetOutput()->ReleaseDataFlagOff();
               smoother->SetInput(mcubes->GetOutput());
               smoother->SetNumberOfIterations(5);
               smoother->SetRelaxationFactor(0.70);
               smoother->SetFeatureAngle(70);
               smoother->FeatureEdgeSmoothingOn();
               smoother->BoundarySmoothingOn();
               smoother->Update();

               vtk::vtkPolyDataNormals ^normals = gcnew
vtk::vtkPolyDataNormals();
               normals->GetOutput()->ReleaseDataFlagOff();
               normals->SetInput(smoother->GetOutput());
               normals->SetFeatureAngle(80);
               normals->Update();

//        vtk.vtkStripper stripper = new vtk.vtkStripper();
//        stripper.SetInput(normals.GetOutput());
//        stripper.GetOutput().ReleaseDataFlagOff();
//        stripper.Update();

               vtk::vtkDelaunay3D ^delaunay4 = gcnew vtkDelaunay3D();
               delaunay4->SetInputConnection(normals->GetOutputPort());

                       vtkDataSetMapper ^mapper = gcnew
vtk::vtkDataSetMapper();

 mapper->SetInputConnection(delaunay4->GetOutputPort());
                       vtkActor ^actor = gcnew vtk::vtkActor();
                       actor->SetMapper(mapper);
                       actor->GetProperty()->SetRepresentationToWireframe();

                       ren1::AddActor(actor);
                       renwM::Render();
                       iren->Initialize();
                       iren::Enable();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091012/cff9edc5/attachment.htm>


More information about the vtkusers mailing list