我编写了以下代码(为了更好地阅读而进行了简化)来读取结构化网格并在我的体积中绘制一个剖切面。关于可视化,一切都很好:我得到了一个很好的等高线图,剖切面穿过它。但是,我未能提取切割平面中显示的数据。有没有办法提取与我的切割平面相关的坐标和数据(“强度” - 见下文)?
self._reader = vtk.vtkXMLStructuredGridReader()
self._reader.SetFileName(filename)
self._reader.Update()
self._reader.GetOutput().GetPointData().SetActiveScalars("Intensity")
self._isoContour = vtk.vtkContourFilter()
self._isoContour.SetInputConnection(self._reader.GetOutputPort())
self._isoContour.SetValue(0,100)
self.mapper = vtk.vtkPolyDataMapper()
self.mapper.SetInputConnection(self._reader.GetOutputPort())
self.mapper.ScalarVisibilityOn()
self.mapper.Update()
self._surface = vtk.vtkActor()
self._surface.SetMapper(self.mapper)
self._surface.GetProperty().SetRepresentationToWireframe()
plane = vtk.vtkPlane()
plane.SetOrigin(self._reader.GetOutput().GetCenter())
plane.SetNormal(0, 0, 1)
planeCut = vtk.vtkCutter()
planeCut.SetInput(self._reader.GetOutput())
planeCut.SetCutFunction(plane)
cutMapper = vtk.vtkPolyDataMapper()
cutMapper.SetInputConnection(planeCut.GetOutputPort())
cutMapper.SetLookupTable(table)
cutMapper.SetScalarRange(0,100)
cutActor = vtk.vtkActor()
cutActor.SetMapper(cutMapper)
self._renderer.AddActor(self._surface)
self._renderer.AddActor(cutActor)
self._iren.Render()
非常感谢你的帮助
埃里克