Model#
- class pyCGM2.Model.model.Model#
Base class representing a biomechanical model.
A Model consists of segments, joints, and body segment parameters.
- __init__()#
Methods
__init__
()addAnthropoInputParameters
(iDict[, optional])Add measured anthropometric data to the model.
addChain
(label, indexSegmentList)Add a segment chain to the model.
addJoint
(label, proxLabel, distLabel, ...)Add a joint to the model.
addSegment
(label, index, sideEnum[, ...])Add a segment to the model.
Check if a calibration property matches a specific value.
decomposeTrackingMarkers
(acq, ...)Decompose tracking markers to their components.
displayMotionCoordinateSystem
(acqui, ...[, ...])Display a motion coordinate system.
displayMotionViconCoordinateSystem
(acqui, ...)Display a motion Vicon coordinate system.
displayStaticCoordinateSystem
(aquiStatic, ...)Display a static coordinate system.
[Obsolete] Return the body part represented by the model.
Return the center of mass trajectory.
getClinicalDescriptor
(dataType, ...[, ...])Return a clinical descriptor.
getJoint
(label)Retrieve a Joint instance based on its label.
Retrieve a list of all joint labels.
getProperty
(propertyLabel)Return a specified property.
getSegment
(label)Retrieve a Segment instance based on its label.
getSegmentByIndex
(index)Retrieve a Segment instance based on its index.
getSegmentIndex
(label)Retrieve the index of a Segment based on its label.
Retrieve a list of all segment labels.
isCalibrationProperty
(label)Check if a calibration property exists by its label.
isProperty
(label)Check if a property exists by its label.
removeJoint
(jointLabels)Remove Joint instances based on their labels.
removeSegment
(segmentLabels)Remove Segment instances based on their labels.
setBodyPart
(bodypart)[Obsolete] Specify which body part is represented by the model.
setCalibrationProperty
(propertyLabel, value)Set or update a calibration property in the property dictionary.
setCentreOfMass
(com)Set the center of mass trajectory.
setClinicalDescriptor
(jointOrSegmentLabel, ...)Set a clinical descriptor.
setCoordinateSystemDefinition
(segmentLabel, ...)Set coordinate system definition.
setProperty
(propertyLabel, value)Set or update a property in the property dictionary.
setStaticFilename
(name)Set the static filename used for static calibration.
updateSegmentFromCopy
(targetLabel, segmentToCopy)Update a segment from a copy of another segment instance.
- addAnthropoInputParameters(iDict: Dict[str, Any], optional: Dict[str, Any] | None = None)#
Add measured anthropometric data to the model. :param iDict: Required anthropometric data. :type iDict: Dict[str, Any] :param optional: Optional anthropometric data. :type optional: Optional[Dict[str, Any]]
- addChain(label: str, indexSegmentList: List[int])#
Add a segment chain to the model. :param label: Label of the chain. :type label: str :param indexSegmentList: Indexes of the segments constituting the chain. :type indexSegmentList: List[int]
- addJoint(label: str, proxLabel: str, distLabel: str, sequence: str, nodeLabel: str)#
Add a joint to the model. :param label: Label of the joint. :type label: str :param proxLabel: Label of the proximal segment. :type proxLabel: str :param distLabel: Label of the distal segment. :type distLabel: str :param sequence: Sequence angle. :type sequence: str :param nodeLabel: Node label. :type nodeLabel: str
- addSegment(label: str, index: int, sideEnum: SegmentSide, calibration_markers: List[str] = [], tracking_markers: List[str] = [], cloneOf: bool = False)#
Add a segment to the model. :param label: Label of the segment. :type label: str :param index: Index of the segment. :type index: int :param sideEnum: Body side of the segment. :type sideEnum: enums.SegmentSide :param calibration_markers: Labels of the calibration markers. Defaults to []. :type calibration_markers: List[str], optional :param tracking_markers: Labels of the tracking markers. Defaults to []. :type tracking_markers: List[str], optional :param cloneOf: Indicates if the segment is a clone of another. Defaults to False. :type cloneOf: bool, optional
- checkCalibrationProperty(CalibrationParameterLabel: str, value: Any) bool #
Check if a calibration property matches a specific value. :param CalibrationParameterLabel: The calibration parameter label. :type CalibrationParameterLabel: str :param value: The value to compare with the calibration property. :type value: Any
- Returns:
bool – True if the calibration property matches the specified value, False otherwise.
- decomposeTrackingMarkers(acq: btkAcquisition, TechnicalFrameLabel: str)#
Decompose tracking markers to their components. :param acq: BTK acquisition instance. :type acq: btk.btkAcquisition :param TechnicalFrameLabel: Label of the technical frame. :type TechnicalFrameLabel: str
- displayMotionCoordinateSystem(acqui: btkAcquisition, segmentLabel: str, targetPointLabel: str, referential: str = 'Anatomic')#
Display a motion coordinate system. :param acqui: BTK acquisition instance. :type acqui: btk.btkAcquisition :param segmentLabel: Segment label. :type segmentLabel: str :param targetPointLabel: Label of the point defining axis limits. :type targetPointLabel: str :param referential: Type of segment coordinate system to display (default is “Anatomic”). :type referential: str, Optional
- displayMotionViconCoordinateSystem(acqui: btkAcquisition, segmentLabel: str, targetPointLabelO: str, targetPointLabelX: str, targetPointLabelY: str, targetPointLabelZ: str, referential: str = 'Anatomic')#
Display a motion Vicon coordinate system. :param acqui: BTK acquisition instance. :type acqui: btk.btkAcquisition :param segmentLabel: Segment label. :type segmentLabel: str :param targetPointLabelO: Label for the origin point. :type targetPointLabelO: str :param targetPointLabelX: Label for the X-axis point. :type targetPointLabelX: str :param targetPointLabelY: Label for the Y-axis point. :type targetPointLabelY: str :param targetPointLabelZ: Label for the Z-axis point. :type targetPointLabelZ: str :param referential: Type of segment coordinate system to display (default is “Anatomic”). :type referential: str, Optional
- displayStaticCoordinateSystem(aquiStatic: btkAcquisition, segmentLabel: str, targetPointLabel: str, referential: str = 'Anatomic')#
Display a static coordinate system. :param aquiStatic: BTK acquisition instance from a static C3D. :type aquiStatic: btk.btkAcquisition :param segmentLabel: Segment label. :type segmentLabel: str :param targetPointLabel: Label of the point defining axis limits. :type targetPointLabel: str :param referential: Type of segment coordinate system to display (default is “Anatomic”). :type referential: str, Optional
- getBodyPart() str #
[Obsolete] Return the body part represented by the model. :Returns: str – The body part represented by the model.
- getCentreOfMass()#
Return the center of mass trajectory. :Returns: np.ndarray – The center of mass trajectory.
- getClinicalDescriptor(dataType: DataType, jointOrSegmentLabel: str, projection: MomentProjection | None = None) Dict[str, Any] | None #
Return a clinical descriptor. :param dataType: Data type. :type dataType: enums.DataType :param jointOrSegmentLabel: Segment or joint label. :type jointOrSegmentLabel: str :param projection: Joint moment projection. :type projection: Optional[enums.MomentProjection]
- Returns:
Optional[Dict[str, Any]] – Clinical descriptor if found, None otherwise.
- getJoint(label: str) Joint | None #
Retrieve a Joint instance based on its label. :param label: Label of the joint. :type label: str
- Returns:
Optional[Joint] – The Joint instance if found, None otherwise.
- getJointList() List[str] #
Retrieve a list of all joint labels. :Returns: List[str] – List of joint labels.
- getProperty(propertyLabel: str) Any #
Return a specified property. :param propertyLabel: The property label. :type propertyLabel: str
- Returns:
Any – The value of the specified property.
- getSegment(label: str)#
Retrieve a Segment instance based on its label. :param label: Label of the Segment. :type label: str
- Returns:
Optional[Segment] – The Segment instance if found, None otherwise.
- getSegmentByIndex(index: int) Segment | None #
Retrieve a Segment instance based on its index. :param index: Index of the Segment. :type index: int
- Returns:
Optional[Segment] – The Segment instance if found, None otherwise.
- getSegmentIndex(label: str) int | None #
Retrieve the index of a Segment based on its label. :param label: Label of the Segment. :type label: str
- Returns:
Optional[int] – The index of the Segment if found, None otherwise.
- getSegmentList() List[str] #
Retrieve a list of all segment labels. :Returns: List[str] – List of segment labels.
- isCalibrationProperty(label: str) bool #
Check if a calibration property exists by its label. :param label: The property label. :type label: str
- Returns:
bool – True if the calibration property exists, False otherwise.
- isProperty(label: str) bool #
Check if a property exists by its label. :param label: The property label. :type label: str
- Returns:
bool – True if the property exists, False otherwise.
- removeJoint(jointLabels: List[str])#
Remove Joint instances based on their labels. :param jointLabels: List of joint labels to be removed. :type jointLabels: List[str]
- removeSegment(segmentLabels: List[str])#
Remove Segment instances based on their labels. :param segmentLabels: List of segment labels to be removed. :type segmentLabels: List[str]
- setBodyPart(bodypart: str)#
[Obsolete] Specify which body part is represented by the model. :param bodypart: The body part represented by the model. :type bodypart: str
- setCalibrationProperty(propertyLabel: str, value: Any)#
Set or update a calibration property in the property dictionary. :param propertyLabel: The property label. :type propertyLabel: str :param value: The property value. :type value: Any
- setCentreOfMass(com: ndarray)#
Set the center of mass trajectory. :param com: An array (n, 3) representing the center of mass trajectory. :type com: np.ndarray
- setClinicalDescriptor(jointOrSegmentLabel: str, dataType: DataType, indexes: List[int], coefficients: List[float], offsets: List[float], **options)#
Set a clinical descriptor. :param jointOrSegmentLabel: Segment or joint label. :type jointOrSegmentLabel: str :param dataType: Data type. :type dataType: enums.DataType :param indexes: Indexes. :type indexes: List[int] :param coefficients: Coefficients to apply on outputs. :type coefficients: List[float] :param offsets: Offsets to apply on outputs. :type offsets: List[float]
- Kwargs:
projection (enums.MomentProjection): Coordinate system used to project the joint moment.
Examples
`python model.setClinicalDescriptor("LHip", enums.DataType.Angle, [0,1,2], [-1.0,-1.0,-1.0], [0.0,0.0,0.0]) `
- setCoordinateSystemDefinition(segmentLabel: str, coordinateSystemLabel: str, referentialType: str)#
Set coordinate system definition. :param segmentLabel: Segment label. :type segmentLabel: str :param coordinateSystemLabel: Coordinate system label. :type coordinateSystemLabel: str :param referentialType: Type of referential. :type referentialType: str
- setProperty(propertyLabel: str, value: Any)#
Set or update a property in the property dictionary. :param propertyLabel: The property label. :type propertyLabel: str :param value: The property value. :type value: Any
- setStaticFilename(name: str)#
Set the static filename used for static calibration. :param name: The filename. :type name: str