Model
anthropometricMeasurement
bodySegmentParameters
- class pyCGM2.Model.bodySegmentParameters.Bsp(iModel)
Body Segment Parameter of the lower limb according Dempster 1995
Reference
Dempster. (1955). Body Segment Parameter Data for 2-D Studies
- compute()
Compute body segment parameters of a Model
- classmethod setParameters(bspSegmentLabel, segmentLength, bodymass)
Compute body parameter of a selected lower limb segment
- Parameters
bspSegmentLabel (str) – segment label defined in the class object TABLE
segmentLength (double) – length of the segment
bodymass (double) – mass of the subject
frame
this module gathers two classes (Node and Frame), important for the construction of a model
A Frame is a representation of a coordinate system at a specific time. Its main attributes are the rotation matrix and the translation vectors.
A Frame can collect Node instances. A Node represents a 3d point expressed in a local coordinate system
- class pyCGM2.Model.frame.Frame
A Frame represents a coordinate system
- addNode(nodeLabel, position, positionType='Global', desc='')
Append a Node to a Frame
- Parameters
nodeLabel (str) – node label
position (array(3,)) – a translation vector
positionType (str,Optional) – two choice Global or Local
desc (str,Optional) – description
- copyNode(nodeLabel, nodeToCopy)
Copy a node and add it or update a existant node
- Parameters
nodeLabel (str) – the node label
nodeToCopy (str) – the label of the node to copy
- eraseNodes()
Erase all nodes
- getAngleAxis()
Get the angle axis
- getGlobalPosition(nodeLabel)
Return the global position
- Parameters
nodeLabel (str) – the node label
- getNodeIndex(nodeLabel)
Get the node index
- Parameters
nodeLabel (str) – the node label
- getNodeLabels(display=True)
Display all node labels
- getNode_byIndex(index)
Get a node from its index
- Parameters
index (int) – index of the node within the list
- getNode_byLabel(label)
Get a node from its label
- Args:
label(str): the node label
- getNodes()
Return all node instances
- getRotation()
Get rotation matrix
- Returns
array ((3,3) – a rotation matrix
- getTranslation()
Get translation vector
- isNodeExist(nodeLabel)
Check if a node exists from its label
- Parameters
nodeLabel (str) – the node label
- setRotation(R)
Set the rotation matrix
- Parameters
R (array(3,3) – a rotation matrix
- setTranslation(t)
Set the translation vector
- Parameters
t (array(3,)) – a translation vector
- update(R, t)
Update both the rotation matrix and the translation vector
- Parameters
R (array(3,3) – a rotation matrix
t (array(3,)) – a translation vector
- updateAxisFromRotation(R)
Update the rotation matrix
- Parameters
R (array(3,3) – a rotation matrix
- updateNode(nodeLabel, localArray, globalArray, desc='')
Update a node
- Parameters
nodeLabel (str) – the node label
localArray (array(3)) – local position
globalArray (array(3)) – global position
desc (str,Optional) – description
- class pyCGM2.Model.frame.Node(label, desc='')
A node is a local position of a 3D point in a coordinate system
Note
Automatically, the suffix “_node” ends the node label
- Parameters
label (str) – desired label of the node
desc (str,Optional) – description
- computeGlobal(rot, t)
Compute global position from local
- Parameters
rot (array((3,3)) – a rotation matrix
t (array((1,3)) – a translation vector
- computeLocal(rot, t)
Compute local position from global position
- Parameters
rot (array(3,3)) – a rotation matrix
t (array((1,3))) – a translation vector
- getDescription()
Get the node description
- getGlobal()
Get the global coordinates of the node
- getLabel()
Get the node label
- getLocal()
Get the local coordinates of the node
- setDescription(description)
Set description of the node
- Parameters
description (str) – description
- pyCGM2.Model.frame.angleAxisFromQuaternion(Quaternion)
Calculates the AngleAxis representation from a quaternion
- Parameters
Quaternion (array(4)) – a quaternion
- pyCGM2.Model.frame.getQuaternionFromMatrix(RotMat)
Calculates the quaternion representation from a rotation matrix.
Algorithm in Ken Shoemake’s article in 1987 SIGGRAPH course notes article “Quaternion Calculus and Fast Animation”.
- Parameters
RotMat (array(3,3)) – Rotation matrix
- pyCGM2.Model.frame.setFrameData(a1, a2, sequence)
Set axes and rotation matrix of a coordinate system from 2 vectors and a sequence
The sequence can be all combinaison of XYZ. If the second letter is prefixed by i, the opposite vector to the cross product a1, a2 is considered
- Parameters
a1 (array(1,3)) – first vector
a2 (array(1,3)) – second vector
sequence (str) – construction sequence (XYZ, XYiZ,…)
model
- class pyCGM2.Model.model.AnatomicalReferential
A AnatomicalReferential represents a anatomical coordinate system constructed from either tracking or calibration markers during a static pose
A AnatomicalReferential inherits from Referential.
- class pyCGM2.Model.model.ClinicalDescriptor(dataType, jointOrSegmentLabel, indexes, coefficients, offsets, **options)
A clinical descriptor.
- Parameters
dataType (enums.DataType) – type of data (ie Angle, Moment,… ( see enums))
jointOrSegmentLabel (str) – label of the joint or the segment
indexes (list(3)) – indexes of the outputs
coefficients (list(3)) – coefficients to apply on the ouputs
offsets (list(3)) – offset to apply on the ouputs ( eg, 180 degree substraction )
- class pyCGM2.Model.model.Joint(label, proxLabel, distLabel, sequence, nodeLabel)
a Joint is the common point between a proximal and a distal segment
- Parameters
label (str) – label of the chain
proxLabel (str) – label of the proximal segment
distLabel (str) – label of the distal segment
sequence (str) – sequence angle
- class pyCGM2.Model.model.Model
Abstract class Model.
A Model is made of segments, joints, body segment parameters
- addAnthropoInputParameters(iDict, optional=None)
Add measured anthropometric data to the model
- Parameters
iDict (dict) – required anthropometric data
optionalMp (dict,Optional) – optional anthropometric data
- addChain(label, indexSegmentList)
Add a segment chain
- Parameters
label (str) – label of the chain
indexSegmentList (list) – indexes of the segment which constitute the chain
- addJoint(label, proxLabel, distLabel, sequence, nodeLabel)
Add a joint
- Parameters
label (str) – label of the chain
proxLabel (str) – label of the proximal segment
distLabel (str) – label of the distal segment
sequence (str) – sequence angle
- addSegment(label, index, sideEnum, calibration_markers=[], tracking_markers=[], cloneOf=False)
Add a segment
- Parameters
label (str) – label of the segment
index (str) – index of the segment
sideEnum (pyCGM2.enums) – body side
calibration_markers (list) – labels of the calibration markers
tracking_markers (list) – labels of the tracking markers
- displayStaticCoordinateSystem(aquiStatic, segmentLabel, targetPointLabel, referential='Anatomic')
Display a coordinate system. Its Axis are represented by 3 virtual markers suffixed by (_X,_Y,_Z)
- Parameters
aquiStatic (btkAcquisition) – btkAcquisition instance from a static c3d
segmentLabel (str) – segment label
targetPointLabel (str) – label of the point defining axis limits
referential (str,Optional) – type of segment coordinate system you want to display.
(choice – Anatomic or technical, default: Anatomic )
- getBodyPart()
[Obsolete] return the body part represented by the model
- getCentreOfMass()
return the center of mass trajectory
- getClinicalDescriptor(dataType, jointOrSegmentLabel, projection=None)
return a clinical descriptor
- Parameters
jointOrSegmentLabel (str) – segment or joint label.
dataType (pyCGM2.enums.DataType) – data type.
projection (enums.MomentProjection,Optional[None]) – joint moment projection
- getJoint(label)
Get a Joint from its label
- Parameters
label (str) – label of the joint
- getJointList()
Get the Joint labels
- getProperty(propertyLabel)
Return a property
- Parameters
propertyLabel (str) – the properted label
- getSegment(label)
Get Segment from its label
- Parameters
label (str) – label of the Segment
- getSegmentByIndex(index)
Get Segment from its index
- Parameters
index (int) – index of the Segment
- getSegmentIndex(label)
Get Segment index from its label
- Parameters
label (str) – label of the Segment
- getSegmentList()
Get the Segment labels
- isCalibrationProperty(label)
check if a calibration property exists from its label
- Parameters
label (str) – the properted label
- isProperty(label)
check if a property exists from its label
- Parameters
label (str) – the properted label
- removeJoint(jointlabels)
Remove joint from its label
- Parameters
jointlabels (list) – joint labels to remove
- removeSegment(segmentlabels)
Remove Segment from its label
- Parameters
label (list) – segment labels to remove
- setBodyPart(bodypart)
[Obsolete] Specify which body part is represented by the model
- setCalibrationProperty(propertyLabel, value)
Set or update the calibration property dictionary.
- Parameters
propertyLabel (str) – the property label
value (All) – the property value
- setCentreOfMass(com)
Set the center of mass trajectory
- Parameters
com (array(n,3)) – Description of parameter com.
- setClinicalDescriptor(jointOrSegmentLabel, dataType, indexes, coefficients, offsets, **options)
set a clinical descriptor
- Parameters
jointOrSegmentLabel (str) – segment or joint label.
dataType (pyCGM2.enums.DataType) – data type.
indexes (list) – indexes
coefficients (list) – coefficients to apply on outputs
offsets (list) – offsets to apply on outputs
- setProperty(propertyLabel, value)
Set or update the property dictionary.
- Parameters
propertyLabel (str) – the property label
value (All) – the property value
- setStaticFilename(name)
Set the static filename used for static calibration
- Parameters
name (str) – the filename
- updateSegmentFromCopy(targetLabel, segmentToCopy)
Update a segment from a copy of an other segment instance
- Parameters
targetLabel (str) – label of the segment
segmentToCopy (pyCGM2.Model.CGM2.model.Segment) – a segment instance
- class pyCGM2.Model.model.Model6Dof
- class pyCGM2.Model.model.Referential
A Referential defined a segmental coordinate system. The two main atributes of a Referential instance are:
the static attribute ( ie a Frame instance) which characterized
the mean pose from the static trial
the motion attribute ( ie a list of Frame instance) which characterized
the pose at each time-frame of the dynamic trial
- addMotionFrame(Frame)
Append a Frame to the motion attribute
- Parameters
Frame (pyCGM2.Model.CGM2.frame.Frame) – a Frame instance
- getNodeTrajectory(label)
Return the trajectory of a node
- Parameters
label (str) – label of the desired node
- getOriginTrajectory()
Return the trajectory of the origin
- setStaticFrame(Frame)
Set the static pose
- Parameters
Frame (pyCGM2.Model.CGM2.frame.Frame) – a Frame instance
- class pyCGM2.Model.model.Segment(label, index, sideEnum, calibration_markers=[], tracking_markers=[])
A Segment represents a rigid body
- Parameters
label (str) – label
index (str) – index
sideEnum (pyCGM2.enums) – body side
lst_markerlabel (list) – calibration and tracking markers
tracking_markers (list) – tracking markers
- addCalibrationMarkerLabel(labels)
Add a calibration marker
- Parameters
labels (str or list) – marker label
- addExternalDeviceWrench(btkWrench)
Add an external device wrench
- Parameters
btkWrench (btk.Wrench) – a btk wrench instance
- addTechnicalReferential(label)
Add a technical referential
- Parameters
label (str) – given label of the technical frame
- addTrackingMarkerLabel(labels)
Add a tracking marker
- Parameters
labels (str or list) – marker labels
- downSampleExternalDeviceWrenchs(appf)
Downsample external device wrenchs
- Parameters
appf (int) – analog point per frame
- getAngularAcceleration(sampleFrequency)
Return the angular acceleration
- getAngularVelocity(sampleFrequency, method='conventional')
Return the angular velocity
- Parameters
sampleFrequency (double) – point frequency
method (str,Optional) – method used for computing the angular velocity
pig) ((conventional or) –
Notes:
The conventional method computes angular velocity through the matrix product $dot{R}R^t$
The pig method duplicates a bodybuilder code of the plug-in gait in which the velocity is computed from differentation between the next and previous pose
- getComAcceleration(pointFrequency, method='spline', **options)
Get global linear acceleration of the centre of mass
- Parameters
pointFrequency (double) – point frequency
method (str,Optional) – derivation method (spline, spline fitting)
- Kwargs:
order(int): low pass filter order fc(double): low pass filter cut-off frequency
- getComTrajectory(exportBtkPoint=False, btkAcq=None)
Return the trajectory of the centre of mass
- Parameters
exportBtkPoint (bool) – enable export as btk.point
btkAcq (btk acquisition) – a btk acquisition instance
- getComVelocity(pointFrequency, method='spline')
Get the linear velocity of the centre of mass
- Parameters
pointFrequency (double) – point frequency
method (str,Optional) – derivation method (spline, spline fitting)
- getReferential(label)
Return a referential from its label
- Parameters
label (str) – technical referential label
- isExternalDeviceWrenchsConnected()
Detect external device wrenchs
- removeTrackingMarker(labels)
Aemove a tracking marker
- Parameters
label (str) – label
- setComPosition(array3)
Set local position of the centre of mass
- Parameters
array (array(3)) – centre of mass position
- setInertiaTensor(array33)
Set segment inertia tensor
- Parameters
array (array(3,3)) – tensor of inertia
- setLength(value)
Set segment length
- Parameters
value (double) – length
- setMass(value)
Set segment mass
- Parameters
value (double) – mass
- setRog(value)
Set segment radius of giration
- Parameters
value (double) – radius of giration
- zeroingExternalDevice()
Zeroing external device wrench
- zeroingProximalWrench()
Zeroing proximal wrench
- class pyCGM2.Model.model.TechnicalReferential(label)
A TechnicalReferential represents a Technical coordinate system constructed from tracking markers
A TechnicalReferential inherits from Referential.
- Parameters
label (str) – label of the technical referential
- setRelativeMatrixAnatomic(array)
Set the relative rigid rotation of the anatomical Referential expressed in the technical referential (\(R^a_t\)).
- Parameters
array (numpy.array(3,3) – rigid rotation
modelDecorator
this module gathers classes/ functions for calibrating a model, ie locating joint centres and axis
- class pyCGM2.Model.modelDecorator.AnkleCalibrationDecorator(iModel)
Concrete cgm decorator altering the ankle joint
- Parameters
iModel (CGM2.cgm.CGM) – a CGM instance
- fromAjcMarker(acq, leftAJC_label='LAJC', rightAJC_label='RAJC', side='both')
AJC positioned from virtual AJC marker trajectory computed from an other process
- Parameters
acq (btkAcquisition) – an acquisition with the virtual AJC marker trajectory
leftAJC_label (str,Optional[LAJC]) – left virtual AJC label
rightAJC_label (str,Optional[RAJC]) – right virtual AJC label
side (str,Optional[True]) – body side
- midMaleolus(acq, side='both', leftLateralAnkleLabel='LANK', leftMedialAnkleLabel='LMED', rightLateralAnkleLabel='RANK', rightMedialAnkleLabel='RMED', markerDiameter=14, widthFromMp=True)
Compute the ankle joint centre from mid maleolus.
- Parameters
acq (btkAcquisition) – a btk acquisition instance of a static c3d
side (str,Optional[True]) – body side
leftLateralAnkleLabel (str,Optional[LANK]) – label of the left lateral ankle marker
leftMedialAnkleLabel (str,Optional[LMED]) – label of the left medial ankle marker
rightLateralAnkleLabel (str,Optional[RANK]) – label of the right lateral ankle marker
rightMedialAnkleLabel (str,Optional[RMED]) – label of the right medial ankle marker
markerDiameter (double,Optional[14]) – marker diameter
widthFromMp (bool,Optional[True]) – knee with from model anthropometric parameters
- class pyCGM2.Model.modelDecorator.Cgm1ManualOffsets(iModel)
Replicate behaviour of the CGM1 if segmental offset manaully altered
- Args
iModel (CGM2.cgm.CGM): a CGM instance
- compute(acq, side, thighoffset, markerDiameter, tibialTorsion, shankoffset)
run the processing
- Args
acq (btk.Acquisition): an aquisition instance of a static c3d side (str): body side thighoffset (double): thigh offset markerDiameter (double): diameter of marker shankoffset (double): shank offset tibialTorsion (double): tibial torsion
- class pyCGM2.Model.modelDecorator.DecoratorModel(iModel)
- class pyCGM2.Model.modelDecorator.HipJointCenterDecorator(iModel)
Concrete CGM decorators altering the hip joint centre
- Parameters
iModel (CGM2.cgm.CGM) – a CGM instance
- bell(side='both')
Use of the Bell’s regressions
- Parameters
side (str,Optional[both]) – body side
- custom(position_Left=0, position_Right=0, side='both', methodDesc='custom')
Locate hip joint centres manually
- Parameters
position_Left (np.array(3,)) – position of the left hip center in the pelvis referential
position_Right (np.array(3,)) – position of the right hip center in the pelvis referential
side (str,Optional[both]) – body side
methodDesc (str,Optional[Custom]) – short description of the method
Note:
look out the pelvis referential. It has to be similar to the cgm1 pelvis referential.
- davis(side='both')
Use of the Davis’s regressions
- Parameters
side (str,Optional[both]) – body side
- fromHjcMarker(acq, leftHJC_label='LHJC', rightHJC_label='RHJC', side='both')
HJC positioned from a virtual HJC marker trajectory computed from an other process
- Parameters
acq (btk.Acquisition) – an aquisition instance with the virtual HJC marker trajectories
leftHJC_label (str,Optional["LHJC"]) – label of the left vritual HJC marker
rightHJC_label (str,Optional["RHJC"]) – label of the right vritual HJC marker
side (str,Optional[both]) – body side
- hara(side='both')
Use of the Hara’s regressions
- Parameters
side (str,Optional[both]) – body side
- harrington(predictors=HarringtonPredictor.Native, side='both')
Use of the Harrington’s regressions
- Parameters
predictors (pyCGM2.enums,Optional[enums.HarringtonPredictor.Native]) – harrington’s predictors to use
side (str,Optional[both]) – body side
- class pyCGM2.Model.modelDecorator.Kad(iModel, iAcq)
A concrete CGM decorator altering the knee joint centre from the Knee Aligment device
- Args
iModel (CGM2.cgm.CGM): a CGM instance iAcq (btk.Acquisition): btk aquisition instance of a static c3d with the KAD
- compute(side='both', markerDiameter=14)
Run the KAD processing
- Parameters
side (str,Optional[both]) – body side
markerDiameter (double,Optional[14]) – diameter of the marker
- class pyCGM2.Model.modelDecorator.KneeCalibrationDecorator(iModel)
Concrete cgm decorator altering the knee joint
- Parameters
iModel (CGM2.cgm.CGM) – a CGM instance
- calibrate2dof(side, **kwargs)
run the calibration2Dof method
- Parameters
side (str) – body side
- Kargs:
indexFirstFrame (int): start frame indexLastFrame (int): last frame sequence (str): Euler sequence jointRange (list): flexion angle boundaries
- fromKjcMarker(acq, leftKJC_label='LKJC', rightKJC_label='RKJC', side='both')
KJC positioned from a virtual KJC marker trajectory computed from an other process
- Parameters
acq (btkAcquisition) – an acquisition with the virtual KJC marker trajectoriy
leftKJC_label (str,Optional[LKJC]) – left virtual KJC label
rightKJC_label (str,Optional[RKJC]) – right virtual KJC label
side (str,Optional[True]) – body side
- midCondyles(acq, side='both', leftLateralKneeLabel='LKNE', leftMedialKneeLabel='LKNM', rightLateralKneeLabel='RKNE', rightMedialKneeLabel='RKNM', markerDiameter=14, widthFromMp=True)
Compute Knee joint centre from mid condyles.
- Parameters
acq (btkAcquisition) – a btk acquisition instance of a static c3d
side (str,Optional[True]) – body side
leftLateralKneeLabel (str,Optional[LKNE]) – label of the left lateral knee marker
leftMedialKneeLabel (str,Optional[LKNM]) – label of the left medial knee marker
rightLateralKneeLabel (str,Optional[RKNE]) – label of the right lateral knee marker
rightMedialKneeLabel (str,Optional[RKNM]) – label of the right medial knee marker
markerDiameter (double,Optional[14]) – marker diameter
widthFromMp (bool,Optional[True]) – knee with from model anthropometric parameters
- midCondyles_KAD(acq, side='both', leftLateralKneeLabel='LKNE', leftMedialKneeLabel='LKNM', rightLateralKneeLabel='RKNE', rightMedialKneeLabel='RKNM', markerDiameter=14)
Compute Knee joint centre from mid condyles and relocate AJC like KAD process.
- Parameters
acq (btkAcquisition) – a btk acquisition instance of a static c3d
side (str,Optional[both]) – body side
leftLateralKneeLabel (str,Optional[LKNE]) – label of the left lateral knee marker
leftMedialKneeLabel (str,Optional[LKNM]) – label of the left medial knee marker
rightLateralKneeLabel (str,Optional[RKNE]) – label of the left lateral knee marker
rightMedialKneeLabel (str,Optional[RKNM]) – label of the left medial knee marker
markerDiameter (double,Optional[14]) – marker diameter
- sara(side, **kwargs)
Compute Knee flexion axis, relocate knee joint centre from SARA functional calibration
- Parameters
side (str) – body side
- Kargs:
indexFirstFrame (int): start frame indexLastFrame (int): last frame
- pyCGM2.Model.modelDecorator.VCMJointCentre(HalfJoint, JointMarker, TopJoint, StickMarker, beta=0)
Calculate the joint centre according the Vicon Clinical Manager method ( ie chord function )
- Parameters
HalfJoint (double) – radius of the joint
JointMarker (array(1,3)) – joint marker trajectory at a specific frame
TopJoint (type) – proximal joint centre trajectory at a specific frame
StickMarker (type) – lateral marker trajectory at a specific frame
beta (double,Optional[0]) – rotation angle offset.
Reference
Kabada, M., Ramakrishan, H., & Wooten, M. (1990). Measurement of lower extremity kinematics during level walking. Journal of Orthopaedic Research, 8, 383–392.
- pyCGM2.Model.modelDecorator.bellRegression(mp_input, mp_computed, markerDiameter=14.0, basePlate=2.0, cgmReferential=True)
Hip joint centre regression from Bell and Brand et al, 2007
- Args
mp_input (dict): dictionary of the measured anthropometric parameters mp_computed (dict): dictionary of the cgm-computed anthropometric parameters markerDiameter (double,Optional[14.0]): diameter of the marker basePlate (double,Optional[2.0]): thickness of the base plate cgmReferential (bool,optional[True]) - flag indicating HJC position will be expressed in the CGM pelvis Coordinate system
Reference:
Bell AL, Pederson DR, and Brand RA (1989) Prediction of hip joint center location from external landmarks. Human Movement Science. 8:3-16:
Bell AL, Pedersen DR, Brand RA (1990) A Comparison of the Accuracy of Several hip Center Location Prediction Methods. J Biomech. 23, 617-621.
- pyCGM2.Model.modelDecorator.calibration2Dof(proxMotionRef, distMotionRef, indexFirstFrame, indexLastFrame, jointRange, sequence='YXZ', index=1, flexInd=0)
Calibration 2DOF ( aka dynakad)
- Parameters
proxMotionRef (pyCGM2.Model.Referential.motion) – motion attribute of the proximal referential
distMotionRef (pyCGM2.Model.Referential.motion) – motion attribute of the distal referential
indexFirstFrame (int) – start frame
indexLastFrame (int) – end frame
jointRange (list) – minimum and maximum joint angle to process
sequence (str,Optional[YXZ]) – Euler sequence
index (int,Optional[1]) – coronal plane index
flexInd (int,Optional[0]) – sagital plane index
- pyCGM2.Model.modelDecorator.davisRegression(mp_input, mp_computed, markerDiameter=14.0, basePlate=2.0)
Hip joint centre regression according Davis et al, 1991
- Args
mp_input (dict): dictionary of the measured anthropometric parameters mp_computed (dict): dictionary of the cgm-computed anthropometric parameters markerDiameter (double,Optional[14.0]): diameter of the marker basePlate (double,Optional[2.0]): thickness of the base plate
Reference:
Davis, R., Ounpuu, S., Tyburski, D., & Gage, J. (1991). A gait analysis data collection and reduction technique. Human Movement Science, 10, 575–587.
- pyCGM2.Model.modelDecorator.footJointCentreFromMet(acq, side, frameInit, frameEnd, markerDiameter=14, offset=0)
calculate the foot centre from metatarsal markers.
- Parameters
acq (btk.acquisition) – an acquisition
side (str) – body sideEnum
frameInit (int) – start frame
frameEnd (int) – end frame
markerDiameter (double,Optional[14]) – marker diameter.
offset (double,Optional[0]) – marker offset.
- pyCGM2.Model.modelDecorator.haraRegression(mp_input, mp_computed, markerDiameter=14.0, basePlate=2.0)
Hip joint centre regression from Hara et al, 2016
- Args
mp_input (dict): dictionary of the measured anthropometric parameters mp_computed (dict): dictionary of the cgm-computed anthropometric parameters markerDiameter (double,Optional[14.0]): diameter of the marker basePlate (double,Optional[2.0]): thickness of the base plate
Reference
Hara, R., Mcginley, J. L., C, B., Baker, R., & Sangeux, M. (2016). Generation of age and sex specific regression equations to locate the Hip Joint Centres. Gait & Posture
- pyCGM2.Model.modelDecorator.harringtonRegression(mp_input, mp_computed, predictors, markerDiameter=14.0, basePlate=2.0, cgmReferential=True)
Hip joint centre regression from Harrington et al, 2007
- Parameters
mp_input (dict) – dictionary of the measured anthropometric parameters
mp_computed (dict) – dictionary of the cgm-computed anthropometric parameters
predictors (str) – predictor choice of the regression (full,PWonly,LLonly)
markerDiameter (double,Optional[14.0]) – diameter of the marker
basePlate (double,Optional[2.0]) – thickness of the base plate
cgmReferential (boolOptional[True]) –
Notes
Predictor choice allows using modified Harrington’s regression from Sangeux 2015
pelvisDepth,`asisDistance` and meanlegLength are automaticaly computed from CGM calibration
References
Harrington, M., Zavatsky, A., Lawson, S., Yuan, Z., & Theologis, T. (2007). Prediction of the hip joint centre in adults, children, and patients with cerebral palsy based on magnetic resonance imaging. Journal of Biomechanics, 40(3), 595–602
Sangeux, M. (2015). On the implementation of predictive methods to locate the hip joint centres. Gait and Posture, 42(3), 402–405.
- pyCGM2.Model.modelDecorator.midPoint(acq, lateralMarkerLabel, medialMarkerLabel, offset=0)
return the mid point trajectory
- Parameters
acq (btk.Acquisition) – An acquisition
lateralMarkerLabel (str) – label of the lateral marker
medialMarkerLabel (str) – label of the medial marker
offset (double,Optional[0]) – offset
Note
- if offset is different to 0, the mid point is computed from the statement:
lateral + offset*(Vector[medial->lateral])
- pyCGM2.Model.modelDecorator.saraCalibration(proxMotionRef, distMotionRef, indexFirstFrame, indexLastFrame, offset=100, method='1')
Computation of a joint center position from SARA.
- Parameters
proxMotionRef (pyCGM2.Model.Referential.motion) – motion attribute of the proximal referential
distMotionRef (pyCGM2.Model.Referential.motion) – motion attribute of the distal referential
offset (double,Optional[100]) – distance in mm for positionning axis boundaries
method (int,Optional[1]) – method index . Affect the objective function (see Ehrig et al.).
Reference
Ehrig, R., Taylor, W. R., Duda, G., & Heller, M. (2007). A survey of formal methods for determining functional joint axes. Journal of Biomechanics, 40(10), 2150–7.
modelFilters
This module contains filters and associated procedures which can be applied on a model
- class pyCGM2.Model.modelFilters.CGMLowerlimbInverseDynamicProcedure
Procedure for calcualting Inverse dynamics of the CGM lower limbs
- class pyCGM2.Model.modelFilters.CentreOfMassFilter(iMod, btkAcq)
Compute the centre of mass trajectory
- Parameters
btkAcq (btk.Acquisition) – an acquisition instance of a dynamic trial
iMod (pyCGM2.Model.CGM2.model.Model) – a model instance
- compute(pointLabelSuffix=None)
Run the filter. The centre of mass trajectoy is stored in the acquisition instance
- Parameters
pointLabelSuffix (str,Optional[None]) – suffix added to the ouput label
- class pyCGM2.Model.modelFilters.ForcePlateAssemblyFilter(iMod, btkAcq, mappedForcePlateLetters, leftSegmentLabel='Left Foot', rightSegmentLabel='Right Foot')
Assemble Force plate with the model
- Parameters
btkAcq (btkAcquisition) – an acquisition instance of a dynamic trial
iMod (pyCGM2.Model.CGM2.model.Model) – a model instance
mappedForcePlateLetters (str) – string indicating body side of the segment in contact with the force plate
leftSegmentLabel (str,Optional[Left Foot]) – left segment label to assemble with force plates
rightSegmentLabel (str,Optional[Right Foot]) – right segment label to assemble with force plates
- compute(pointLabelSuffix=None)
Run the filter. Ground reaction forces and moments are stored in the acquisition instance
- Parameters
pointLabelSuffix (str,Optional[None]) – suffix ending ground reaction labels
- class pyCGM2.Model.modelFilters.GeneralCalibrationProcedure
General Procedure to load from the Model Calibration Filter if you work with a custom model
- setAnatomicalDefinition(segmentName, sequence='', nodeLabel1=0, nodeLabel2=0, nodeLabel3=0, nodeLabelOrigin=0)
Define rules for constructing the anatomical coordinate system.
nodeLabels are the labels of node (see Frame module ) used for constructing two axes ( v1 and v2) which eventually define the coordinate system.
- Parameters
segmentName (str) – name of the segment
referentialLabel (str) – label of the referential
sequence (str) – construction sequence (XYZ,XYiZ,….)
nodeLabel1 (str) – node label used for constructing the axes v1 and v2
nodeLabel2 (str) – node label used for constructing the axis v1
nodeLabel3 (str) – node label used for construting the axis v2
nodeLabelOrigin (str) – node label used as origin of the coordinate system
- setDefinition(segmentName, referentialLabel, sequence='', pointLabel1=0, pointLabel2=0, pointLabel3=0, pointLabelOrigin=0)
Define rules for constructing a technical coordinate system.
pointLabels are the labels of marker ( virtual or concrete markers) used for constructing two axes ( v1 and v2) which
eventually define the coordinate system.
- Parameters
segmentName (str) – name of the segment
referentialLabel (str) – label of the referential
sequence (str) – construction sequence (XYZ,XYiZ,….)
pointLabel1 (str) – marker label used for constructing the axes v1 and v2
pointLabel2 (str) – marker label used for constructing the axis v1
pointLabel3 (str) – marker label used for construting the axis v2
pointLabelOrigin (str) – marker label used as origin of the coordinate system
- class pyCGM2.Model.modelFilters.InverseDynamicFilter(iMod, btkAcq, procedure=None, gravityVector=array([0, 0, - 1]), scaleToMeter=0.001, projection=MomentProjection.Distal, globalFrameOrientation='XYZ', forwardProgression=True, exportMomentContributions=False, **options)
Compute joint Forces and moments from Inverse dynamics
- Parameters
btkAcq (btk.Acquisition) – an acquisition instance of a dynamic trial
iMod (pyCGM2.Model.CGM2.model.Model) – a model instance
procedure (pyCGM2.Model.CGM2.modelFilters.(_Procedure)) – an inverse dynamic procedure
gravityVector (numpy.array(3,),Optional[numpy.array([0,0,-1]]) – the gravity vector
scaleToMeter (double,Optional[0.001]) – scale to meter
projection (pyCGM2.enums.MomentProjection,Optional[enums.MomentProjection.Distal]) – coordinate system in which joint moments and forces are expressed
exportMomentContributions (bool,Optional[false]) – export moment contributions
- compute(pointLabelSuffix=None)
Run the filter. Joint forces and moments are stored in the acquisition instance
- Parameters
pointLabelSuffix (str,Optional[None]) – suffix ending output labels
- Kargs:
viconCGM1compatible(bool): replicate the Vicon Plugin-gait error related to the proximal and distal tibia
- class pyCGM2.Model.modelFilters.JointPowerFilter(iMod, btkAcq, scaleToMeter=0.001)
Compute joint power
- Parameters
btkAcq (btk.Acquisition) – an acquisition instance of a dynamic trial
iMod (pyCGM2.Model.CGM2.model.Model) – a model instance
scaleToMeter (double,Optional[0.001]) – scale to meter
- compute(pointLabelSuffix=None)
Run the filter. Joint powers are stored in the acquisition instance
- Parameters
pointLabelSuffix (str,Optional[None]) – suffix ending output labels
- class pyCGM2.Model.modelFilters.ModelAbsoluteAnglesFilter(iMod, acq, segmentLabels=[], angleLabels=[], eulerSequences=[], globalFrameOrientation='XYZ', forwardProgression=True)
Compute the absolute joint angles
- Args
acq (btk.Acquisition): an acquisition instance iMod (pyCGM2.Model.CGM2.model.Model): a model instance segmentLabels (list of str): segment labels angleLabels (list of str): absolute angles labels eulerSequences (str): Euler sequence to use. ( nomenclature TOR (ie Tilt-Obliquity-Rotation), ORT, ROT… ) globalFrameOrientation (str): global frame forwardProgression (bool): flag indicating subject moves in same direction than the global longitudinal axis
- compute(description='absolute', pointLabelSuffix=None)
Run the filter. All ouputs are stored in the acquisition instance as btk.Point
- Parameters
description (str,Optional[absolute]) – short description added to the btkPoint storing joint angles
pointLabelSuffix (str,Optional[None]) – suffix ending the angle label
- class pyCGM2.Model.modelFilters.ModelCalibrationFilter(procedure, acq, iMod, **options)
Calibrate a model from a static acquisition.
The calibration consists in the construction of both technical and anatomical coordinate sytems of each segment constituting the model.
- Args
procedure (pyCGM2.Model.CGM2.ModelFilters.(_Procedure)): a calibration procedure acq (btk.Acquisition): an acquisition instance iMod (pyCGM2.Model.CGM2.model.Model): a model instance
- Kargs:
markerDiameter (double): marker diameter basePlate (double): base plate thickness viconCGM1compatible(bool): replicate the Vicon Plugin-gait error related to the proximal and distal tibia leftFlatFoot (bool) : left longitudinal foot axis parallel to the ground rightFlatFoot : right longitudinal foot axis parallel to the ground headFlat: longitudinal head axis parallel to the ground
- compute(firstFrameOnly=True)
Run the Calibration filter
- Parameters
firstFrameOnly (bool,optional[true]) – use the first frame only
- class pyCGM2.Model.modelFilters.ModelJCSFilter(iMod, acq)
Compute the relative joint angles
- Args
acq (btk.Acquisition): an acquisition instance iMod (pyCGM2.Model.CGM2.model.Model): a model instance
- compute(description='', pointLabelSuffix=None)
run the filter. All ouputs are stored in the acquisition instance as btk.Point
- Parameters
description (str,Optional[""]) – short description added to the btkPoint storing joint angles
pointLabelSuffix (str,Optional[None]) – suffix ending the angle label
- class pyCGM2.Model.modelFilters.ModelMotionCorrectionFilter(procedure)
This filter correct the motion attributes (ie the segmental pose at each frame) of the anatomical coordinate systems.
The method implemented so far is the misaligment correction of Naaim et al (see Naim2019ThighMisaligmentCorrectionProcedure)
- Parameters
procedure (pyCGM2.Model.CGM2.modelFilters.(Procedure)) – a CorrectionProcedure
- correct()
Run the filter
- class pyCGM2.Model.modelFilters.ModelMotionFilter(procedure, acq, iMod, method, **options)
This filter update the model with the pose of both technical and anatomical coordinate systems at each frame.
- Args
procedure (pyCGM2.Model.CGM2.ModelFilters.(_Procedure)):a motion procedure acq (btk.Acquisition): an acquisition instance iMod (pyCGM2.Model.CGM2.model.Model): a model instance method (pyCGM2.enums.motionMethod): pose method
- Kargs:
markerDiameter (double): marker diameter basePlate (double): base plate thickness viconCGM1compatible(bool): replicate the Vicon Plugin-gait error related to the proximal and distal tibia useLeftKJCmarker (str): label of the left knee joint centre, present in the c3d as virtual marker useLeftAJCmarker (str): label of the left ankle joint centre, present in the c3d as virtual marker useLeftSJCmarker (str): label of the left shoulder joint centre, present in the c3d as virtual marker useLeftEJCmarker (str): label of the left elbow joint centre, present in the c3d as virtual marker useLeftWJCmarker (str): label of the left wrist joint centre, present in the c3d as virtual marker useRightKJCmarker (str): label of the right knee joint centre, present in the c3d as virtual marker useRightAJCmarker (str): label of the right ankle joint centre, present in the c3d as virtual marker useRightSJCmarker (str): label of the right shoulder joint centre, present in the c3d as virtual marker useRightEJCmarker (str): label of the right elbow joint centre, present in the c3d as virtual marker useRightWJCmarker (str): label of the right wrist joint centre, present in the c3d as virtual marker
- compute()
Run the filter
- segmentalCompute(segments)
Compute motion for given segments
- Parameters
segments (list) – segment labels
- class pyCGM2.Model.modelFilters.Naim2019ThighMisaligmentCorrectionProcedure(model, side, threshold=20)
This function corrects the thigh anatomical frame in respect with the method detailed in Naim et al, 2019.
- Parameters
iMod (pyCGM2.Model.CGM2.model.Model) – a model instance
side (str) – body side
threshold (double,Optional[20]) – only consider frames with a flexion angle above the given threshold
**Reference –
Naaim (2019) –
A. (2019) –
Bonnefoy-Mazure (2019) –
A. –
Armand (2019) –
S. (2019) –
Dumas (&) –
R. (2019) –
analysis (Correcting lower limb segment axis misalignment in gait) – A simple geometrical method.
Posture (Gait and) –
72 (May) –
- class pyCGM2.Model.modelFilters.StaticCalibrationProcedure(model)
Procedure to load from the Model Calibration Filter if you work with a pyCGM2-embedded model instance (like the CGM#i)
This procedure internally calls the calibrationProcedure method of the model instance.
- Parameters
model (pyCGM2.Model.Model) – a pyCGM2-embeded model instancel
modelQualityFilter
This module contains filters and associated procedures for assessing the quality of the model
- class pyCGM2.Model.modelQualityFilter.GeneralScoreResidualProcedure(model)
Procedure for calculating SCORE residual on given segments of the model
The main goal of the procedure is to populate the attribute m_scoreDefinition which will be handle by the ScoreresidualFilter
- Parameters
model (pyCGM2.Model.model.Model) –
- setDefinition(nodeLabel, proxSegLabel, distSegLabel)
set the definition dictionary.
- Parameters
nodeLabel (str) – node label.
proxSegLabel (str) – proximal segment label
distSegLabel (str) – distal segment label
- class pyCGM2.Model.modelQualityFilter.ModelScoreResidualProcedure(model)
Procedure for calculating SCORE residual for all joints of the model
The procedure populates its attribute m_scoreDefinition from the geometric attributes of the model
- Parameters
model (pyCGM2.Model.model.Model) –
- class pyCGM2.Model.modelQualityFilter.ScoreResidualFilter(acq, scoreProcedure)
Calculate the SCORE residual
- Args
acq (btk.Acquisition): an acquisition instance scoreProcedure (pyCGM2.Model.modelQualityFilter.(Procedure)): a score procedure instance
References
Ehrig, Rainald M.; Heller, Markus O.; Kratzenstein, Stefan; Duda, Georg N.; Trepczynski, Adam; Taylor, William R. (2011)
The SCoRE residual: a quality index to assess the accuracy of joint estimations. In : Journal of biomechanics, vol. 44, n° 7, p. 1400–1404. DOI: 10.1016/j.jbiomech.2010.12.009.
- compute()
Run the filter
motion
This module contains pose algorithms
- pyCGM2.Model.motion.segmentalLeastSquare(A, B)
Compute the transformation between two coordinate systems using SVD.
- Parameters
A (numpy.array(n,3)) –
B (numpy.array(n,3)) –
CGM2
cgm
- class pyCGM2.Model.CGM2.cgm.CGM
Abstract Class of the Conventional Gait Model
- classmethod detectCalibrationMethods(acqStatic)
Class method to detect the method used to calibrate knee and ankle joint centres
- Parameters
acqStatic (btk.Acquisition) – acquisition.
- getStaticTrackingMarkers()
get tracking markers
- classmethod get_markerLabelForPiGStatic(dcm)
Class method returning marker label of the knee and ankle joint centres
- Parameters
dcm (dict) – dictionary returned from the function detectCalibrationMethods
- setStaticTrackingMarkers(markers)
Set tracking markers
- Parameters
markers (list) – tracking markers
- class pyCGM2.Model.CGM2.cgm.CGM1
Conventional Gait Model 1 (aka Vicon Plugin Gait Clone)
- calibrate(aquiStatic, dictRef, dictAnatomic, options=None)
calibrate the model
- Parameters
aquiStatic (btk.acquisition) – acquisition
dictRef (dict) – markers and sequence used for building the technical coordinate system
dictAnatomic (dict) – markers and sequence used for building the anatomical coordinate system
options (dict, optional[None]) – passed arguments to embedded methods
- calibrationProcedure()
Define the calibration Procedure
- Returns
markers and sequence use for building Technical coordinate system dict: markers and sequence use for building Anatomical coordinate system
- Return type
dict
- computeMotion(aqui, dictRef, dictAnat, motionMethod, options=None)
Compute poses of both Technical and Anatomical coordinate systems
- Parameters
aqui (btk.acquisition) – acquisition
dictRef (dict) – technical referential definitions
dictAnat (dict) – anatomical referential definitions
motionMethod (enums.motionMethod) – segmental motion method
options (dict,optional[None]) – passed arguments to embedded functions
- options:
pigStatic (bool) : compute foot cordinate system according the Vicon Plugin-gait
forceFoot6DoF (bool): apply 6DOF pose optimisation on the foot
- computeOptimizedSegmentMotion(aqui, segments, dictRef, dictAnat, motionMethod, options)
Compute poses of both Technical and Anatomical coordinate systems for specific segments of the model
- Parameters
aqui (btk.Acquisition) – motion acquisitiuon
segments (list) – segments of the model
dictRef (dict) – technical referential definitions
dictAnat (dict) – anatomical referential definitions
motionMethod (enums.motionMethod) – segmental motion method to apply
options (dict) – passed known-arguments
- configure(detectedCalibrationMethods=None)
” configure the model
- Parameters
detectedCalibrationMethods (dict,optional[None]) – dictionary returned from the function detectCalibrationMethods
- getAbdAddAnkleJointOffset(side='both')
return the Abd/Add ankle offset, ie angle in the frontal plan between the ankle marker and the ankle flexion axis
- Parameters
side (string, Optional[both]) – lower limb side (both, left or right)
- getFootOffset(side='both')
return the foot offsets, ie the plantar flexion offset and the rotation offset
- Parameters
side (string, Optional[both]) – lower limb side (both, left or right)
- getShankOffsets(side='both')
return the shank offset, ie the angle between the projection of the lateral shank marker and the ankle flexion axis
- Parameters
side (string, Optional[both]) – lower limb side (both, left or right)
- getStaticMarkers(dcm)
return static markers
- Parameters
dcm (dict) – dictionary returned from the function detectCalibrationMethods
- getThighOffset(side='both')
return the thigh offset. Angle between the projection of the lateral thigh marker and the knee flexion axis
- Parameters
side (string, Optional[both]) – lower limb side (both, left or right)
- getTibialTorsionOffset(side='both')
return the tibial torsion offsets :
- Parameters
side (string, Optional[both]) – lower limb side (both, left or right)
- getTrackingMarkers(acq)
return tracking markers
- Parameters
acq (btk.Acquisition) – acquisition.
- opensimGeometry()
return dict used to configure the osim file
- opensimIkTask()
return marker weights used for IK
- setVersion(string)
amend model vesion
- viconExport(NEXUS, acq, vskName, pointSuffix, staticProcessingFlag)
method exporting model outputs to Nexus
- Parameters
NEXUS (viconnexus) – Nexus handle
vskName (str) – vsk name
staticProcessingFlag (bool) – only static model ouputs will be exported
cgm2
- class pyCGM2.Model.CGM2.cgm2.CGM2_1
Implementation of the CGM2.1
- class pyCGM2.Model.CGM2.cgm2.CGM2_2
Implementation of the CGM2.2
- getStaticIkTargets()
return markers used to fit the static
- setStaticIkTargets(targetNames)
set markers used to fit the static with IK
- Parameters
targetNames (list) – marker labels
- class pyCGM2.Model.CGM2.cgm2.CGM2_3
Implementation of the CGM2.3
- calibrate(aquiStatic, dictRef, dictAnatomic, options=None)
calibrate the model
- Parameters
aquiStatic (btk.acquisition) – acquisition
dictRef (dict) – markers and sequence used for building the technical coordinate system
dictAnatomic (dict) – markers and sequence used for building the anatomical coordinate system
options (dict, optional[None]) – passed arguments to embedded methods
- getStaticIkTargets()
return markers used to fit the static
- opensimIkTask()
return marker weights used for IK
- setStaticIkTargets(targetNames)
set markers used to fit the static with IK
- Parameters
targetNames (list) – marker labels
- class pyCGM2.Model.CGM2.cgm2.CGM2_4
Implementation of the CGM2.4
- calibrate(aquiStatic, dictRef, dictAnatomic, options=None)
calibrate the model
- Parameters
aquiStatic (btk.acquisition) – acquisition
dictRef (dict) – markers and sequence used for building the technical coordinate system
dictAnatomic (dict) – markers and sequence used for building the anatomical coordinate system
options (dict, optional[None]) – passed arguments to embedded methods
- computeMotion(aqui, dictRef, dictAnat, motionMethod, options=None)
Compute poses of both Technical and Anatomical coordinate systems
- Parameters
aqui (btk.acquisition) – acquisition
dictRef (dict) – technical referential definitions
dictAnat (dict) – anatomical referential definitions
motionMethod (enums.motionMethod) – segmental motion method
options (dict,optional[None]) – passed arguments to embedded functions
- options:
pigStatic (bool) : compute foot cordinate system according the Vicon Plugin-gait
forceFoot6DoF (bool): apply 6DOF pose optimisation on the foot
- computeOptimizedSegmentMotion(aqui, segments, dictRef, dictAnat, motionMethod, options)
Compute poses of both Technical and Anatomical coordinate systems for specific segments of the model
- Parameters
aqui (btk.Acquisition) – motion acquisitiuon
segments (list) – segments of the model
dictRef (dict) – technical referential definitions
dictAnat (dict) – anatomical referential definitions
motionMethod (enums.motionMethod) – segmental motion method to apply
options (dict) – passed known-arguments
- getHindFootOffset(side='Both')
return the hindfoot offsets, ie the plantar flexion offset and the rotation offset
- Parameters
side (string, Optional[Both]) – lower limb side (Both, Left or Right)
- opensimGeometry()
return dict used to configure the osim file
- opensimIkTask()
return marker weights used for IK
- viconExport(NEXUS, acq, vskName, pointSuffix, staticProcessingFlag)
Method exporting model outputs to Nexus
see [cgm.CGM1.viconExport](/Low level/Model/CGM2)
- class pyCGM2.Model.CGM2.cgm2.CGM2_5
decorators
this module gathers decorators specific to the CGM
- pyCGM2.Model.CGM2.decorators.applyBasicDecorators(dcm, model, acqStatic, optional_mp, markerDiameter, cgm1only=False)
Apply decorators from detected calibration method
- Parameters
dcm (dict) – dictionary returned from the function detectCalibrationMethods
model (pyCGM2.Model.CGM2.cgm) – a CGM model instance
acqStatic (btk.acquisition) – a btk acquisition instance of a static file
optional_mp (dict) – optional anthropometric parameters of the CGM
markerDiameter (float) – marker diameter
cgm1only (bool, optional[False]) – enable computation for the CGM1 only
- pyCGM2.Model.CGM2.decorators.applyHJCDecorators(model, method)
apply hip joint centre decorators
- Parameters
model (pyCGM2.Model.CGM2.cgm) – a CGM model instance
method (dict) – dict indicating HJC method to use
Example:
`python method = {"Left": "Hara", "Right": [1,3,4]} # a string or a list (ie. position in the pelvic coordinate system) applyHJCDecorators(model, method) `
Opensim
opensimFilters
This module contains Filters and procedures used as interface for working with the opensim API
- class pyCGM2.Model.Opensim.opensimFilters.CgmOpensimCalibrationProcedures(model)
Model-embedded Procedure for calibrating an opensim model
- class pyCGM2.Model.Opensim.opensimFilters.CgmOpensimFittingProcedure(model)
Model-embedded Procedure for fitting an opensim model
- updateMarkerWeight(markerLabel, weight)
Update weigth of a tracking marker
- Parameters
markerLabel (str) – marker label
weight (double) – joint label of a pyCGM2 model
- class pyCGM2.Model.Opensim.opensimFilters.GeneralOpensimCalibrationProcedure
General procedure for calibrating an opensim model
- setGeometry(opensimJointLabel, jointLabel, proximalSegmentLabel, distalSegmentLabel)
Design the opensim model geometry
- Parameters
opensimJointLabel (str) – joint label of the opensim model (see inside osim file)
jointLabel (str) – joint label of the pyCGM2 model
proximalSegmentLabel (str) – proximal segment label of LTHI_perturbTraj pyCGM2 model
distalSegmentLabel (str) – distal segment label of the pyCGM2 model
- setMarkers(segmentLabel, trackingMarkers)
Add tracking markers to a pycgm2-model segment
- Parameters
segmentLabel (str) – segment label of a pyCGM2 model
trackingMarkers (list) – traking markers
osimProcessing
This module contains convenient functions and classes for working with opensim.
- pyCGM2.Model.Opensim.osimProcessing.globalTransformationLabToOsim(acq, R_LAB_OSIM)
transform all markers into the the opensim global coordinate system
- Parameters
acq (Btk.Acquisition) – an acquisition
R_LAB_OSIM (array(3,3)) – rotation matrix for passing from the lab to opensim coordinate sytem
- pyCGM2.Model.Opensim.osimProcessing.mot2pointValues(motFilename, labels, orientation=[1, 1, 1])
convert an element of an opensim mot file into a btk-point values (ie array(n,3) with n: the number of frames)
- Parameters
motFilename (str) – full filename of the mot file
label (str) – label to convert
orientation (list) – scales to apply before returning final values. Default is [1,1,1]
- pyCGM2.Model.Opensim.osimProcessing.setGlobalTransormation_lab_osim(axis, forwardProgression)
return the rotation matrix expressing the opensim global coordinate system to the laboratory coordinate system
- Parameters
axis (str) – defined progression axis (ie X or Y ).
forwardProgression (bool) – forward progression flag.
True ((if) –
of (the movement progression is along the positive value) –
) (your progression axis) –
- pyCGM2.Model.Opensim.osimProcessing.smartTrcExport(acq, filenameNoExt)
save as a trc file
- Parameters
acq (Btk.Acquisition) – an acquisition
filenameNoExt (str) – filename without extension
- pyCGM2.Model.Opensim.osimProcessing.sto2pointValues(storageObject, label, R_LAB_OSIM)
transform an element of a storage instance into the Laboratory coordinate system.
- Parameters
storageObject (opensim.Storage) – an opensim storage instance.
label (str) – label to extract from the storage instance
R_LAB_OSIM (array(3,3)) – rotation matrix for passing from the lab to opensim coordinate sytem