VTK三维重建(1)-使用VTK读取DICOM,并动态输出
[效果显示]
将脚部骨骼扫描的CT照片进行的连续读取, 运行结果存为了两个动态gif, 不知道能不能正常显示
[程序实现]
int main(int argc, char* argv[])
{
// Verify input arguments
if ( argc != )
{
std::cout << "Usage: " << argv[]
<< " FolderName" << std::endl;
return EXIT_FAILURE;
} std::string folder = argv[]; // Read all the DICOM files in the specified directory.
vtkSmartPointer<vtkDICOMImageReader> reader =
vtkSmartPointer<vtkDICOMImageReader>::New();
reader->SetDirectoryName(folder.c_str());
reader->Update(); // Visualize
vtkSmartPointer<vtkImageViewer2> imageViewer =
vtkSmartPointer<vtkImageViewer2>::New();
imageViewer->SetInputConnection(reader->GetOutputPort()); // slice status message
vtkSmartPointer<vtkTextProperty> sliceTextProp = vtkSmartPointer<vtkTextProperty>::New();
sliceTextProp->SetFontFamilyToCourier();
sliceTextProp->SetFontSize();
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(, ); // usage hint message
vtkSmartPointer<vtkTextProperty> usageTextProp = vtkSmartPointer<vtkTextProperty>::New();
usageTextProp->SetFontFamilyToCourier();
usageTextProp->SetFontSize();
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 EXIT_SUCCESS;
}
VTK三维重建(1)-使用VTK读取DICOM,并动态输出的更多相关文章
- VTK教程系列:VTK基础及应用开发教程
由于OpenCV不能使用,只能使用VTK库的图像处理库,暂时还没有找到其他可以全面替代的库: CSDN东灵工作室:http://blog.csdn.net/www_doling_net/article ...
- pydicom读取dicom文件报错
之前采用pydicom读取dicom文件一切都很正常,不过最近读取一批数据的时候,会报错 读取代码 file = pydicom.read_file(filepath) data = file.pix ...
- Java基础知识强化之网络编程笔记10:TCP之客户端读取文本文件服务器控制台输出
1. TCP之客户端读取文本文件服务器控制台输出 (1)客户端:(发送数据到服务端) package cn.itcast_10; import java.io.BufferedReader; impo ...
- openCV学习——一、图像读取、显示、输出
openCV学习——一.图像读取.显示.输出 一.Mat imread(const string& filename,int flags=1),用于读取图片 1.参数介绍 filename ...
- linux 读取文件信息并且输出
版权为个人所有,欢迎转载如转载请说明出处.(东北大亨) http://www.cnblogs.com/northeastTycoon/p/5513231.html 以下为读取文件信息做输出操作. 1. ...
- VTK三维重建(2)-根据脚部骨骼CT的三维重建和显示
[效果演示] 根据脚部的骨骼CT扫描的照片,利用VTK完成读取和三维重建. [程序实现] void main () { vtkRenderer *aRenderer = vtkRenderer::Ne ...
- C#开发PACS医学影像三维重建(一):使用VTK重建3D影像
VTK简介: VTK是一个开源的免费软件系统,主要用于三维计算机图形学.图像处理和可视化.Vtk是在面向对象原理的基础上设计和实现的,它的内核是用C++构建的. 因为使用C#语言开发,而VTK是C++ ...
- DCMTK读取DICOM文件头信息的三种方法
Howto: Load File Meta-Header Here's an example that shows how to load the File Meta Information Head ...
- php对csv文件的读取,写入,输出下载操作
在实际工作中,很多时候需要把网站上的一些数据下载到CSV文件里,方便以后查看. 亦或者是用CSV进行一些批量的上传工作. 这个时候我们就需要对CSV进行读写操作. 1.CSV的读取操作 <?ph ...
随机推荐
- embed标签遮住div层
依然是上次的那个返工友情项目,当时帮忙用jquery ui写了一个漂浮的投票箱,就是类似点击一个项目然后就收藏到了投票箱中的效果.. 虽然不是很复杂,但是由于页面上有大面积的由kindeditor上传 ...
- NSFileManager 沙盒文件管理
文件夹创建,复制,移动,删除,检查是否存在,代码如下: 1.获取沙盒 document 路径,作为文件夹路径的基路径. NSString *document = NSSearchPathForDire ...
- XoftSpy 4.13的注册算法分析
[标题]XoftSpy 4.13的注册算法分析 [作者]forever[RCT] [语言]VC [工具]ida4.6,ollydbg1.1 [正文] 这个软件的算法很简单,正好拿来做逆向分 ...
- 服务器程序源代码分析之三:gunicorn
服务器程序源代码分析之三:gunicorn 时间:2014-05-09 11:33:54 类别:网站架构 访问: 641 次 gunicorn是一个python web 服务部署工具,类似flup,完 ...
- linux mysql添加用户
格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码" 例1.增加一个用户user_1密码为123,让他可以在任何主机上登录 ...
- [译]C++书籍终极推荐
转载声明: 翻译仅以技术学习和交流为目的,如需转载请务必标明原帖链接. 来源:http://stackoverflow.com/questions/388242/the-definitive-c-bo ...
- Servlet课程0426(十二)Servlet MV模式下用户登录及查看用户表中所有用户
Welcome.java //登录界面 package com.tsinghua; import javax.servlet.http.*; import java.io.*; import java ...
- Android:通过Intent访问一个网页
Intent(意图)主要是解决Android应用的各项组件之间的通讯. 小实例 package com.example.testopen; import android.app.Activity; i ...
- 解决 Your project contains error(s),please fix them before running your application问题
原文地址: Android笔记:解决 Your project contains error(s),please fix them before running your application问题 ...
- fedora
http://blog.chinaunix.net/uid-14735472-id-3486501.html 使用 http://blog.csdn.net/crystony/article/deta ...