海拔高度图*.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 ...
随机推荐
- 5-udev多路径
udev多路径 查看scsi的唯一标识符 用这个计算机可以识别 重启服务 想要看到下面的,可能重启服务也不行,那就需要重启计算机了 虚拟磁盘 安装这个包multipath 重启服务生效 重启计算机生效 ...
- [转]Writing Custom Middleware in ASP.NET Core 1.0
本文转自:https://www.exceptionnotfound.net/writing-custom-middleware-in-asp-net-core-1-0/ One of the new ...
- Maven与Ant比较
Maven与Ant比较 0 « 上一篇:Jenkins学习三:介绍一些Jenkins的常用功能» 下一篇:Jenkins学习四:Jenkins 邮件配置 posted @ 2015-03-25 16: ...
- Stack操作,栈的操作。
栈是先进后出,后进先出的操作. 有点类似浏览器返回上一页的操作, public class Stack<E>extends Vector<E> 是vector的子类. 常用方法 ...
- [LeetCode] Maximum Depth of Binary Tree 二叉树的最大深度
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...
- 侯捷老师C++大系之C++面向对象开发:(一)不带指针的类:Complex复数类的实现过程
一.笔记1.C++编程简介 2.头文件与类的声明 防卫式声明#ifndef __COMPLEX__#define __COMPLEX__ …… #endif头文件的布局模板简介template< ...
- Nginx 安装以及反向代理配置(windows)
安装 windows 下 Nginx 安装非常简单,下载地址 http://nginx.org/en/download.html. 选择红框这个,下载下来是个 zip 文件,解压.这时我们双击根目录的 ...
- jQuery 常用速查
jQuery 速查 基础 $("css 选择器") 选择元素,创建jquery对象 $("html字符串") 创建jquery对象 $(callback) $( ...
- 【Kindle】pdf转mobi适合kindle查看格式
pdf转mobi适合kindle查看格式 1.用到软件:福昕风腾PDF套件,切白边,PDF-Viewer,导出png图片ChainLP,图片转换为mobi文件<期间要下载kindlegen.ex ...
- NC6开发配置流程
1.功能注册 2.菜单注册 3.单据类型管理 4.单据模板初始化 5.查询模板初始化 6.功能节点默认模板设置 7.编码对象注册.编码规则定义