SingleBody#
- class pyCGM2.Model.Models.singleBody.SingleBody(calibration_markers: List[str], tracking_markers: List[str], sequence='XYZ')#
Single rigid body model tracked by markers.
The technical frame of the body, named
Body, is defined from the first three calibration markers, with the fourth one as origin.- Parameters:
calibration_markers (List[str]) – Calibration markers (at least four).
tracking_markers (List[str]) – Tracking markers.
sequence (str, optional) – Axis construction sequence. Defaults to
"XYZ".
- __init__(calibration_markers: List[str], tracking_markers: List[str], sequence='XYZ')#
Methods
__init__(calibration_markers, tracking_markers)addNode(label, values, positionType)Add a node to the technical frame of the body.
calibrate(acq[, calibFramesOfInterest])Calibrate the body.
displayAxis(acq, label)Add the axes of the technical frame as points into an acquisition.
fit(acq)Compute the motion of the body (Soderkvist method).
getBody()Return the body segment.
getModel()Return the model.
getTrajectory(label)Return the global trajectory of a node.
globalize(localValues)Rotate local vectors into the global frame (translation not applied).
- addNode(label, values, positionType)#
Add a node to the technical frame of the body.
- Parameters:
label (str) – Node label.
values (np.ndarray) – Node position.
positionType (str) – Position type (
"Global"or"Local").
- calibrate(acq, calibFramesOfInterest: List[str] | None = None)#
Calibrate the body.
- Parameters:
acq (btk.btkAcquisition) – Calibration acquisition.
calibFramesOfInterest (Optional[List[int]], optional) – First and last frames used for the calibration. Defaults to None (all frames).
- displayAxis(acq, label)#
Add the axes of the technical frame as points into an acquisition.
- Parameters:
acq (btk.btkAcquisition) – Acquisition.
label (str) – Prefix of the axis points.
- fit(acq)#
Compute the motion of the body (Soderkvist method).
- Parameters:
acq (btk.btkAcquisition) – Motion acquisition.
- getBody()#
Return the body segment.
- Returns:
pyCGM2.Model.model.Segment – The segment.
- getModel()#
Return the model.
- Returns:
pyCGM2.Model.model.Model – The model.
- getTrajectory(label)#
Return the global trajectory of a node.
- Parameters:
label (str) – Node label.
- Returns:
np.ndarray – Trajectory (frames x 3).
- globalize(localValues)#
Rotate local vectors into the global frame (translation not applied).
- Parameters:
localValues (np.ndarray) – Local vectors (frames x 3).
- Returns:
np.ndarray – Global vectors (frames x 3).