vtk实战(十三)——读取DICOM影像文件
2016-04-27 10:43
176 查看
DICOM(Digital Imaging and Communications in Medicine)即医学数字成像和通信,是医学图像和相关信息的国际标准。
本例主要使用vtkDICOMImageReader()对DICOM图像进行操作。
注意:vtkDICOMImageReader()只能对DICOM原始文件进行操作,不处理多帧DICOM数据集。
![](http://img.blog.csdn.net/20160427103818328)
代码链接:http://pan.baidu.com/s/1pLSWTIj
本例主要使用vtkDICOMImageReader()对DICOM图像进行操作。
注意:vtkDICOMImageReader()只能对DICOM原始文件进行操作,不处理多帧DICOM数据集。
int main() { std::string folder = "digest_article"; vtkSmartPointer<vtkDICOMImageReader> reader = vtkSmartPointer<vtkDICOMImageReader>::New(); reader->SetDirectoryName(folder.c_str()); reader->Update(); vtkSmartPointer<vtkImageViewer2> imageViewer = vtkSmartPointer<vtkImageViewer2>::New(); imageViewer->SetInputConnection(reader->GetOutputPort()); vtkSmartPointer<vtkTextProperty> sliceTextProp = vtkSmartPointer<vtkTextProperty>::New(); sliceTextProp->SetFontFamilyToCourier(); sliceTextProp->SetFontSize(20); sliceTextProp->SetVerticalJustificationToBottom(); sliceTextProp->SetJustificationToLeft(); vtkSmartPointer<vtkTextMapper> sliceTextMapper = vtkSmartPointer<vtkTextMapper>::New(); std::string msg = StatusMessage::Format(imageViewer->GetSliceMin(), imageViewer->GetSliceMax()); sliceTextMapper->SetInput(msg.c_str()); sliceTextMapper->SetTextProperty(sliceTextProp); vtkSmartPointer<vtkActor2D> sliceTextActor = vtkSmartPointer<vtkActor2D>::New(); sliceTextActor->SetMapper(sliceTextMapper); sliceTextActor->SetPosition(15, 10); vtkSmartPointer<vtkTextProperty> usageTextProp = vtkSmartPointer<vtkTextProperty>::New(); usageTextProp->SetFontFamilyToCourier(); usageTextProp->SetFontSize(14); usageTextProp->SetVerticalJustificationToTop(); usageTextProp->SetJustificationToLeft(); vtkSmartPointer<vtkTextMapper> usageTextMapper = vtkSmartPointer<vtkTextMapper>::New(); usageTextMapper->SetInput("- Slice with mouse wheel\n or Up/Down-Key\n- Zoom with pressed right\n mouse button while dragging"); usageTextMapper->SetTextProperty(usageTextProp); vtkSmartPointer<vtkActor2D> usageTextActor = vtkSmartPointer<vtkActor2D>::New(); usageTextActor->SetMapper(usageTextMapper); usageTextActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay(); usageTextActor->GetPositionCoordinate()->SetValue(0.05, 0.95); vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New(); vtkSmartPointer<myVtkInteractorStyleImage> myInteractorStyle = vtkSmartPointer<myVtkInteractorStyleImage>::New(); myInteractorStyle->SetImageViewer(imageViewer); myInteractorStyle->SetStatusMapper(sliceTextMapper); imageViewer->SetupInteractor(renderWindowInteractor); renderWindowInteractor->SetInteractorStyle(myInteractorStyle); imageViewer->GetRenderer()->AddActor2D(sliceTextActor); imageViewer->GetRenderer()->AddActor2D(usageTextActor); imageViewer->Render(); imageViewer->GetRenderer()->ResetCamera(); imageViewer->Render(); renderWindowInteractor->Start(); return 0; }
代码链接:http://pan.baidu.com/s/1pLSWTIj
相关文章推荐
- rand()%N-----随机数的获取,51级单片机
- POJ3628 Bookshelf2
- Android 从framework层到HAL层调用实现(蓝牙串口)
- iOS 绘制不规则图形,并且添加点击事件
- HDFS源码分析数据块校验之DataBlockScanner
- 二叉树系列(1)已知二叉树的中序遍历和前序遍历,如何求后序遍历
- Activity 启动模式 图解
- centos7利用ngxtop监控nginx
- HTML打开摄像头,进行拍照上传
- hdu3068 manacher算法模板
- 车载WIFi数据
- c# 泛型 束缚关系和default
- 个人博客koalahl.github.io
- maven私服配置
- 基于传统复制模式下的主从同步搭建测试
- spring注解
- 2015年总结与2016年目标和计划
- eclipse上android NDK开发环境的搭建(android-ndk-r10d\docs\Getting Started with the NDK)
- 数据类型图和基本数据类型图
- 如何判断一个txt文件的编码格式