Mimicking Temporal Distance Command
This is an example pipeline that mimics the temporal distance metrics command. The script allows the user to customize the metrics computed. This is only an example because the computed values are not identical with the metrics computed by Visual3D temporal distance command.
! Select ALL_FILES as active Select_Active_File /FILE_NAME=ALL_FILES ; ! Calculate automatic gait events Automatic_Gait_Events ! /SELECT_X=FALSE ! /SELECT_Y=FALSE /SELECT_Z=TRUE /THRESHOLD=0.000000 /RADIUS=8 ! /USE_TPR=TRUE ; ! Calculate Metric Stride Vector - Proximal position of LFT from LHS to LHS ! Generate Mean and STD DEV Metric_Vector_Between_Events /START_SIGNAL_TYPE=KINETIC_KINEMATIC /START_SIGNAL_NAME=ProxEndPos /START_SIGNAL_FOLDER=LFT /END_SIGNAL_TYPE=KINETIC_KINEMATIC /END_SIGNAL_NAME=ProxEndPos /END_SIGNAL_FOLDER=LFT /EVENT_SEQUENCE=LHS+LHS /EXCLUDE_EVENTS= /METRIC_NAME=StrideVectors ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ! /GENERATE_VECTOR_LENGTH_METRIC=FALSE ; ! Calculate Metric Stride Vector - Proximal position of RFT from RHS to RHS ! Generate Mean and STD DEV and append to the previous set of StrideVectors values Metric_Vector_Between_Events /START_SIGNAL_TYPE=KINETIC_KINEMATIC /START_SIGNAL_NAME=ProxEndPos /START_SIGNAL_FOLDER=RFT /END_SIGNAL_TYPE=KINETIC_KINEMATIC /END_SIGNAL_NAME=ProxEndPos /END_SIGNAL_FOLDER=RFT /EVENT_SEQUENCE=RHS+RHS /EXCLUDE_EVENTS= /METRIC_NAME=StrideVectors ! /GENERATE_MEAN_AND_STDDEV=TRUE /APPEND_TO_EXISTING_VALUES=TRUE ! /GENERATE_VECTOR_LENGTH_METRIC=FALSE ; ! Calculate Metric LeftStep Vector - Proximal position of RFT from RHS to Proximal ! position of LFT at LHS Metric_Vector_Between_Events /START_SIGNAL_TYPE=KINETIC_KINEMATIC /START_SIGNAL_NAME=ProxEndPos /START_SIGNAL_FOLDER=RFT /END_SIGNAL_TYPE=KINETIC_KINEMATIC /END_SIGNAL_NAME=ProxEndPos /END_SIGNAL_FOLDER=LFT /EVENT_SEQUENCE=RHS+LHS /EXCLUDE_EVENTS= /METRIC_NAME=LeftStep /GENERATE_MEAN_AND_STDDEV=FALSE ! /APPEND_TO_EXISTING_VALUES=FALSE ! /GENERATE_VECTOR_LENGTH_METRIC=FALSE ; ! Calculate Metric RightStep Vector - Proximal position of LFT from LHS to Proximal ! position of RFT at RHS Metric_Vector_Between_Events /START_SIGNAL_TYPE=KINETIC_KINEMATIC /START_SIGNAL_NAME=ProxEndPos /START_SIGNAL_FOLDER=LFT /END_SIGNAL_TYPE=KINETIC_KINEMATIC /END_SIGNAL_NAME=ProxEndPos /END_SIGNAL_FOLDER=RFT /EVENT_SEQUENCE=LHS+RHS /EXCLUDE_EVENTS= /METRIC_NAME=RightStep /GENERATE_MEAN_AND_STDDEV=FALSE ! /APPEND_TO_EXISTING_VALUES=FALSE ! /GENERATE_VECTOR_LENGTH_METRIC=FALSE ; ! Calculate LeftStepLength by taking a dot product of LeftStep and StrideVectors_MEAN ! Generate Mean and STD DEV Metric_Dot_Product ! /METRIC1_FILE= /METRIC1_NAME=LeftStep ! /METRIC1_FOLDER=PROCESSED ! /METRIC2_FILE=GLOBAL /METRIC2_NAME=StrideVectors_MEAN ! /METRIC2_FOLDER=PROCESSED /RESULT_METRIC_NAME=LeftStepLength ! /RESULT_METRIC_FOLDER=PROCESSED ! /DIVIDE_BY_METRIC2_LENGTH=TRUE /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate RightStepLength by taking a dot product of RightStep and StrideVectors_MEAN ! Generate Mean and STD DEV Metric_Dot_Product ! /METRIC1_FILE= /METRIC1_NAME=RightStep ! /METRIC1_FOLDER=PROCESSED ! /METRIC2_FILE=GLOBAL /METRIC2_NAME=StrideVectors_MEAN ! /METRIC2_FOLDER=PROCESSED /RESULT_METRIC_NAME=RightStepLength ! /RESULT_METRIC_FOLDER=PROCESSED ! /DIVIDE_BY_METRIC2_LENGTH=TRUE /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate RightStepWidth by taking cross product of RightStep vector and StrideVectors_MEAN ! Generate Mean and STD DEV Metric_Cross_Product ! /METRIC1_FILE= /METRIC1_NAME=RightStep ! /METRIC1_FOLDER=PROCESSED /METRIC2_FILE=GLOBAL /METRIC2_NAME=StrideVectors_MEAN ! /METRIC2_FOLDER=PROCESSED ! /DIVIDE_BY_METRIC2_LENGTH=TRUE /RESULT_METRIC_NAME=RightStepWidth ! /RESULT_METRIC_FOLDER=PROCESSED ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE /GENERATE_VECTOR_LENGTH_METRIC=TRUE ; ! Calculate LeftStepWidth by taking cross product of LeftStep vector and StrideVectors_MEAN ! Generate Mean and STD DEV Metric_Cross_Product ! /METRIC1_FILE= /METRIC1_NAME=LeftStep ! /METRIC1_FOLDER=PROCESSED /METRIC2_FILE=GLOBAL /METRIC2_NAME=StrideVectors_MEAN ! /METRIC2_FOLDER=PROCESSED ! /DIVIDE_BY_METRIC2_LENGTH=TRUE /RESULT_METRIC_NAME=LeftStepWidth ! /RESULT_METRIC_FOLDER=PROCESSED ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE /GENERATE_VECTOR_LENGTH_METRIC=TRUE ; ! Calculate StepWidth by taking cross product of LeftStep vector and StrideVectors_MEAN ! Generate Mean and STD DEV Metric_Cross_Product ! /METRIC1_FILE= /METRIC1_NAME=LeftStep ! /METRIC1_FOLDER=PROCESSED /METRIC2_FILE=GLOBAL /METRIC2_NAME=StrideVectors_MEAN ! /METRIC2_FOLDER=PROCESSED ! /DIVIDE_BY_METRIC2_LENGTH=TRUE /RESULT_METRIC_NAME=StepWidth ! /RESULT_METRIC_FOLDER=PROCESSED ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE /GENERATE_VECTOR_LENGTH_METRIC=TRUE ; ! Calculate StepWidth by taking cross product of RightStep vector and StrideVectors_MEAN ! Generate Mean and STD DEV - Append to previous StepWidth Metric_Cross_Product ! /METRIC1_FILE= /METRIC1_NAME=RightStep ! /METRIC1_FOLDER=PROCESSED /METRIC2_FILE=GLOBAL /METRIC2_NAME=StrideVectors_MEAN ! /METRIC2_FOLDER=PROCESSED ! /DIVIDE_BY_METRIC2_LENGTH=TRUE /RESULT_METRIC_NAME=StepWidth ! /RESULT_METRIC_FOLDER=PROCESSED ! /GENERATE_MEAN_AND_STDDEV=TRUE /APPEND_TO_EXISTING_VALUES=TRUE /GENERATE_VECTOR_LENGTH_METRIC=TRUE ; ! Calculate Left_Step_Time from RHS to LHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RHS+LHS /EXCLUDE_EVENTS= /METRIC_NAME=Left_Step_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Right_Step_Time from LHS to RHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LHS+RHS /EXCLUDE_EVENTS= /METRIC_NAME=Right_Step_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Step_Time from RHS to LHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RHS+LHS /EXCLUDE_EVENTS= /METRIC_NAME=Step_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Step_Time from LHS to RHS - append onto previous Step_Time ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LHS+RHS /EXCLUDE_EVENTS= /METRIC_NAME=Step_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE /APPEND_TO_EXISTING_VALUES=TRUE ; ! Calculate Left_Stance_Time from LHS to LTO ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LHS+LTO /EXCLUDE_EVENTS= /METRIC_NAME=Left_Stance_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Right_Stance_Time from RHS to RTO ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RHS+RTO /EXCLUDE_EVENTS= /METRIC_NAME=Right_Stance_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Left_Swing_Time from LTO to LHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LTO+LHS /EXCLUDE_EVENTS= /METRIC_NAME=Left_Swing_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Right_Swing_Time from RTO to RHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RTO+RHS /EXCLUDE_EVENTS= /METRIC_NAME=Right_Swing_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Left_Cycle_Time from LHS to LHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LHS+LHS /EXCLUDE_EVENTS= /METRIC_NAME=Left_Cycle_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Right_Cycle_Time from RHS to RHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RHS+RHS /EXCLUDE_EVENTS= /METRIC_NAME=Right_Cycle_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Cycle_Time from LHS to LHS ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LHS+LHS /EXCLUDE_EVENTS= /METRIC_NAME=Cycle_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Cycle_Time from RHS to RHS - append to previous ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RHS+RHS /EXCLUDE_EVENTS= /METRIC_NAME=Cycle_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE /APPEND_TO_EXISTING_VALUES=TRUE ; ! Calculate Right_Terminal_Double_Limb_Support from LHS to RTO (exclude LTO to RHS) ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LHS+RTO /EXCLUDE_EVENTS=LTO+RHS /METRIC_NAME=Right_Terminal_Double_Limb_Support ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Left_Terminal_Double_Limb_Support from RHS to LTO (exclude RTO to LHS) ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RHS+LTO /EXCLUDE_EVENTS=RTO+LHS /METRIC_NAME=Left_Terminal_Double_Limb_Support ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Right_Initial_Double_Limb_Support_Time from RHS to LTO (exclude LHS to RTO) ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=RHS+LTO /EXCLUDE_EVENTS=LHS+RTO /METRIC_NAME=Right_Initial_Double_Limb_Support_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Calculate Left_Initial_Double_Limb_Support_Time from LHS to RTO (exclude RHS to LTO) ! Generate Mean and STD DEV Time_Between_Events /EVENT_SEQUENCE=LHS+RTO /EXCLUDE_EVENTS=RHS+LTO /METRIC_NAME=Left_Initial_Double_Limb_Support_Time ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Select Global as active file Select_Active_File /FILE_NAME=GLOBAL ; ! Calculate Double_Limb_Support_Time by adding Right_Terminal_Double_Limb_Support_MEAN ! and Right_Initial_Double_Limb_Support_Time_MEAN Add_Signals /SIGNAL_TYPES=METRIC+METRIC /SIGNAL_NAMES=Right_Terminal_Double_Limb_Support_MEAN+Right_Initial_Double_Limb_Support_Time_MEAN /SIGNAL_FOLDER=PROCESSED+PROCESSED /RESULT_NAME=Double_Limb_Support_Time ; ! Select ALL_FILES as active file Select_Active_File /FILE_NAME=ALL_FILES ; ! Calculate the stride vector mangitude Signal_Magnitude /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=StrideVectors /SIGNAL_FOLDER=PROCESSED /RESULT_NAME=StrideVectorsMagnitude ; ! Calculate Stride Length from the stide vector magnitude Generate_Metric /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=StrideVectorsMagnitude /SIGNAL_FOLDER=PROCESSED /METRIC_PROCESS=MEAN /METRIC_NAME=Stride_Length ! /APPEND_SUFFIX=FALSE ! /RANGE_START= ! /RANGE_END= ;
Example : Modification
Customer Request:
I am using the temporal distance (with metric pipeline commands) script from your website, however, I'd like to calculate the parameters by stride instead of using the Global StrideVectors_MEAN. First, I calculated vector between events to create a Right StrideVectors and Left StrideVectors. To compute stride width, do I cross the LeftStep vectors with the Left StrideVectors or Right StrideVectors.
Response:
You would cross the left with the right if you want the starting event to match. One problem you are going to run into is that there won't always be a matching stride vector for each step vector. To fix this, you might want to create new HS and TO events for each side calculation so that you will always have the correct number of events to calculate the metrics. In the following, RS and LS stand for Right Stride, and Left Stride. For example, for the left step length and width calculations you would create new events RS_LHS, RS_LTO, such that the left side events are created from Event_Copy using LHS and LTO as the event to copy, but only if it occurs in the Right Stride (RS) EVENT_SEQUENCE RHS+RHS. Do the same for the right side. Calculate the left strides using LHS, right strides using RHS. Calculate the left steps metrics using RS_RHS to RS_LHS against the right strides, and the right step metrics using LS_LHS to LS_RHS against the left strides. You will end up with fewer metrics this way than with our default way of calculating metrics against the average motion file walking direction. Your method will be more accurate if the subject is walking a curved path.