<div dir="ltr"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">I just read question regard finite element mesh, I face the same problem I created 3D bone of skull from 2d slices (CT)<br>
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:<br><br>voxeldata is the output of the render winow<br><br>ren1 = gcnew vtk::vtkRenderer();<br>
renwM = r;<br> renwM::AddRenderer(ren1);<br> iren::SetRenderWindow(renwM);<br><br><br> vtk::vtkMarchingCubes ^mcubes = gcnew vtk::vtkMarchingCubes();<br>
mcubes->GetOutput()->ReleaseDataFlagOff();<br> mcubes->SetInput(VoxelData);<br> mcubes->SetValue(0, 4);<br> mcubes->ComputeGradientsOn();<br> mcubes->Update();<br>
<br> vtk::vtkSmoothPolyDataFilter ^smoother = gcnew vtk::vtkSmoothPolyDataFilter();<br> smoother->GetOutput()->ReleaseDataFlagOff();<br> smoother->SetInput(mcubes->GetOutput());<br>
smoother->SetNumberOfIterations(5);<br> smoother->SetRelaxationFactor(0.70);<br> smoother->SetFeatureAngle(70);<br> smoother->FeatureEdgeSmoothingOn();<br>
smoother->BoundarySmoothingOn();<br> smoother->Update();<br><br> vtk::vtkPolyDataNormals ^normals = gcnew vtk::vtkPolyDataNormals();<br> normals->GetOutput()->ReleaseDataFlagOff();<br>
normals->SetInput(smoother->GetOutput());<br> normals->SetFeatureAngle(80);<br> normals->Update();<br><br>// vtk.vtkStripper stripper = new vtk.vtkStripper();<br>
// stripper.SetInput(normals.GetOutput());<br>// stripper.GetOutput().ReleaseDataFlagOff();<br>// stripper.Update();<br><br> vtk::vtkDelaunay3D ^delaunay4 = gcnew vtkDelaunay3D();<br> delaunay4->SetInputConnection(normals->GetOutputPort());<br>
<br> vtkDataSetMapper ^mapper = gcnew vtk::vtkDataSetMapper();<br> mapper->SetInputConnection(delaunay4->GetOutputPort());<br> vtkActor ^actor = gcnew vtk::vtkActor();<br>
actor->SetMapper(mapper);<br> actor->GetProperty()->SetRepresentationToWireframe();<br><br> ren1::AddActor(actor);<br> renwM::Render();<br>
iren->Initialize();<br> iren::Enable();<br></span></div>