[vtkusers] 3d reconstruction problem

OnezerO onezerostyle at gmail.com
Fri Oct 21 12:38:47 EDT 2005


Hi,
 
I've make a example of itk->vtk conecction, but i have a problem in the
final display because i don't know how to close the 3D view of the image, i
mean the bottom and the top of the image it's a hole. There's a property
that generate a complete solid figure?
 
 
Thanks
 
 
the code of the vtk part is the next.
 
 
 m_vtkActor   = vtkActor::New();
 m_vtkRenderer  = vtkRenderer::New();
 m_vtkRenderWindow = vtkRenderWindow::New();
 m_vtkMapper   = vtkPolyDataMapper::New();
 m_vtkInteractor  = vtkRenderWindowInteractor::New();
 m_vtkImporter  = vtkImageImport::New();  
 
    ConnectPipelines(m_itkExporter , m_vtkImporter );
    m_vtkImporter->Update();     
 
 m_vtkRenderer->SetViewport( 0.0, 0.0, 1.0, 1.0 );
 m_vtkRenderer->SetBackground( 0.5, 0.5, 0.5 );
 m_vtkRenderWindow->SetSize( 500,500 );
 
 m_vtkProperty->SetColor( 2.0 , 2.0 , 2.0 );
 

 vtkContourFilter *m_vtkContour = vtkContourFilter::New();
 m_vtkContour->SetInput( m_vtkImporter->GetOutput() );
 m_vtkContour->SetValue(0,255);
 
 vtkSmoothPolyDataFilter *m_vtkSmooth = vtkSmoothPolyDataFilter::New();
 m_vtkSmooth->SetInput( m_vtkContour->GetOutput() );
 m_vtkSmooth->SetNumberOfIterations(50);
 m_vtkSmooth->BoundarySmoothingOn();
 m_vtkSmooth->SetFeatureAngle(120);
 m_vtkSmooth->SetEdgeAngle(90);
 m_vtkSmooth->SetRelaxationFactor(.025);
 
 m_vtkMapper->SetInput( m_vtkSmooth->GetOutput() );
 
 m_vtkActor->SetProperty( m_vtkProperty );
 m_vtkActor->SetMapper( m_vtkMapper );
 
 m_vtkRenderer->AddActor( m_vtkActor );
 m_vtkRenderWindow->AddRenderer( m_vtkRenderer ); 
 m_vtkInteractor->SetRenderWindow( m_vtkRenderWindow );
 
 m_vtkRenderer->ResetCameraClippingRange();
 
 m_vtkRenderWindow->Render(); 
 
 m_vtkInteractor->SetDesiredUpdateRate( 0.1 ); 
 m_vtkInteractor->Start();
 
 vtkPolyDataWriter * m_vtkWriter = vtkPolyDataWriter::New();
 m_vtkWriter->SetFileName("modelo.vtk");
    m_vtkWriter->SetInput( m_vtkSmooth->GetOutput() );
    m_vtkWriter->Write();
 
 // No olvidar limpiar!
 
 m_vtkSmooth->Delete();
 m_vtkContour->Delete();
 m_vtkRenderer->Delete();
 m_vtkActor->Delete();
 m_vtkMapper->Delete();
 m_vtkRenderWindow->Delete();
 m_vtkInteractor->Delete(); 


 
Saludos,
Pato
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051021/3e494bc9/attachment.htm>


More information about the vtkusers mailing list