海拔高度图*.dem文件的读取—vtkDEMReader
vtkDEMReader reads digital elevation files and creates image data. Digital elevation files are produced by the US Geological Survey. A complete description of the DEM file is located at the USGS site. The reader reads the entire dem file and create a vtkImageData that contains a single scalar component that is the elevation in meters. The spacing is also expressed in meters. A number of get methods provide access to fields on the header.
vtkDEMReader 用于读入数字海拔图像文件,并创建图像数据(image data)。数字海拔图形文件,是由US Geological Survey美国的创建。DEM文件的完整描述参见 USGS site。vtkDEMReader类读取完整的dem文件,并创建vtkImageData类对象,在该类对象中包含有一个简单的scalar标量值,该值是以米为单位的海拔高度。空间间隔或间距(spacing)也是以米为单位。在头文件中,有许多get方法可以访问这些参数。

#ifndef INITIAL_OPENGL
#define INITIAL_OPENGL
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL)
VTK_MODULE_INIT(vtkInteractionStyle)
#endif
#include <iostream>
using namespace std;
#include "vtkSmartPointer.h"
#include <vtkSmartPointer.h>
#include <vtkImageActor.h>
#include <vtkImageMapToColors.h>
#include <vtkLookupTable.h>
#include <vtkDEMReader.h>
#include <vtkImageData.h>
#include <vtkImageMapper3D.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleImage.h>
#include <vtkRenderer.h> int main()
{
// Read the file
vtkSmartPointer<vtkDEMReader> reader = vtkSmartPointer<vtkDEMReader>::New();
reader->SetFileName("D:/Qt/VTK6.3.0/vtkExampleModelFiles/SainteHelens.dem");
reader->Update(); vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();
lut->SetHueRange(0.6, );
lut->SetSaturationRange(1.0, );
lut->SetValueRange(0.5, 1.0);
lut->SetTableRange(reader->GetOutput()->GetScalarRange());
// Visualize
vtkSmartPointer<vtkImageMapToColors> mapColors = vtkSmartPointer<vtkImageMapToColors>::New();
mapColors->SetLookupTable(lut);
mapColors->SetInputConnection(reader->GetOutputPort());
// Create an actor
vtkSmartPointer<vtkImageActor> actor =vtkSmartPointer<vtkImageActor>::New();
actor->GetMapper()->SetInputConnection(mapColors->GetOutputPort());
// Setup renderer
vtkSmartPointer<vtkRenderer> renderer =vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
renderer->ResetCamera();
// Setup render window
vtkSmartPointer<vtkRenderWindow> renderWindow =vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
// Setup render window interactor
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =vtkSmartPointer<vtkRenderWindowInteractor>::New();
vtkSmartPointer<vtkInteractorStyleImage> style =vtkSmartPointer<vtkInteractorStyleImage>::New();
renderWindowInteractor->SetInteractorStyle(style);
// Render and start interaction
renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindowInteractor->Initialize();
renderWindowInteractor->Start();
return ;
}
海拔高度图*.dem文件的读取—vtkDEMReader的更多相关文章
- IOS Android支持中文与本地文件的读取写入
转自http://www.xuanyusong.com/archives/1069 和http://www.benmutou.com/archives/2094 前几天有个朋友问我为什么在IOS平台中 ...
- Python对于CSV文件的读取与写入
今天天气"刚刚好"(薛之谦么么哒),无聊的我翻到了一篇关于csv文件读取与写入的帖子,作为测试小白的我一直对python情有独钟,顿时心血来潮,决定小搞他一下,分享给那些需要的小白 ...
- c++学习笔记—c++对txt文件的读取与写入
一.文件的输入输出 头文件fstream定义了三个类型支持文件IO:ifstream从给定文件读取数据.ofstream向一个给定文件写入数据.fstream读写给定数据.这些类型与cin和cout的 ...
- Django框架(上传Excel文件并读取)
博主今天整理下Django框架中上传Excel文件并读取 博主是要在管理平台中新增用例的维护功能,想着通过上传Excel文件来展示用例,下面是项目的路径图: 首先先建数据库模型 model.py 可以 ...
- 从PCD文件中读取点云数据
博客转载自:http://www.pclcn.org/study/shownews.php?lang=cn&id=84 在本小节我们学习如何从PCD文件中读取点云数据. 代码 章例1文件夹中, ...
- Unity3D研究院之IOS Android支持中文与本地文件的读取写
前几天有个朋友问我为什么在IOS平台中可以正常的读写文件可是在Android平台中就无法正常的读写.当时因为在上班所以我没时间来帮他解决,晚上回家后我就拿起安卓手机真机调试很快就定位问题所在,原 ...
- TF从文件中读取数据
从文件中读取数据 在TensorFlow中进行模型训练时,在官网给出的三种读取方式,中最好的文件读取方式就是将利用队列进行文件读取,而且步骤有两步: 把样本数据写入TFRecords二进制文件 从队列 ...
- Tableau学习Step2一数据文件的读取与统计图、表的概述
Tableau学习Step2一数据文件的读取与统计图.表的概述 本文首发于博客冰山一树Sankey,去博客浏览效果更好. 一. 前言 本教程通过一个案例从浅到深来学习Tableau知识 案例概述: 二 ...
- excel to datatable (c#用NPOI将excel文件内容读取到datatable数据表中)
将excel文件内容读取到datatable数据表中,支持97-2003和2007两种版本的excel 1.第一种是根据excel文件路径读取excel并返回datatable /// <sum ...
随机推荐
- 1.uniq去重命令讲解
uniq命令: 常见参数: -c,--count ***** 在每行旁边显示改行重复出现的次数 -d,--repeated 仅显示重复出现的行,2次或2次以上的行,默认的去重包 ...
- mysql报错: 1548-Cannot load from mysql.proc. The table is probably corrupted 解决办法
use mysql: ALTER TABLE `proc` MODIFY COLUMN `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT N ...
- nginx+php-fpm+mysql分离部署详解
相信大家将这三者部署到同一台主机应该已经不陌生了,今天在这里,给大家演示一下如何将三者部署到三台主机上. 实验系统:CentOS 6.6_x86_64 实验前提:大部分软件使用编译安装,请提前准备好编 ...
- Jenkins——构建、集成中的问题
准备 Jekins 安装插件 MsBuild Plugin Team Foundation Server Plug-in 配置环境变量 我的电脑中设置环境变量,Path中添加msbuild的路 ...
- python中的迭代、生成器等等
本人对编程语言实在是一窍不通啊...今天看了廖雪峰老师的关于迭代,迭代器,生成器,递归等等,word天,这都什么跟什么啊... 1.关于迭代 如果给定一个list或tuple,我们可以通过for循环来 ...
- [LeetCode] Valid Phone Numbers 验证电话号码
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...
- [LeetCode] Median of Two Sorted Arrays 两个有序数组的中位数
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two ...
- openwrt下部署adbyby去广告大师 免luci 带自启动,自动开启透明代理
最近朋友送了个360老路由器 C301,于是乎就掉进了智能路由器的坑, 玩智能路由器第一件事一定是去广告, 要么怎么对得起智能路由器- -! 路由器去广告当然首推广告屏蔽大师 www.adbyby.c ...
- asp.net获取服务器绝对路径和相对路径
绝对路径 AppDomain.CurrentDomain.SetupInformation.ApplicationBase 相对路径 Server.MapPath("~/")表示当 ...
- bootstrop 日期控件 datepicker被弹出框dialog覆盖的解决办法
筒子们在使用bootstrap的日期控件(datepicker , 现在官网提供的名称叫 datetimepicker)时可能会遇到如上图的问题这是啥原因造成的呢? 答案很简单时输出的优先级造成的(z ...