write_tps#

ktch.io.write_tps(file_path, landmarks, image_path=None, idx=None, scale=None, semilandmarks=None, comments=None) None[source]#

Write landmark data to a TPS file.

Parameters:
file_pathstr or path-like

Output file path.

landmarksndarray or list of ndarray

Landmark coordinates. A 2D array of shape (n_landmarks, n_dim) for a single specimen, a 3D array of shape (n_specimens, n_landmarks, n_dim) for multiple specimens, or a list of per-specimen 2D arrays.

image_pathstr or list of str, optional

Image path(s) for the IMAGE field.

idxstr, int, or list, optional

Specimen identifier(s) for the ID field. Defaults to 0-based indices for multiple specimens.

scalefloat or list of float, optional

Scale factor(s) for the SCALE field.

semilandmarksarray-like or list, optional

Semilandmark curves. For a single specimen, a 2D array or a list of 2D arrays (one per curve). For multiple specimens, a list with one entry per specimen.

commentsstr or list of str, optional

Free-text comment(s) for the COMMENTS field.