read_tps#
- ktch.io.read_tps(file_path, as_frame=False, strict=True)[source]#
Read landmark data from a TPS file.
- Parameters:
- file_pathstr or path-like
Path to the TPS file.
- as_framebool, default=False
If True, return a
DataFrame.- strictbool, default=True
If True, raise
ValueErroron recoverable format inconsistencies (a landmark/point count that disagrees with the declaredLM=/POINTS=value, or a non-numericSCALE). If False, emit a warning and read as much as possible: the actual coordinate rows are used and an unparsableSCALEbecomesNone. Non-recoverable problems (a missingIDor a malformed coordinate row) always raise.
- Returns:
- resultTPSData or list of TPSData or pd.DataFrame
If
as_frame=False, returns aTPSDatafor a single specimen or a list ofTPSDatafor multiple specimens. Landmark coordinates are accessible viaTPSData.to_numpy(), and semilandmark curves via theTPSData.curvesattribute.If
as_frame=True, returns a concatenated DataFrame. When the file contains CURVES data, returns a tuple(landmarks, semilandmarks)of DataFrames.