当前位置:网站首页>vtk学习之Pipeline管线
vtk学习之Pipeline管线
2022-06-10 08:36:00 【Christo3】
1. 实践
#include <vtkSmartPointer.h>
#include <vtkStructuredPointsReader.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkMarchingCubes.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
//测试文件:data/head.vtk
int main(int argc, char* argv[])
{
const char* str = "D:\\workshop\\VTK\\VTK\\vtk_source\\Examples\\Examples\\Chap02\\data\\head.vtk";
//读入Structured_Points类型的vtk文件。
vtkSmartPointer<vtkStructuredPointsReader> reader =
vtkSmartPointer<vtkStructuredPointsReader>::New();
reader->SetFileName(str);
//用移动立方体法提取等值面。
vtkSmartPointer<vtkMarchingCubes> marchingCubes =
vtkSmartPointer<vtkMarchingCubes>::New();
marchingCubes->SetInputConnection(reader->GetOutputPort());
marchingCubes->SetValue(0,500);
//将生成的等值面数据进行Mapper
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(marchingCubes->GetOutputPort());
//把Mapper的输出送入渲染引擎进行显示
//渲染引擎部分
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
renderer->SetBackground(1.0, 1.0, 1.0);
vtkSmartPointer<vtkRenderWindow> renWin =
vtkSmartPointer<vtkRenderWindow>::New();
renWin->AddRenderer(renderer);
renWin->SetSize( 640, 480 );
renWin->Render();
renWin->SetWindowName("vtkPipelineDemo");
vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renWin);
interactor->Initialize();
interactor->Start();
//
return EXIT_SUCCESS;
}






边栏推荐
- 【密码学】AES加解密
- The R language uses the select function of the dplyr package to customize and change the order of two data columns in the dataframe data
- 2022.06.07 learning contents
- [DRM Audio Converter] noteburner iTunes DRM audio converter download
- c#线程间操作无效,去掉这个检查的
- 盘点新加坡旅游宣传片中不可错过的景点
- What objects are suitable for automated testing?
- The R language uses the PDF function to save the visual image results to the PDF file, uses the PDF function to open the image device, and uses the dev.off function to close the image device
- 泰国曼谷大城府被福布斯评为“后疫情时代最值得一去的城市”
- What tests are included in the functional test? What is the role of each?
猜你喜欢

世界海洋日 | 徜徉于新泽西海洋生物水族馆,记录趣味纽约旅行

If you want to change careers, why do you prefer software testing?

Industry application saves 5g? Don't think too much. It's still mobile phone users who save 5g

Take stock of the tourist attractions in Singapore

Ten working principles for STM32 MPU developers

World Ocean Day | visit the New Jersey Marine Life Aquarium and record interesting new york trips

Credit card customer churn forecast

What happens when your Huaqiangbei earphone falls into the water? How to restore sound quality?

Test preparation computer database day 3 MySQL

Comment le système d'affaires devrait - il être antivirus?
随机推荐
The R language uses the select function of the dplyr package to customize and change the order of two data columns in the dataframe data
What objects are suitable for automated testing?
Restore of sqlserver different database names
Program coding in programming
c#线程间操作无效,去掉这个检查的
Pwn: research on random function
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、比较不同K值超参数下模型准确率和误分类率(miss classification error)
世界海洋日 | 徜徉于新泽西海洋生物水族馆,记录趣味纽约旅行
完美人生PerfectLife——角色:Chenyuxin
USB type -a -b -c interface
2022.06.07 learning contents
【密码学】AES加解密
[DRM Audio Converter] noteburner iTunes DRM audio converter download
2022.06.07学习内容
Comment le système d'affaires devrait - il être antivirus?
Service management and communication, basic principle analysis
一个数组对象中取出需要的多个字段以及值去掉不要的
R语言使用pdf函数将可视化图像结果保存到pdf文件中、使用pdf函数打开图像设备、使用dev.off函数关闭图像设备
Ayutthaya, Bangkok, Thailand, was rated as "the most worthwhile city to visit in the post epidemic era" by Forbes
R语言使用epiDisplay包的pyramid函数可视化金字塔图