VTK三维重建(2)-根据脚部骨骼CT的三维重建和显示

原文地址:http://blog.csdn.net/chinamming/article/details/16829569

[效果演示]

根据脚部的骨骼CT扫描的照片,利用VTK完成读取和三维重建.

[程序实现]

void main ()  
{  
  vtkRenderer *aRenderer = vtkRenderer::New();  
  vtkRenderWindow *renWin = vtkRenderWindow::New();  
    renWin->AddRenderer(aRenderer);  
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();  
    iren->SetRenderWindow(renWin);  
  

  vtkDICOMImageReader *v16 = vtkDICOMImageReader::New();  
    v16->SetDataByteOrderToLittleEndian();  
    v16->SetDirectoryName("Foot-CTs");  
    v16->SetDataSpacing (3.2, 3.2, 1.5);  
  

  vtkContourFilter *skinExtractor = vtkContourFilter::New();  
    skinExtractor->SetInputConnection(v16->GetOutputPort());  
    skinExtractor->SetValue(0, 500);  
  vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();  
    skinNormals->SetInputConnection(skinExtractor->GetOutputPort());  
    skinNormals->SetFeatureAngle(60.0);  
  vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();  
    skinMapper->SetInputConnection(skinNormals->GetOutputPort());  
    skinMapper->ScalarVisibilityOff();  
  vtkActor *skin = vtkActor::New();  
    skin->SetMapper(skinMapper);  
  

  vtkOutlineFilter *outlineData = vtkOutlineFilter::New();  
    outlineData->SetInputConnection(v16->GetOutputPort());  
  vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();  
    mapOutline->SetInputConnection(outlineData->GetOutputPort());  
  vtkActor *outline = vtkActor::New();  
    outline->SetMapper(mapOutline);  
    outline->GetProperty()->SetColor(0,0,0);  
  

  vtkCamera *aCamera = vtkCamera::New();  
    aCamera->SetViewUp (0, 0, -1);  
    aCamera->SetPosition (0, 1, 0);  
    aCamera->SetFocalPoint (0, 0, 0);  
    aCamera->ComputeViewPlaneNormal();  
  

  aRenderer->AddActor(outline);  
  aRenderer->AddActor(skin);  
  aRenderer->SetActiveCamera(aCamera);  
  aRenderer->ResetCamera ();  
  aCamera->Dolly(1.5);  
  

  aRenderer->SetBackground(1,1,1);  
  renWin->SetSize(640, 480);  
  

  aRenderer->ResetCameraClippingRange ();  
  
  // Initialize the event loop and then start it.   
  iren->Initialize();  
  iren->Start();   
  
  v16->Delete();  
  skinExtractor->Delete();  
  skinNormals->Delete();  
  skinMapper->Delete();  
  skin->Delete();  
  outlineData->Delete();  
  mapOutline->Delete();  
  outline->Delete();  
  aCamera->Delete();  
  iren->Delete();  
  renWin->Delete();  
  aRenderer->Delete();  
  
}  

原文地址:http://blog.csdn.net/chinamming/article/details/16829569


版权声明:本文为博主原创文章,未经博主允许不得转载。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值