@lassoan thank you for your reply. I have not used ITK before, although have heard of ITK. I’m extracting the surface using vtk flying edges, is that available from ITK? If not, can ITK write a “.vti” vtkImageData file?
To get me off the ground and running, what would be the equivalent code in ITK to produce the signed distance? How do I convert the following to ITK:
imageData = vtkImageData()
imageData.SetDimensions(size)
imageData.SetSpacing(spacing)
imageData.SetOrigin(origin)
implicitDistance = vtkImplicitPolyDataDistance()
implicitDistance.SetInput(reader.GetOutput())
noClosestPoint = [1.0e10, 1.0e10, 1.0e10]
# set tolerance
implicitDistance.SetNoClosestPoint(noClosestPoint)
signed_distance = vtkDoubleArray()
signed_distance.SetName("signed_distance")
signed_distance.SetNumberOfComponents(1)
signed_distance.SetNumberOfTuples(imageData.GetNumberOfPoints())
imageData.GetPointData().AddArray(signed_distance)
iter = vtkImagePointIterator(imageData)
while not iter.IsAtEnd():
x, y, z = iter.GetPosition()
distance = implicitDistance.EvaluateFunction([x, y, z])
signed_distance.SetValue(iter.GetId(), distance)
iter.Next()
Many thanks