Dear Steve
Thanks a lot for you guidance. I can extract these intersection points with the following commands:
import vtk
import os
filenameCLMergedMR = "centerlinesMergedMR.vtp";
readerCLMergedMR = vtk.vtkXMLPolyDataReader();
readerCLMergedMR.SetFileName(filenameCLMergedMR);
readerCLMergedMR.Update();
polydata = readerCLMergedMR.GetOutput();
points = polydata.GetPoints();
numPoints = readerCLMergedMR.GetNumberOfPoints();
lineCellArray = vtk.vtkCellArray();
lineCellArray.InsertNextCell(numPoints);
for i in range(0,numPoints):
lineCellArray.InsertCellPoint(i)
linePolyData = vtk.vtkPolyData()
linePolyData.SetPoints(points)
linePolyData.SetLines(lineCellArray)
plane = vtk.vtkPlane()
plane.SetOrigin(0, 0, 0)
plane.SetNormal(0, 0, 1)
clipper = vtk.vtkClipPolyData()
clipper.SetInputConnection(readerCLMergedMR.GetOutputPort())
cutEdges = vtk.vtkCutter()
cutEdges.SetInputConnection(readerCLMergedMR.GetOutputPort())
cutEdges.SetCutFunction(plane)
cutEdges.GenerateCutScalarsOn()
cutStrips = vtk.vtkStripper()
cutStrips.SetInputConnection(cutEdges.GetOutputPort())
cutStrips.Update()
cutPoly = vtk.vtkPolyData()
cutPoly.SetPoints(cutStrips.GetOutput().GetPoints())
writer = vtk.vtkXMLPolyDataWriter()
writer.SetFileName("intersectionPoints.vtp")
writer.SetInputDataObject(cutStrips.GetOutput())
writer.Write()
Thanks a lot,
Shahrokh