TPSData#
- class ktch.io.TPSData(specimen_name: str, landmarks: ~numpy.ndarray = <property object>, image_path: str = None, scale: float = None, curves: list[~numpy.ndarray] = None, comments: str = None)[source]#
Data for a single specimen in TPS format.
- Attributes:
- specimen_namestr
Specimen name (ID field in TPS).
- landmarksndarray of shape (n_landmarks, n_dim)
Landmark coordinates.
n_dimis 2 or 3.- image_pathstr, optional
Path to the associated image (IMAGE field in TPS).
- scalefloat, optional
Scale factor (SCALE field in TPS).
- curveslist of ndarray, optional
Semilandmark curves. Each array has shape
(n_points, n_dim).- commentsstr, optional
Free-text comments (COMMENTS field in TPS).
- to_dataframe()[source]#
Return landmark coordinates as a DataFrame.
- Returns:
- dfpd.DataFrame
DataFrame with columns
x,y(andzfor 3D). Index is a MultiIndex(specimen_id, coord_id).
- to_dataframe_with_curves()[source]#
Return landmark and optional curve DataFrames.
- Returns:
- df_landmarkspd.DataFrame
- df_curveslist of pd.DataFrame or None