VTK显示mhd,mha格式文件
2015-02-05 15:59 采药的蜗牛 阅读(2618) 评论(2) 编辑 收藏 举报下一篇文章将详细介绍mhd,mha文件的构成以及如何制作
void renderMhd () { // read input image vtkSmartPointer<vtkMetaImageReader > reader = vtkSmartPointer<vtkMetaImageReader >::New(); reader->SetFileName ("HeadMRVolume.mhd"); reader->Update (); vtkSmartPointer<vtkImageViewer2 > viewer = vtkSmartPointer<vtkImageViewer2 >::New(); viewer->SetInputConnection (reader-> GetOutputPort()); // render window vtkSmartPointer<vtkRenderWindowInteractor > renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor >::New(); viewer->SetupInteractor (renderWindowInteractor); viewer->GetRenderer ()->ResetCamera(); renderWindowInteractor->Initialize (); renderWindowInteractor->Start (); }
显示效果就不用贴图了。