combine_landmarks_and_curves#
- ktch.landmark.combine_landmarks_and_curves(landmarks, curves, curve_landmarks=None, anchor_first=False, anchor_last=False)[source]#
Combine TPS landmarks and curves into unified GPA format.
Converts the separate landmarks and curves format from read_tps() into the combined format required by GeneralizedProcrustesAnalysis.
- Parameters:
- landmarksndarray, shape (n_specimens, n_landmarks, n_dim)
Fixed landmarks from TPS file.
- curveslist of list of ndarray
Curve semilandmarks from TPS file. curves[specimen_idx][curve_idx] = ndarray (n_points, n_dim)
- curve_landmarkslist of tuple of (int, int), optional
Landmark indices that anchor each curve endpoint. Each tuple
(start_lm, end_lm)specifies the landmark indices (in the landmarks array) that the first and last semilandmarks of that curve connect to. When provided, all semilandmarks slide and the anchoring landmarks serve as the before/after neighbors for the curve endpoints.- anchor_firstbool, default=False
If True, first point of each curve is treated as a fixed anchor (does not slide). Ignored when
curve_landmarksis provided.- anchor_lastbool, default=False
If True, last point of each curve is treated as a fixed anchor (does not slide). Ignored when
curve_landmarksis provided.
- Returns:
- combinedndarray, shape (n_specimens, n_total_points, n_dim)
All coordinates concatenated: landmarks followed by curve points.
- slider_matrixndarray, shape (n_sliders, 3)
Topology matrix [before, slider, after] for GPA.
- curve_infodict
Information about the combined structure: - ‘n_landmarks’: number of original fixed landmarks - ‘n_curve_points’: total number of curve points added - ‘curve_offsets’: starting index of each curve in combined array - ‘curve_lengths’: number of points in each curve