VTK-py读取与显示相关函数
在VTK中可视化数据的一般流程如下:

文件输入相关函数:
https://www.vtk.org/Wiki/VTK/Examples/Cxx#Input_and_Output
Readers ● Reads data from file
Filters ● Takes data as input, modifies it in some way, and returns the modified data
Mappers ● Maps data to graphics primitives (points, lines, or triangles) that can be displayed by the renderer
Actors ● vtkActor represents an object (geometry and properties) in a rendering scene
Rendering ● The process of converting 3D graphics primitives (points, lines, triangles, etc), a specification for lights and materials, and a camera view into an 2D image that can be displayed on the screen
Renderer ● vtkRenderer controls the rendering process for actors and scenes
Render window ● The vtkRenderWindow class creates a window for renderers to draw into
Interactors ● The vtkRenderWindowInteractor class provides platform-independent window interaction via the mouse and keyboard
一个读取.obj文件的代码:
import vtk filename = "xxxxx.obj"
reader = vtk.vtkOBJReader()
reader.SetFileName(filename)
reader.Update() mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(reader.GetOutputPort()) actor = vtk.vtkActor()
actor.SetMapper(mapper) renderer = vtk.vtkRenderer()
renderer.AddActor(actor)
#renderer.GetActiveCamera().SetPosition() #设置视点位置
#renderer.GetActiveCamera().SetViewUp(0, 1, 0) #设置视点方向
renderer.SetBackground(0.1, 0.1, 0.1) #设置背景颜色 renWin = vtk.vtkRenderWindow()
renWin.SetSize(640, 480) #设置窗口大小
renWin.AddRenderer(renderer) iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.Initialize() renWin.Render()
iren.Start()
参考资料:
http://www.cb.uu.se/~aht/Vis2014/lecture2.pdf
VTK-py读取与显示相关函数的更多相关文章
- 《python核心编程》笔记——文件的创建、读取和显示
创建文件(makeTextFile.py)脚本提醒用户输入一个尚不存在的文件名,然后由用户输入文件每一行,最后将所有文本写入文本文件 #!/usr/bin/env python 'makeTextFi ...
- OpenCV中图像的读取,显示与保存
图像的读取,显示与保存 相关函数:cv2.imread().cv2.imshow().cv2.imwrite() 1.读入图像: 用cv2.imread()函数来读取图像,cv2.imread(路 ...
- Winform实现Shp-栅格图形文件的读取与显示(外加shp转WKB格式存入oracle)附源码
前言:上学期GIS空间数据库课程设计时,老师让实现Shp-栅格图形文件的读取与显示,外加shp转WKB格式存入oracle,不使用第三方类库,花了一天时间在网上找了一些资料,实现了一个简单的栅格图形文 ...
- [RGEOS]支持栅格数据读取和显示
SharpMap真的很强大,这里通过改造GdalRasterLayer类实现了在RGeos项目中支持栅格图像的读取和显示,同时支持影像的无级缩放. GdalRasterLayer通过读取FWTools ...
- C# 保存PictureBox中的图片到数据库,并从数据库读取图片显示到PictrueBox,解决报错 “无效参数”
下面是两段关键代码: /// <summary> /// 将一张图片转换为字节 /// </summary> /// <param name="img" ...
- C#(WinForm)上传图片保存到数据库和从数据库读取图片显示到窗体
//浏览图片 private void btnUp_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialo ...
- 51单片机实现对24C02进行页写、顺序读取并显示验证
//************************************************************************************* //**程序名称:51单 ...
- 转:FileReader详解与实例---读取并显示图像文件
~~~针对需要读取本地图像,并立即显示在浏览器的情况,由于chrome firefox出于安全限制,input file并不返回文件的真实路径,经测试IE6/7/8都会返回真实路径,所以chrome, ...
- openCV学习——一、图像读取、显示、输出
openCV学习——一.图像读取.显示.输出 一.Mat imread(const string& filename,int flags=1),用于读取图片 1.参数介绍 filename ...
随机推荐
- openwrt: Makefile 框架分析[转载]
openwrt目录结构 上图是openwrt目录结构,其中第一行是原始目录,第二行是编译过程中生成的目录.各目录的作用是: tools - 编译时需要一些工具, tools里包含了获取和编译这些工具的 ...
- the virtual machine is configured for 64-bit guest operating systems
Security--Virtualization--Inter(R) Virtualization Technolog 设置为enable 本机安装的是WIN 7 ,详细版本是:Windows 7 U ...
- Java-API:java.util.UUID
ylbtech-Java-API:java.util.UUID 1.返回顶部 2.返回顶部 3.返回顶部 4. 百科返回顶部 5.返回顶部 0. https://docs.oracle ...
- Unreal Engine 4的常见Tips
转自:http://www.unrealchina.net/portal.php?mod=view&aid=66 退出游戏: UKismetSystemLibrary::QuitGame(th ...
- web基础(五)Jquery
jQuery是一个快速的,简洁的javaScript库(占空间特别小,但功能强大!兼容性极强!),这个库里封装了一些方法,使用户能更方便地处理HTMLdocuments.events.实现动画效果,并 ...
- 将Windows下磁盘出现黑色为分配区域变成绿色区域
在windows下不知什么原因, 有一块磁盘空间F盘就变成了黑色为分配区域. 黑色区域无法用来安装双系统, 网上查阅资料后, 找到了如何将他重新变回绿色区域的2个方法(方法二是自己无意操作成功的). ...
- 问题:不支持Dictionary;结果:在Web Service中傳送Dictionary
在Web Service中傳送Dictionary 有個需求,想在Web Service中傳遞Dictionary<string, string>參數,例如: 排版顯示純文字 [WebMe ...
- day17-jdbc 6.Connection介绍
package cn.itcast.jdbc; import com.mysql.jdbc.Connection; import java.sql.DriverManager; import java ...
- cocos2dx中的内存管理方式
转载:http://www.cocoachina.com/bbs/read.php?tid=195219 今天看了一下cocos2dx的内存管理机制,有些地方不太好理解搞了挺长的时间,现在感觉自己理解 ...
- C++对ASCII文件的操作例子
从键盘读入一行字符,把其中的字母字符依次放在磁盘文件f2.dat中,再把它从磁盘文件读入程序,将其中的小写字母改写成大写字母,再存入磁盘文件f3.dat. code: #include<iost ...