visual3d:documentation:emg:processing:total_emg_power
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
visual3d:documentation:emg:processing:total_emg_power [2024/07/17 15:41] – removed sgranger | visual3d:documentation:emg:processing:total_emg_power [2024/07/17 15:45] (current) – created sgranger | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Total EMG Power ====== | ||
+ | |||
+ | ==== Introduction ==== | ||
+ | |||
+ | To determine when a muscle is activated a threshold needs to be chosen from a period of inactivity. When the signal surpasses the threshold, the muscle is turned on. There are three different ways to do so. | ||
+ | |||
+ | - EMG Onset using Event_Threshold | ||
+ | - EMG Onset based on TKEO | ||
+ | - EMG Onset based on automatic detection | ||
+ | |||
+ | ==== EMG Onset using Event_Threshold ==== | ||
+ | |||
+ | Computing the onset of an EMG signal can be quite tricky. In this example, we describe a pipeline for a straightforward estimation of EMG onset based on the EMG envelope and [[Visual3D: | ||
+ | |||
+ | {{: | ||
+ | === Pipeline === | ||
+ | |||
+ | The following pipeline first includes a low pass filter, a high pass filter and a moving RMS. The first event named REST1 is created by selecting the first frame indicating the start of the rest. The second event named REST2 is created by selecting the frame number at the end of the rest. A typical threshold is median + 3*standard deviation. The median and standard deviation are then calculated by using the [[Visual3D: | ||
+ | |||
+ | < | ||
+ | !Apply a high pass and low pass filter assuming that the surface emg signal contains information | ||
+ | !from 20 to 500 Hz | ||
+ | |||
+ | Highpass_Filter | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | Lowpass_Filter | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | !Compute the RMS of the emg signal based on a 100 ms window | ||
+ | |||
+ | Moving_RMS | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | |||
+ | !Create events that define the resting baseline of the muscle | ||
+ | |||
+ | Event_Explicit | ||
+ | / | ||
+ | /FRAME=1 | ||
+ | ! /TIME= | ||
+ | ; | ||
+ | |||
+ | Event_Explicit | ||
+ | / | ||
+ | /FRAME=150 | ||
+ | ! /TIME= | ||
+ | ; | ||
+ | |||
+ | !Compute the median and standard deviation of the EMG envelope during rest | ||
+ | |||
+ | Metric_Median | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | Metric_StdDev | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | !Identify the event EMG2_ON based on a threshold crossing | ||
+ | !of the median + 3 * standard deviation | ||
+ | |||
+ | Event_Threshold | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | === Pipeline for computing the number of frames the signal is on === | ||
+ | |||
+ | To calculate how long a signal is on or how long a muscle is active, a signal will be created to be set as zero when below the threshold, and one when the signal is above the threshold. | ||
+ | |||
+ | < | ||
+ | ! Create a signal that is zero when the EMG is off, and one when it is ON | ||
+ | |||
+ | ! Start with creating a signal that is zero at all frames | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | ! Set all frames between the ON/OFF events to one | ||
+ | Set_Data_To_New_Values | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! /END_FRAME= | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | ! Add the signal during the gait cycle | ||
+ | ! The result will be the number of frames the signal is ON during the gait cycle | ||
+ | Metric_Sum | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | ==== EMG Onset based on TKEO ==== | ||
+ | |||
+ | Computing the onset of an EMG signal can be quite tricky. In this example, we describe a pipeline for a straightforward estimation of EMG onset based on the the [[Visual3D: | ||
+ | |||
+ | {{: | ||
+ | === Pipeline === | ||
+ | |||
+ | The following pipeline follows the same general format as above, yet at the beginning there is a Highpass Filter and a Teager Kaiser Energy Operator instead of a Lowpass filter and a HighPass Filter. | ||
+ | |||
+ | < | ||
+ | !Apply a high pass and low pass filter assuming that the surface emg signal contains information | ||
+ | !from 20 to 500 Hz | ||
+ | |||
+ | Highpass_Filter | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | !Apply the Teager-Kaiser Operator | ||
+ | |||
+ | Teager_Kaiser_Energy | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | !Create events that define the resting baseline of the muscle | ||
+ | |||
+ | Event_Explicit | ||
+ | / | ||
+ | /FRAME=1 | ||
+ | ! /TIME= | ||
+ | ; | ||
+ | |||
+ | Event_Explicit | ||
+ | / | ||
+ | /FRAME=150 | ||
+ | ! /TIME= | ||
+ | ; | ||
+ | |||
+ | !Compute the median and standard deviation of the TKO envelope during rest | ||
+ | |||
+ | Metric_Median | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | Metric_StdDev | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | |||
+ | !Identify the event EMG_C_ON based on a threshold crossing | ||
+ | !of the median + 3 * standard deviation | ||
+ | |||
+ | Event_Threshold | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | ==== EMG Onset based on Automatic Detection ==== | ||
+ | |||
+ | The following meta-command may be used to process EMG analog signals to find " | ||
+ | |||
+ | **Meta-Command**: | ||
+ | |||
+ | **Tutorial page**: [[Visual3D: | ||
+ | |||
+ | |||
visual3d/documentation/emg/processing/total_emg_power.1721230910.txt.gz · Last modified: 2024/07/17 15:41 by sgranger