1 //得到图像文件
2 vtkDICOMImageReader *Reader = vtkDICOMReader::New();
3 Reader ->SetDirectoryName("");
4 Reader ->Update();
5 //MC
6 vtkMarchingCubes *m_MC = vtkMarchingCubes::New();
7 m_MC ->SetInput(Reader->GetOutput());
8 m_MC ->SetValue(0, 200);
9 //获得皮肤几何数据的属性
10 vtkPolyDataMapper *Mapper= vtkPolyDataMapper::New();
11 Mapper-SetInput(m_MC ->GetOutput());
12 //显示
13 vtkActor *m_actor = vtkActor::New();
14 m_actor->SetMapper(m_isoMapper);
15 //皮肤颜色
16 m_actor->GetProperty()->SetDiffuseColor(0, .49, .25);
17 //设置反射率
18 m_actor->GetProperty()->SetSpecular(0.3);
19 //设置反射光强
20 m_actor->GetProperty()->SetSpecularPower(20);
21 //不透明度
22 m_actor->GetProperty()->SetOpacity(1);
23 //绘制
24 vtkRenderer *m_renderer = vtkRenderer::New();
25 m_renderer ->AddActor(m_actor);
26 m_renderer ->SetBackground(0.2,0.5,0.3);
27
28 vtkWin32OpenGLRenderWindow *m_renWin = vtkWin32OpenGLRenderWindow::New();
29 m_renWin-> AddRenderer(m_renderer);
30 m_renWin-> Render();
31
32 vtkRenderWindowInteractor *m_iren = vtkRenderWindowInteractor::New();
33 m_iren->SetRenderWindow(m_renWin);