Preprocessing

This module store processing funtions.

source

read_toml

 read_toml (config_file='../test_data/config.toml')

Read configuration file containing the relative paths to source and target geometries and landmarks.

Type Default Details
config_file str ../test_data/config.toml path to the config file
read_toml("../test_data/config.toml")
{'source': {'path': '../test_data/source',
  'filename_mesh': 'humerus_sx.key',
  'filename_landmarks': 'landmarks_source.fcsv'},
 'target': {'path': '../test_data/target',
  'filename_landmarks': 'landmarks_target.fcsv'}}

source

read_nodes

 read_nodes (path_to_file:str)

Reads the nodes from the source template file, which can be either a .key/.k file or a .csv file. Returns a DataFrame containing the node x, y, and z displacements.

Type Details
path_to_file str Path to file containing source template from the config file.
Returns DataFrame Numpy array of shape [n_nodes, x,y,z_displacement]
read_nodes(mesh)

source

read_landmarks

 read_landmarks (path_to_file:str)

Reads landmarks from a file, which can be in .csv, .key, or .k format. Returns a DataFrame containing the landmarks with the following columns, ID label and x, y, z coordinates.

Type Details
path_to_file str File containing Landmarks
Returns DataFrame Dataframe of length [n_landmarks]. Columns format [ID - label, x,y,z]
read_landmarks(source_landmarks)

source

write_output

 write_output (morphed_mesh:numpy.ndarray, morphed_file:numpy.ndarray,
               mesh_file:numpy.ndarray)

Write output file for the morphed mesh in .key file format.

Type Details
morphed_mesh ndarray Morphed mesh
morphed_file ndarray Path to directory to save the file
mesh_file ndarray Path to the source mesh from config file
write_output(morphed_mesh,morphed_file,mesh_file )