我有一个用python编写的Paraview programmable filter
,我正在一个点表上运行,将RGB颜色指定为UnsignedCharArray
。我只是停留在代码的一部分来得到R,G,B字段在这个范围内的值。以下是表格示例:
下面是示例代码:
ids = self.GetInput()
ods = self.GetOutput()
ocolors = vtk.vtkUnsignedCharArray()
ocolors.SetName("colors")
ocolors.SetNumberOfComponents(3)
ocolors.SetNumberOfTuples(ids.GetNumberOfPoints())
inArray = ids.GetPointData().GetArray(0)
for x in range(0, ids.GetNumberOfPoints()):
rF = inArray.GetValue(x) # here I need something like GetValue(x, "R")
gF = inArray.GetValue(x) # here I need something like GetValue(x, "G")
bF = inArray.GetValue(x) # here I need something like GetValue(x, "B")
ocolors.SetTuple3(x, rF,gF,bF)
ods.GetPointData().AddArray(ocolors)
有人知道我怎么处理吗?在
所以正确的方法是:
相关问题 更多 >
编程相关推荐