[vtkusers] creating mesh - error
InfoSeekerr
ali.mahmoud.habib at gmail.com
Sat Oct 24 07:55:47 EDT 2009
I tried the code presented in the following link
http://www.vtk.org/pipermail/vtkusers/2009-January/098886.html , but I got
the imagedata by reading dicom series of CT it give error wich is :
vtktypeID can't load 17280129 element of size..........
Any advice please
my code is:
// Read a DICOM series path:
vtk::vtkDICOMImageReader ^VDR = gcnew vtk::vtkDICOMImageReader();
VDR->SetDirectoryName("H:\\work\\Master
Degree\\DataSet\\case1-\\DICOM\\PA1\\ST1\\SE1");
VDR->SetDataOrigin(0, 0, 0);
VDR->Update();
/////
vtk::vtkImageChangeInformation ^VIC = gcnew
vtk::vtkImageChangeInformation();
VIC->SetInput(VDR->GetOutput());
VIC->CenterImageOn();
VIC->Update();
// set the imagedata
vtk::vtkImageData ^VoxelData = VIC->GetOutput();
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 = gcnew vtk::vtkStripper();
stripper->SetInput(normals->GetOutput());
stripper->GetOutput()->ReleaseDataFlagOff();
stripper->Update();
vtkPolyDataMapper ^mapper = gcnew vtkPolyDataMapper();
mapper->SetInput(stripper->GetOutput());
/////////////////////
// actor coordinates geometry, properties, transformation
vtkActor ^aSphere = gcnew vtkActor();
aSphere->SetMapper(mapper);
//aSphere.GetProperty().SetColor(0,0,1); // sphere color blue
// a renderer and render window
vtkRenderer ^ren1 = gcnew vtkRenderer();
vtkRenderWindow ^renWin = gcnew vtkRenderWindow();
renWin->AddRenderer(ren1);
// an interactor
vtkRenderWindowInteractor ^iren = gcnew vtkRenderWindowInteractor();
iren->SetRenderWindow(renWin);
// add the actor to the scene
ren1->AddActor(aSphere);
//ren1.SetBackground(1,1,1); // Background color white
// render an image (lights and cameras are created automatically)
renWin->Render();
// begin mouse interaction
iren->Start();
--
View this message in context: http://www.nabble.com/creating-mesh---error-tp26038332p26038332.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list