vtkAlgorithm 函数分析
2016-08-26 16:13
363 查看
vtkAlgorithm
NAME
vtkAlgorithm -
在VTK中所有源代码、滤波器、槽的父类。 (Superclass for all sources, filters, and sinks in VTK.)
Sources 通过读取(Reader 对象)或者创建数据对象(程序源对象)两种方式来产生数据;
Filters 处理输入数据并产生新的数据对象;
sinks []
Mappers 接收数据并将其转换为可被渲染引擎绘制的可视化表达;
Introduction
vtkAlgorithm 只能是一个算法、函数、滤波器。它的实例: 描述算法属性; 有 information 对象(vtkInformation)来描述输入、输出端的特性,这个算法主要的方法是 ProcessRequest().
【它的子类重要的就是改写 ProRequest() 这个方法】
SECTION Description
它定义了一个通用的接口来处理算法中的数据,包括可视化管线连接的输入、输出数据, 她们的类型是无关的。
可视化关系那楼是被 vtkExecutive 的实例控制的(Pipelines are controlled by instances of vtkExecutive)。
当 vtkAlgorithm 的实例被用在管线流程时,都会自动关联一个 vtkExecutive 的实例, vtkExecutive 主要控制数据流。
协作图
vtkFeatureEdges
示例:
#include <vtkSmartPointer.h>
#include <vtkFeatureEdges.h>
#include <vtkPolyData.h>
#include <vtkDiskSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
int main(int, char *[])
{
vtkSmartPointer<vtkDiskSource> diskSource = vtkSmartPointer<vtkDiskSource>::New();
diskSource->Update();
vtkSmartPointer<vtkFeatureEdges> featureEdges = vtkSmartPointer<vtkFeatureEdges>::New();
featureEdges->SetInputConnection(diskSource->GetOutputPort());
featureEdges->BoundaryEdgesOn();
featureEdges->FeatureEdgesOff();
featureEdges->ManifoldEdgesOff();
featureEdges->NonManifoldEdgesOff();
featureEdges->SetBoundaryEdges(100);
featureEdges->Update();
// Visualize
vtkSmartPointer<vtkPolyDataMapper> edgeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
edgeMapper->SetInputConnection(featureEdges->GetOutputPort());
vtkSmartPointer<vtkActor> edgeActor = vtkSmartPointer<vtkActor>::New();
edgeActor->SetMapper(edgeMapper);
vtkSmartPointer<vtkPolyDataMapper> diskMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
diskMapper->SetInputConnection(diskSource->GetOutputPort());
vtkSmartPointer<vtkActor> diskActor = vtkSmartPointer<vtkActor>::New();
diskActor->SetMapper(diskMapper);
// Create a renderer, render window, and interactor
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->AddActor(edgeActor);
renderer->AddActor(diskActor);
renderer->SetBackground(.3, .6, .3); // Background color green
renderWindow->Render();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
其实 vtkFeatureEdges 并没有重写 父类的 Update()
执行过程中结合 F11 和 F10 分析上述代码。
在执行 vtkAlgorithm::Update() 时,会调用
vtkExecutive* vtkAlgorithm::GetExecutive()
int vtkStreamingDemandDrivenPipeline::Update(int port)
int vtkExecutive::CheckAlgorithm(const char* method,
vtkInformation* request)
int vtkDemandDrivenPipeline::UpdateDataObject()
int vtkPolyDataAlgorithm::ProcessRequest(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
int vtkFeatureEdges::RequestData(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
vtkPolyDataAlgorithm 是 vtkAlgorithm 的子类重写 ProcessRequest(), 该函数中调用 RequestData(), 而 vtkFeatureEdges
是vtkPolyDataAlgorithm 子类vtkFeatureEdges重写了 RequestData() 这个函数
vtkExecutive
是所有管线指向的父类 (Superclass for all pipeline executives in VTK.)
包含了如果连接管线和执行管线的逻辑,这个类是所有 执行程序 executive 的父类。可执行程序是分布式的(相对集中),每一个滤波或者算法都有自己的可执行程序和其他可执行程序联系。
子类 vtkDemandDrivenPipeline, 这个类也有一个子类 vtkStreamingDemandDrivenPipeline。
vtkStreamingDemandDrivenPipeline 为旧版的 VTK管线提供了大部分的功能, 对于很多 algorithm 是默认执行的。
contains the logic of how to connect and execute a pipeline. This class is the superclass of all executives. Executives are
distributed (as opposed to centralized) and each filter/algorithm has its own executive that communicates with other executives. vtkExecutive has a subclass called vtkDemandDrivenPipeline which
in turn has a subclass called vtkStreamingDemandDrivenPipeline.
vtkStreamingDemandDrivenPipeline provides most of the functionality that was found in the old VTK pipeline and is the default executive for all algorithms if you do not specify one.
NAME
vtkAlgorithm -
在VTK中所有源代码、滤波器、槽的父类。 (Superclass for all sources, filters, and sinks in VTK.)
Sources 通过读取(Reader 对象)或者创建数据对象(程序源对象)两种方式来产生数据;
Filters 处理输入数据并产生新的数据对象;
sinks []
Mappers 接收数据并将其转换为可被渲染引擎绘制的可视化表达;
Introduction
vtkAlgorithm 只能是一个算法、函数、滤波器。它的实例: 描述算法属性; 有 information 对象(vtkInformation)来描述输入、输出端的特性,这个算法主要的方法是 ProcessRequest().
【它的子类重要的就是改写 ProRequest() 这个方法】
SECTION Description
它定义了一个通用的接口来处理算法中的数据,包括可视化管线连接的输入、输出数据, 她们的类型是无关的。
可视化关系那楼是被 vtkExecutive 的实例控制的(Pipelines are controlled by instances of vtkExecutive)。
当 vtkAlgorithm 的实例被用在管线流程时,都会自动关联一个 vtkExecutive 的实例, vtkExecutive 主要控制数据流。
协作图
vtkFeatureEdges
示例:
#include <vtkSmartPointer.h>
#include <vtkFeatureEdges.h>
#include <vtkPolyData.h>
#include <vtkDiskSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
int main(int, char *[])
{
vtkSmartPointer<vtkDiskSource> diskSource = vtkSmartPointer<vtkDiskSource>::New();
diskSource->Update();
vtkSmartPointer<vtkFeatureEdges> featureEdges = vtkSmartPointer<vtkFeatureEdges>::New();
featureEdges->SetInputConnection(diskSource->GetOutputPort());
featureEdges->BoundaryEdgesOn();
featureEdges->FeatureEdgesOff();
featureEdges->ManifoldEdgesOff();
featureEdges->NonManifoldEdgesOff();
featureEdges->SetBoundaryEdges(100);
featureEdges->Update();
// Visualize
vtkSmartPointer<vtkPolyDataMapper> edgeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
edgeMapper->SetInputConnection(featureEdges->GetOutputPort());
vtkSmartPointer<vtkActor> edgeActor = vtkSmartPointer<vtkActor>::New();
edgeActor->SetMapper(edgeMapper);
vtkSmartPointer<vtkPolyDataMapper> diskMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
diskMapper->SetInputConnection(diskSource->GetOutputPort());
vtkSmartPointer<vtkActor> diskActor = vtkSmartPointer<vtkActor>::New();
diskActor->SetMapper(diskMapper);
// Create a renderer, render window, and interactor
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->AddActor(edgeActor);
renderer->AddActor(diskActor);
renderer->SetBackground(.3, .6, .3); // Background color green
renderWindow->Render();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
其实 vtkFeatureEdges 并没有重写 父类的 Update()
执行过程中结合 F11 和 F10 分析上述代码。
在执行 vtkAlgorithm::Update() 时,会调用
vtkExecutive* vtkAlgorithm::GetExecutive()
int vtkStreamingDemandDrivenPipeline::Update(int port)
int vtkExecutive::CheckAlgorithm(const char* method,
vtkInformation* request)
int vtkDemandDrivenPipeline::UpdateDataObject()
int vtkPolyDataAlgorithm::ProcessRequest(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
int vtkFeatureEdges::RequestData(
vtkInformation *vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
vtkPolyDataAlgorithm 是 vtkAlgorithm 的子类重写 ProcessRequest(), 该函数中调用 RequestData(), 而 vtkFeatureEdges
是vtkPolyDataAlgorithm 子类vtkFeatureEdges重写了 RequestData() 这个函数
vtkExecutive
是所有管线指向的父类 (Superclass for all pipeline executives in VTK.)
包含了如果连接管线和执行管线的逻辑,这个类是所有 执行程序 executive 的父类。可执行程序是分布式的(相对集中),每一个滤波或者算法都有自己的可执行程序和其他可执行程序联系。
子类 vtkDemandDrivenPipeline, 这个类也有一个子类 vtkStreamingDemandDrivenPipeline。
vtkStreamingDemandDrivenPipeline 为旧版的 VTK管线提供了大部分的功能, 对于很多 algorithm 是默认执行的。
contains the logic of how to connect and execute a pipeline. This class is the superclass of all executives. Executives are
distributed (as opposed to centralized) and each filter/algorithm has its own executive that communicates with other executives. vtkExecutive has a subclass called vtkDemandDrivenPipeline which
in turn has a subclass called vtkStreamingDemandDrivenPipeline.
vtkStreamingDemandDrivenPipeline provides most of the functionality that was found in the old VTK pipeline and is the default executive for all algorithms if you do not specify one.
相关文章推荐
- Oracle 分析函数的使用
- BO2K源码分析(一 WinMain()函数)
- Oracle 9i 分析函数参考手册
- Oracle 9i 分析函数参考手册
- WinCE 开始菜单StartMenu_Create()函数代码分析
- [原创]MFC框架程序WINMAIN函数分析(一)
- IP函数分析_APUE
- Oracle分析函数学习笔记3
- oracle分析函数(二)
- BO2k源代码分析(一)----WinMain()函数
- Intel平台下linux中 ELF文件动态链接的加载、解析及实例分析(二): 函数解析与卸载
- 【分析】利用格式化串覆盖*printf()系列函数本身的返回地址
- 【分析】C++中通过溢出覆盖虚函数指针列表执行代码
- VC环境下对函数调用的汇编分析【原创】
- 性能测试-函数性能分析篇
- VxWorks romStar函数分析
- Win32程序函数调用时堆栈变化情况分析(zt)
- 语法分析表产生器的代码之一:主函数main.cpp
- Oracle 分析函数使用介绍
- WinCE 开始菜单StartMenu_Create()函数代码分析