from infepy.morph import morphing
from infepy.preprocessing import read_landmarks, read_nodes, write_outputJupyter Notebook
This shows an alternative use of the library. It is possible to use the function and create a .py file or .ipynb notebook.
Import the library
Load the data
Define the paths
source_landmarks_file = "../test_data/source/landmarks_source.fcsv"
target_landmarks_file = "../test_data/target/100014/landmarks_target.csv"
source_mesh_file = "../test_data/humerus_sx.key"
destination_file = "../test_data/target/100014/humerus_morphed.key"Read the files
Call the function read_landmarks() and read_nodes()
source_landmarks = read_landmarks(source_landmarks_file)
target_landmarks = read_landmarks(target_landmarks_file)
source_mesh = read_nodes(source_mesh_file)Morph the mesh
morphed_mesh = morphing(source_landmarks, target_landmarks, source_mesh, func= "thin_plate_spline", smoothing=0)Write file output
write_output(morphed_mesh, destination_file, source_mesh_file)