[vtkusers] How to decrease the poly data element
InfoSeekerr
ali.mahmoud.habib at gmail.com
Mon Dec 7 16:04:50 EST 2009
Dear All,
I read 78 DICOM files , and the result is a big vtkpolydata , which I can't
apply any filter on it because it give the attached error ( it's a snapshot)
even using Vtkshrinkpolydata , the used code is:
vtkRenderer *aRenderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(aRenderer);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkDICOMImageReader *v16 = vtkDICOMImageReader::New();
v16->SetDirectoryName("C:\\1");
v16->SetDataOrigin(0, 0, 0);
v16->Update();
vtkContourFilter *skinExtractor = vtkContourFilter::New();
skinExtractor->SetInputConnection(v16->GetOutputPort());
skinExtractor->SetValue(0, 500);
vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
skinNormals->SetInputConnection(skinExtractor->GetOutputPort());
skinNormals->SetFeatureAngle(60.0);
/////////////////////Decrease the dataset/////////////////////////////////
vtkShrinkPolyData *shrink = vtkShrinkPolyData::New();
shrink->SetInputConnection(skinNormals->GetOutputPort());
shrink->SetShrinkFactor(0.90);
vtkPolyDataToTetrahedralGrid* gridder =
vtkPolyDataToTetrahedralGrid::New();
gridder->SetInputConnection(shrink->GetOutputPort());
vtkDataSetMapper *skinMapper = vtkDataSetMapper::New();
skinMapper->SetInputConnection(gridder->GetOutputPort());
skinMapper->ScalarVisibilityOff();
vtkActor *skin = vtkActor::New();
skin->SetMapper(skinMapper);
vtkCamera *aCamera = vtkCamera::New();
aCamera->SetViewUp( 0, 0, -1);
aCamera->SetPosition( 0, 1, 0);
aCamera->SetFocalPoint( 0, 0, 0);
aCamera->ComputeViewPlaneNormal();
aRenderer->AddActor(skin);
aRenderer->SetActiveCamera(aCamera);
aRenderer->ResetCamera();
aCamera->Dolly(1.5);
renWin->SetSize(640, 480);
aRenderer->ResetCameraClippingRange();
iren->Initialize();
return 0;
http://old.nabble.com/file/p26684126/error_screen.jpg error_screen.jpg
--
View this message in context: http://old.nabble.com/How-to-decrease-the-poly-data-element-tp26684126p26684126.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list