



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
How to handle large data sets in VTK One of the challenges in VTK is to efficiently handle large datasets. By default VTK is tuned towards smaller datasets. For large datasets there are a couple of changes you can make that should yield a much smaller memory footprint (less swapping) and also improve rendering performance. The solution is to: 1. Use ReleaseDataFlag, 2. Turn on ImmediateModeRendering 3. Use triangle strips via vtkStripper 4. Use a different filter or mapper Each of these will be discussed below. Using ReleaseDataFlag By default VTK keeps a copy of all intermediate results between filters in a pipeline. For a pipeline with five filters this can result in having six copies of the data in memory at once. This can be controlled using ReleaseDataFlag and GlobalReleaseDataFlag. If ReleaseDataFlag is set to one on a data object, then once a filter has finished using that data object, it will release its memory. Likewise, if GlobalReleaseDataFlag is set on ANY data object, all data objects will release their memory once their dependent filter has finished executing. For example in Tcl and C+ # Tcl vtkPolyDataReader reader reader GetOutput ReleaseDataFlagOn / C+ vtkPolyDataReader *reader = vtkPolyDataReader:New(); reader-GetOutput()-ReleaseDataFlagOn();or / C+ vtkPolyDataReader *reader = vtkPolyDataReader:New(); reader-GetOutput()-GlobalReleaseDataFlagOn();While turning on the ReleaseDataFlag will reduce your memory footprint, the disadvantage is that none of the intermediate results are kept in memory. So if you interactively change a parameter of a filter (such as the isosurface value), all the filters will have to re-execute to produce the new result. When the intermediate results are stored in memory, only the downstream filters would have to re-execute. One hint for good interactive performance. If only one stage of the pipeline can have its parameters changed interactively (such as the target reduction in a decimation filter), only retain the data just prior to that step (which is the default) and turn ReleaseDataFlag on for all other steps. Use ImmediateModeRendering By default, VTK uses OpenGL display lists which results in another copy of the data being stored in memory. For most large datasets you will be better off saving memory by not using display lists. You can turn off display lists by turning on ImmediateModeRendering. This can be controlled on a mapper by mapper basis using ImmediateModeRendering, or globally for all mappers in a process by using GlobalImmediateModeRendering. For example: # Tcl vtkPolyDataMapper mapper mapper ImmediateModeRenderingOn / C+ vtkPolyDataMapper *mapper = vtkPolyDataMapper:New(); mapper-ImmediateModeRenderingOn();or / C+ vtkPolyDataMapper *mapper = vtkPolyDataMapper:New(); mapper-GlobalImmediateModeRenderingOn();The disadvantage to using ImmediateModeRendering is that if memory is not a problem, your rendering rates will typically be slower with ImmediateModeRendering turned on. Use triangle strips via vtkStripper. Most filters in VTK produce independent triangles or polygons which are not the most compact or efficient to render. To create triangle strips from polydata you can first use vtkTriangleFilter to convert any polygons to triangles (not required if you only have triangles to start with) then run it through a vtkStipper to convert the triangles into triangle strips. For example in C+ vtkPolyDataReader *reader = vtkPolyDataReader:New(); reader-SetFileName(yourdatafile.vtk); reader-GetOutput()-ReleaseDataFlagOn(); vtkTriangleFilter *tris = vtkTriangleFilter:New(); tris-SetInput(reader-GetOutput(); tris-GetOutput()-ReleaseDataFlagOn(); vtkStripper *strip = vtkStripper:New(); strip-SetInput(tris-GetOutput(); strip-GetOutput()-ReleaseDataFlagOn(); vtkPolyDataMapper *mapper = vtkPolyDataMapper:New(); mapper-ImmediateModeRenderingOn(); mapper-SetInput(tris-GetOutput();The only disadvantage to using triangle strips is that they require time to compute, so if your data is changing every time you render, it could actually be slower. Use a different filter or mapper This is a tough issue. In VTK there are typically a couple of ways to solve any problem. For example an image can be rendered as a polygon for each pixel, or it can be rendered as a single polygon with a texture map on it. For almost all cases the second approach will be much faster than the first event though VT
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年变化点管理考试题及答案
- 混凝土防水施工技术方案
- 钢结构连接节点设计优化方案
- 呼兰河传阅读测试题及答案
- 机械设备采购合同范本【三篇】
- 体育业务考试试题及答案
- 小学三级知识竞赛题及答案
- 济南市前期物业管理委托合同
- 广告学原理学习心得范例五篇
- 保障性住房项目可行性分析与风险评估方案
- 人才服务合同书
- 2025年工会财务大赛理论题库(附答案)
- 2025-2026学年统编版八年级上册道德与法治教学计划含教学进度表
- 矿井顶板事故防治课件
- 2025年工会入职考试试题及答案
- 2025年中国电力投资集团校园招聘笔试题型分析及备考策略
- 旅游服务安全知识培训课件
- 抗生素课件教学课件
- 公司章程制定合同协议书范本模板
- 2024人教PEP版三年级英语上册全册教案
- 中国慢性胃炎诊治指南(2022年)解读
评论
0/150
提交评论