Hello,
I wanted to find the minimum distance between the curve (defined by a list of point in a vtkmrmlCurveNode) and other nodes which are vtkPolyData by using (I think) a vtkPolyDataDistanceFIlter. I started by created this curve node with the method where pointPositions is my list of points:
curveNode = slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLMarkupsCurveNode”)
slicer.util.updateMarkupsControlPointsFromArray(curveNode, pointPositions)
After that I’ve tried to use the vtkPolyDataDistanceFIlter:
distanceFilter = vtk.vtkDistancePolyDataFilter()
curveA = curve.GetCurveWorld()
mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(curveA)
distanceFilter.SetInputConnection(0,obst.GetPolyDataConnection())
distanceFilter.SetInputConnection(1,mapper.GetOutputPort())
distanceFilter.Update()
d = distanceFilter.GetOutput().GetPointData().GetScalars().GetRange()[0]
My problem is that there is an error for the SetInputConnection of the curve part If I don’t use a mapper, and with the mapper I get a ‘nontype’ for the last line above. I’ve tried by using curve and it is not working.
Is there a method to resolve the problem please?