简体   繁体   English

如何在VTK中使用vtkInformation对象?

[英]How to use vtkInformation objects in VTK?

I am trying to pass some extra information (string data) in a vtkMultiBlockDataSet using its meta data vtkInformation container. 我试图使用其元数据vtkInformation容器在vtkMultiBlockDataSet中传递一些额外的信息(字符串数据)。 I have problems retrieving the data from the information object. 我从信息对象检索数据时遇到问题。 The following code in python shows the problem: python中的以下代码显示了该问题:

import vtk
from vtk.util import keys

mb = vtk.vtkMultiBlockDataSet()
mb.SetBlock(0, vtk.vtkPolyData())

metaData = mb.GetMetaData(0)
key = keys.MakeKey(keys.StringKey, "Key", "x")
metaData.Set(key, "Value")

# Going to some other place in space and time    

key2 = keys.MakeKey(keys.StringKey, "Key", "x")
print metaData.Get(key2)

The print in the last line prints None . print在最后一行打印None

How is it possible for me to retrieve the value of Key from the information container without using exactly the same key? 我如何在不使用完全相同的键的情况下从信息容器中检索Key的值? (Using key in the last line above, prints the correct value) (使用上面最后一行中的key ,打印正确的值)

As @Mathieu and @normanius pointed out: It is not possible. 正如@Mathieu和@normanius指出的那样:这是不可能的。 Instead vtkFieldData can be used to transfer information through the vtk pipeline. 而是可以使用vtkFieldData通过vtk管道传输信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM