User Tools

Site Tools


visual3d:documentation:pipeline:signal_commands:computing_the_range_of_motion

Computing the Range of Motion

Background

There are several steps required to determine the range of motion. This page details three examples:

  • Example 1 uses events to defined maximum and minimum joint angles. Finds the signal value at these events and computes the range from there.
  • Example 2 computes the range by finding the maximum and minimum joint angle and using the evaluate expression command to calculate the difference (range)
  • Example 3 computes a cummulative range of motion

Example 1: Compute Range of Motion from events

Consider the right knee angle angle expressed as “Right Knee Ang”. Compute the range of motion over all frames in the file using events. The result is named “Right Knee Ang ROM”.

  • Compute START and END events
  • Compute the desired joint angle “Right Knee Ang ROM”
  • Use the pipeline command for the EVENT_GLOBAL_MAXIMUM to determine the Frame at which the maximum joint angle occurs during the range of interest (e.g. Start and End Event Labels); This will create an Event Label. Note: you will have to select the component of the signal to use. For the default Visual3D segment coordinate system flexion/extension will be the x-component of the joint angle.
  • Use the pipeline command Metric_Signal_Value_At_Event to create a metric value containing the joint angle at the “maximum” event.
  • Use the pipeline command for the EVENT_GLOBAL_MINIMUM to determine the Frame at which the minimum joint angle occurs during the range of interest (e.g. Start and End Event Labels); This will create an Event Label. Note: you will have to select the component of the signal to use. For the default Visual3D segment coordinate system flexion/extension will be the x-component of the joint angle.
  • Use the pipeline command Metric_Signal_Value_At_Event to create a metric value containing the joint angle at the “minimum” event.
  • Use the pipeline command for Evaluate_Expression to subtract the minimum value from the maximum value. Note: in the expression you will have to select the component of the signal to use. For the default Visual3D segment coordinate system flexion/extension will be the x-component of the joint angle.
  • The metric “Right Knee Ang ROM” created in the previous step is the range of motion for the component of the joint angle selected.

The script from the above steps can be found below:

! Define a START Event
Event_Explicit
/EVENT_NAME=START
/FRAME=1
! /TIME=
;

! Define a END Event
Event_Explicit
/EVENT_NAME=END
/FRAME=EOF
! /TIME=
;

Compute_Model_Based_Data
/RESULT_NAME=Right Knee Ang
/FUNCTION=JOINT_ANGLE
/SEGMENT=RSK
/REFERENCE_SEGMENT=RTH
/RESOLUTION_COORDINATE_SYSTEM=
! /USE_CARDAN_SEQUENCE=FALSE
! /NORMALIZATION=FALSE
! /NORMALIZATION_METHOD=
! /NORMALIZATION_METRIC=
! /NEGATEX=FALSE
! /NEGATEY=FALSE
! /NEGATEZ=FALSE
! /AXIS1=X
! /AXIS2=Y
! /AXIS3=Z
;

! Calculate an event MAX at the Maximum joint angle
Event_Global_Maximum
/SIGNAL_TYPES=LINK_MODEL_BASED 
/SIGNAL_NAMES=Right Knee Ang
/SIGNAL_FOLDER=ORIGINAL
/EVENT_NAME=MAX
/SELECT_X=TRUE
! /SELECT_Y=FALSE
! /SELECT_Z=FALSE
! /EVENT_SEQUENCE=
! /EXCLUDE_EVENTS=
/START_AT_EVENT=START
/END_AT_EVENT=END
;

! Find the joint angle at event MAX
Metric_Signal_Value_At_Event
/RESULT_METRIC_NAME=Right Knee Ang_MAX
! /RESULT_METRIC_FOLDER=PROCESSED
/SIGNAL_TYPES=LINK_MODEL_BASED
/SIGNAL_NAMES=Right Knee Ang
/SIGNAL_FOLDER=ORIGINAL
/EVENT_NAME=MAX
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
! /GENERATE_VECTOR_LENGTH_METRIC=FALSE
! /RETAIN_NO_DATA_VALUES=FALSE
;

! Calculate an event MIN at the Minimum joint angle
Event_Global_Minimum
/SIGNAL_TYPES=LINK_MODEL_BASED 
/SIGNAL_NAMES=Right Knee Ang
/SIGNAL_FOLDER=ORIGINAL
/EVENT_NAME=MIN
/SELECT_X=TRUE
! /SELECT_Y=FALSE
! /SELECT_Z=FALSE
! /EVENT_SEQUENCE=
! /EXCLUDE_EVENTS=
/START_AT_EVENT=START
/END_AT_EVENT=END
;

! Find the joint angle at event MIN
Metric_Signal_Value_At_Event
/RESULT_METRIC_NAME=Right Knee Ang_MIN
! /RESULT_METRIC_FOLDER=PROCESSED
/SIGNAL_TYPES=LINK_MODEL_BASED
/SIGNAL_NAMES=Right Knee Ang
/SIGNAL_FOLDER=ORIGINAL
/EVENT_NAME=MIN
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
! /GENERATE_VECTOR_LENGTH_METRIC=FALSE
! /RETAIN_NO_DATA_VALUES=FALSE
;

! Subtract the minimum value from the maximum value.
! The metric created is the range of motion for the component of the joint angle selected.
Evaluate_Expression
/EXPRESSION=METRIC::PROCESSED::Right Knee Ang_MAX::X-METRIC::PROCESSED::Right Knee Ang_MIN::X
/RESULT_TYPE=METRIC
/RESULT_NAME=Right Knee Ang ROM
! /RESULT_FOLDER=PROCESSED
;

Example 2: Compute Range of Motion over all frames

Consider the right knee angle angle expressed as “Right Knee Ang”. Compute the range of motion over all frames in the file. The result is named “Right Knee Ang ROM”.

! Find the maximum value of all 3 components

Metric_Maximum
/RESULT_METRIC_NAME=_MAX
/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE
! /RESULT_METRIC_FOLDER=PROCESSED
/SIGNAL_TYPES=LINK_MODEL_BASED
/SIGNAL_NAMES=Right Knee Ang
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_COMPONENTS=ALL_COMPONENTS
/EVENT_SEQUENCE=
/EXCLUDE_EVENTS=
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
! /CREATE_GLOBAL_MAXIMUM=FALSE
;

! Find the minimum value of all 3 components

Metric_Minimum
/RESULT_METRIC_NAME=_MIN
/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE
! /RESULT_METRIC_FOLDER=PROCESSED
/SIGNAL_TYPES=LINK_MODEL_BASED
/SIGNAL_NAMES=Right Knee Ang
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_COMPONENTS=ALL_COMPONENTS
/EVENT_SEQUENCE=
/EXCLUDE_EVENTS=
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
! /CREATE_GLOBAL_MINIMUM=FALSE
;

! The range of motion can be estimated as the difference between max and min
! Note: that this isn't quite true because angles are not vectors

Evaluate_Expression
/EXPRESSION=METRIC::PROCESSED::Right Knee Ang_MAX-METRIC::PROCESSED::Right Knee Ang_MIN
/RESULT_NAME=Right Knee Ang ROM
/RESULT_TYPE=METRIC
! /RESULT_FOLDER=PROCESSED
;

Example 3: Computing the cumulative range of motion

One may want to calculate the cummulative amount of a certain movement occurring at a joint during a task. For example, consider hip flexion range of motion for 2 subjects:

  • Subject 1 - reaches 40° of flexion from 0°
  • Subject 2 - starts from 0° and reaches 20° then comes back to 15° and then reaches 40°

The range is the same (40°) for both subjects but the amount of movement is different. Subject 1 moves directly and his cumulative amount of movement is 40°. However, Subject 2's movement is not direct and the cumulative amount of movement is 20 + 5 + 25 = 50°

The following set of pipeline commands will compute this cumulative range.

! Compute the velocity of the signal (in this case RKNEE_ANGLE) 

First_Derivative
/SIGNAL_TYPES=LINK_MODEL_BASED
/SIGNAL_NAMES=RKNEE_ANGLE
! /SIGNAL_FOLDER=ORIGINAL
/RESULT_SUFFIX=_VEL
/RESULT_FOLDER=VELOCITY
; 

! Rectify the velocity 

Evaluate_Expression
/EXPRESSION=ABS(LINK_MODEL_BASED::VELOCITY::RKNEE_ANGLE_VEL)
/RESULT_NAME=RKNEE_ANGLE_VEL
/RESULT_TYPE=LINK_MODEL_BASED
/RESULT_FOLDER=RECTIFIED_VELOCITY
; 

! Integrate the rectified velocity from START to STOP

Metric_Integrate
/RESULT_METRIC_NAME=RANGE
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
! /RESULT_METRIC_FOLDER=PROCESSED
/SIGNAL_TYPES=LINK_MODEL_BASED
/SIGNAL_NAMES=RKNEE_ANGLE_VEL
/SIGNAL_FOLDER=RECTIFIED_VELOCITY
/SIGNAL_COMPONENTS=X
/EVENT_SEQUENCE=START+STOP
/EXCLUDE_EVENTS=
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
;
visual3d/documentation/pipeline/signal_commands/computing_the_range_of_motion.txt · Last modified: 2024/07/17 11:46 by sgranger