Warping With Landmarks

I’m attempting to warp a template onto a patient using a landmark. From my understanding of the 3-Matic Scripting guide, the landmark input into the warping command should be a list of three floats. When I attempt to execute the command though, I get a ValueError stating that the inputs must be convertible to a tuple with a length of 3. I don’t understand why I’m getting this error. Could I please get some help figuring out how to properly execute the warping command with landmarks?

Also, before you ask, yes I’ve tried converting the coordinate lists to tuples instead. It yields the same error.

Here is the script that I’m running:


Here is the output:
image
Here is the error message:

Thank you in advance for your assistance,

Ian

Hi Ian,

The requirement for fixed landmarks and moving_landmarks parameters is to have the point coordinates/coordinates of points in a list as below:
22-9-2021 11-12-11 AM

you can try to script as below:

fixed_landmarks = [point1.coordinates, point2.coordinates,…] # point coordinates should be in the form of tuple : (x, y, z)
moving_landmarks = [template_point1.coordinates, template_point2.coordinates,…]
trimatic.warp_part(fixed_entity=dataset, moving_entity=template, bad_countour_correspondence=True, fixed_landmarks=fixed_landmarks, moving landmarks= moving_landmarks)

Please let me know if this doesn’t work :)

Kind regards,
Imanina

Hello Imanina,

Thank you for your help. That did seem to fix that error in the script, but now I’m running into another error. The code is failing to warp the part because “at least one moving landmark could not be located on the moving entity”

Here is the code that’s producing the error. The variable “template” and all the objects in “dataset” are trimatic.Part. As you can see in line 5, I tried to prevent the error by calculating the nearest point (trimatic.compute_closest_point) on the actual template entity in question within the error, so I have no idea why it’s possible for the error to occur.

Thank you in advance for your assistance,
Ian