User Tools

Site Tools


visual3d:documentation:emg:processing:onset

Onset

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 Teager-Kaiser Energy Operator and Event_Threshold. This is not a definitive definition, but simply a starting point for the user.

teager_kaiser.jpg

!Apply a high pass and low pass filter assuming that the surface emg signal contains information
!from 20 to 500 Hz

Highpass_Filter
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=EMG_C
! /SIGNAL_FOLDER=ORIGINAL
! /RESULT_SUFFIX=
/RESULT_FOLDER=PROCESSED
! /FILTER_CLASS=BUTTERWORTH
/FREQUENCY_CUTOFF=20
/NUM_REFLECTED=0
/TOTAL_BUFFER_SIZE=100
! /NUM_BIDIRECTIONAL_PASSES=1
;

!Apply the Teager-Kaiser Operator

Teager_Kaiser_Energy
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=EMG_C
/SIGNAL_FOLDER=PROCESSED
! /SIGNAL_COMPONENTS=
! /RESULT_FOLDER=PROCESSED
! /EVENT_SEQUENCE=
! /EXCLUDE_EVENTS=
;

!Create events that define the resting baseline of the muscle

Event_Explicit
/EVENT_NAME=REST1
/FRAME=1
! /TIME=
;

Event_Explicit
/EVENT_NAME=REST2
/FRAME=150
! /TIME=
;

!Compute the median and standard deviation of the TKO envelope during rest

Metric_Median
/RESULT_METRIC_NAME=_MED
/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE
/RESULT_METRIC_FOLDER=EMG
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=EMG_C
/SIGNAL_FOLDER=PROCESSED
! /SIGNAL_COMPONENTS=ALL_COMPONENTS
/EVENT_SEQUENCE=REST1+REST2
/EXCLUDE_EVENTS=
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
;

Metric_StdDev
/RESULT_METRIC_NAME=_SD
/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE
/RESULT_METRIC_FOLDER=EMG
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=EMG_C
/SIGNAL_FOLDER=PROCESSED
! /SIGNAL_COMPONENTS=ALL_COMPONENTS
/EVENT_SEQUENCE=REST1+REST2
/EXCLUDE_EVENTS=
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
;

!Identify the event EMG_C_ON based on a threshold crossing
!of the median + 3 * standard deviation

Event_Threshold
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=EMG_C
/SIGNAL_FOLDER=PROCESED
/EVENT_NAME=EMG_C_ON
/SELECT_X=TRUE
! /SELECT_Y=FALSE
! /SELECT_Z=FALSE
! /SELECT_RESIDUAL=FALSE
/THRESHOLD=METRIC::EMG::EMG2_MED+3*METRIC::EMG::EMG2_SD
! /FRAME_WINDOW=8
! /FRAME_OFFSET=0
/ASCENDING=TRUE
! /DESCENDING=FALSE
! /ENSURE_RANGE_FRAMES_BEFORE_THRESHOLD_CROSSING=FALSE
/ENSURE_RANGE_FRAMES_AFTER_THRESHOLD_CROSSING=TRUE
! /START_AT_EVENT=
! /END_AT_EVENT=
/EVENT_INSTANCE=1
;
visual3d/documentation/emg/processing/onset.txt · Last modified: 2024/07/17 11:45 by sgranger