[vtkusers] Fwd: the tetrahedralmesh not appear by using vtkStrippe

Ali Habib ali.mahmoud.habib at gmail.com
Wed Oct 28 10:52:08 EDT 2009


Hi All,

I use dicom reader to read about just 48 slices , after that I want to apply
a mesh algorithm to the volume be reconstructed from those 2d slices, as in
this figure appear at this link :
http://www.zib.de/Numerik/software/kardos/projects/mandible3.gif

I just tried this algorithm algorithms but  no effect to the stripper(No
tetrahedral mesh appeared )  any advice please (attached is the output ) and
the used code is :

 //Variables
array<double> ^metaScalarRange = gcnew array<double>(2) { 0, 0 };


// Read a DICOM series path:
vtk::vtkDICOMImageReader ^VDR = gcnew vtk::vtkDICOMImageReader();
VDR->SetDirectoryName("H:\\work\\Master
Degree\\DataSet\\case2\\DICOM\\PA1\\ST1\\SE2");
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 ^stripper1 = gcnew vtk::vtkStripper();
stripper1->SetInput(normals->GetOutput());
stripper1->GetOutput()->ReleaseDataFlagOff();
stripper1->Update();
//
//          vtkDelaunay3D stripper = new vtkDelaunay3D();
//            stripper.SetInputConnection(normals.GetOutputPort());
//            stripper.Update();
 vtkDataSetTriangleFilter ^stripper = gcnew vtkDataSetTriangleFilter();
stripper->SetInputConnection(normals->GetOutputPort());


vtkDataSetMapper ^mapper = gcnew vtkDataSetMapper();
mapper->SetInputConnection(stripper->GetOutputPort());

/////////////////////


// actor coordinates geometry, properties, transformation
vtkActor ^aSphere = gcnew vtkActor();
aSphere->SetMapper(mapper);
   // aSphere.GetProperty().SetRepresentationToWireframe();
//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();

Hint : the delaunary3d take along time , so I stoped it before seeing the
resuult
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091028/1dbca0ed/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled.jpg
Type: image/jpeg
Size: 37400 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091028/1dbca0ed/attachment.jpg>


More information about the vtkusers mailing list