在 Paraview 中的 3D 体积上叠加线图
Overlay a line plot on a 3D volume in Paraview
我想在提取数据的线上可视化线图(从沿着模型 'surface' 的线过滤器上的图提取)。 Plot Over Line 过滤器允许通过数据值对线进行着色,并进行较小的转换,但我想将 Z 位置设置为数据值的乘数。
这是一张基础图片,没有用 Z 线乘以数据值:
我导出了线图数据,将数据值(我们称之为量级)转换为伪高程,并将结果导入为 x、y、z 点集(其中 x、y 是水平坐标, z = 表示为高程坐标的幅度)。
如何沿着这些点绘制曲线?没有应用任何过滤器,它只是绘制为 space.
中的一系列点
还有别的办法吗?我确定这很简单,但我看不到它。
修改自问题How to connect points in paraview? using the 'Transform the input' example given in the Paraview public Wiki's page on the programmable python filter, and the vtk docs:
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
points = [i, i+1]
# VTK_LINE is 3
pdo.InsertNextCell(3, 2, points)
另外,这里还有另一个脚本可以完成类似的工作,它是根据与上一个示例相同页面上的几个其他示例修改而来的:
# Get a vtk.PolyData object for the input
pdi = self.GetPolyDataInput()
# Get a vtk.PolyData object for the output
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
# Points for the line:
newPoints = vtk.vtkPoints()
for i in range(0, numPoints):
# Generate the new points from the input
coord = pdi.GetPoint(i)
x, y, z = coord[:3]
newPoints.InsertPoint(i, x, y, z)
# Add the new points to the PolyData object:
pdo.SetPoints(newPoints)
# Make a line from the new points:
aPolyLine = vtk.vtkPolyLine()
#Indicate the number of points along the line
aPolyLine.GetPointIds().SetNumberOfIds(numPoints)
for i in range(0,numPoints):
#Add the points to the line. The first value indicates
#the order of the point on the line. The second value
#is a reference to a point in a vtkPoints object. Depends
#on the order that Points were added to vtkPoints object.
#Note that this will not be associated with actual points
#until it is added to a vtkPolyData object which holds a
#vtkPoints object.
aPolyLine.GetPointIds().SetId(i, i)
#Allocate the number of 'cells' that will be added. We are just
#adding one vtkPolyLine 'cell' to the vtkPolyData object.
pdo.Allocate(1, 1)
#Add the poly line 'cell' to the vtkPolyData object.
pdo.InsertNextCell(aPolyLine.GetCellType(), aPolyLine.GetPointIds())
两种解决方案都会产生这样的图像(在对“属性”面板进行一些调整之后):
我想在提取数据的线上可视化线图(从沿着模型 'surface' 的线过滤器上的图提取)。 Plot Over Line 过滤器允许通过数据值对线进行着色,并进行较小的转换,但我想将 Z 位置设置为数据值的乘数。
这是一张基础图片,没有用 Z 线乘以数据值:
我导出了线图数据,将数据值(我们称之为量级)转换为伪高程,并将结果导入为 x、y、z 点集(其中 x、y 是水平坐标, z = 表示为高程坐标的幅度)。
如何沿着这些点绘制曲线?没有应用任何过滤器,它只是绘制为 space.
中的一系列点还有别的办法吗?我确定这很简单,但我看不到它。
修改自问题How to connect points in paraview? using the 'Transform the input' example given in the Paraview public Wiki's page on the programmable python filter, and the vtk docs:
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
points = [i, i+1]
# VTK_LINE is 3
pdo.InsertNextCell(3, 2, points)
另外,这里还有另一个脚本可以完成类似的工作,它是根据与上一个示例相同页面上的几个其他示例修改而来的:
# Get a vtk.PolyData object for the input
pdi = self.GetPolyDataInput()
# Get a vtk.PolyData object for the output
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
# Points for the line:
newPoints = vtk.vtkPoints()
for i in range(0, numPoints):
# Generate the new points from the input
coord = pdi.GetPoint(i)
x, y, z = coord[:3]
newPoints.InsertPoint(i, x, y, z)
# Add the new points to the PolyData object:
pdo.SetPoints(newPoints)
# Make a line from the new points:
aPolyLine = vtk.vtkPolyLine()
#Indicate the number of points along the line
aPolyLine.GetPointIds().SetNumberOfIds(numPoints)
for i in range(0,numPoints):
#Add the points to the line. The first value indicates
#the order of the point on the line. The second value
#is a reference to a point in a vtkPoints object. Depends
#on the order that Points were added to vtkPoints object.
#Note that this will not be associated with actual points
#until it is added to a vtkPolyData object which holds a
#vtkPoints object.
aPolyLine.GetPointIds().SetId(i, i)
#Allocate the number of 'cells' that will be added. We are just
#adding one vtkPolyLine 'cell' to the vtkPolyData object.
pdo.Allocate(1, 1)
#Add the poly line 'cell' to the vtkPolyData object.
pdo.InsertNextCell(aPolyLine.GetCellType(), aPolyLine.GetPointIds())
两种解决方案都会产生这样的图像(在对“属性”面板进行一些调整之后):