User Tools

Site Tools


visual3d:documentation:emg:filtering:linear_envelope

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
visual3d:documentation:emg:filtering:linear_envelope [2024/06/19 12:47] sgrangervisual3d:documentation:emg:filtering:linear_envelope [2024/07/17 15:45] (current) – created sgranger
Line 1: Line 1:
-{{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:documentation:pipeline:event_commands:event_threshold|event_threshold]]. this is not a definitive definition, but simply a starting point for the user.+====== Linear Envelope ======
  
-emg2.jpg +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:Documentation:Pipeline:Event_Commands:Event_Threshold|Event_Threshold]]. This is not a definitive definition, but simply a starting point for the user. 
-three event labels are identified on this figure. the yellow and red events specify the "rest period"this is arbitrary and is specified by the user explicitly. the blue event label is the first threshold crossing above the "median + 3*standard deviation".+ 
 +{{:Emg2.jpg}} 
 +Three event labels are identified on this figure. The yellow and red events specify the "rest period"This is arbitrary and is specified by the user explicitly. The blue event label is the first threshold crossing above the "median + 3*standard deviation".
  
 <code> <code>
-!apply a high pass and low pass filter assuming that the surface emg signal contains information +!Apply a high pass and low pass filter assuming that the surface emg signal contains information 
-!from 20 to 500 hz+!from 20 to 500 Hz
  
-highpass_filter +Highpass_Filter 
-/signal_types=analog +/SIGNAL_TYPES=ANALOG 
-/signal_names=emg2 +/SIGNAL_NAMES=EMG2 
-! /signal_folder=original +! /SIGNAL_FOLDER=ORIGINAL 
-! /result_suffix+! /RESULT_SUFFIX
-/result_folder=rms +/RESULT_FOLDER=RMS 
-! /filter_class=butterworth +! /FILTER_CLASS=BUTTERWORTH 
-/frequency_cutoff=20 +/FREQUENCY_CUTOFF=20 
-/num_reflected=0 +/NUM_REFLECTED=0 
-/total_buffer_size=100 +/TOTAL_BUFFER_SIZE=100 
-! /num_bidirectional_passes=1+! /NUM_BIDIRECTIONAL_PASSES=1
 ; ;
  
-lowpass_filter +Lowpass_Filter 
-/signal_types=analog +/SIGNAL_TYPES=ANALOG 
-! /signal_names+! /SIGNAL_NAMES
-/signal_folder=rms +/SIGNAL_FOLDER=RMS 
-! /result_suffix+! /RESULT_SUFFIX
-/result_folder=rms +/RESULT_FOLDER=RMS 
-! /filter_class=butterworth +! /FILTER_CLASS=BUTTERWORTH 
-/frequency_cutoff=500 +/FREQUENCY_CUTOFF=500 
-/num_reflected=0 +/NUM_REFLECTED=0 
-/total_buffer_size=100 +/TOTAL_BUFFER_SIZE=100 
-! /num_bidirectional_passes=1+! /NUM_BIDIRECTIONAL_PASSES=1
 ; ;
  
-!compute the rms of the emg signal based on a 100 ms window+!Compute the RMS of the emg signal based on a 100 ms window
  
-moving_rms +Moving_RMS 
-/signal_types=analog +/SIGNAL_TYPES=ANALOG 
-/signal_names=emg2 +/SIGNAL_NAMES=EMG2 
-/signal_folder=rms +/SIGNAL_FOLDER=RMS 
-! /result_suffix+! /RESULT_SUFFIX
-/result_folder=rms +/RESULT_FOLDER=RMS 
-/num_window_frames=1+0.1*parameter::analog::rate+/NUM_WINDOW_FRAMES=1+0.1*PARAMETER::ANALOG::RATE
 ; ;
  
-!create events that define the resting baseline of the muscle+!Create events that define the resting baseline of the muscle
  
-event_explicit +Event_Explicit 
-/event_name=rest1 +/EVENT_NAME=REST1 
-/frame=1 +/FRAME=1 
-! /time=+! /TIME=
 ; ;
  
-event_explicit +Event_Explicit 
-/event_name=rest2 +/EVENT_NAME=REST2 
-/frame=150 +/FRAME=150 
-! /time=+! /TIME=
 ; ;
  
-!compute the median and standard deviation of the emg envelope during rest+!Compute the median and standard deviation of the EMG envelope during rest
  
-metric_median +Metric_Median 
-/result_metric_name=_med +/RESULT_METRIC_NAME=_MED 
-/apply_as_suffix_to_signal_name=true +/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE 
-/result_metric_folder=emg +/RESULT_METRIC_FOLDER=EMG 
-/signal_types=analog +/SIGNAL_TYPES=ANALOG 
-/signal_names=emg2 +/SIGNAL_NAMES=EMG2 
-/signal_folder=rms +/SIGNAL_FOLDER=RMS 
-! /signal_components=all_components +! /SIGNAL_COMPONENTS=ALL_COMPONENTS 
-/event_sequence=rest1+rest2 +/EVENT_SEQUENCE=REST1+REST2 
-/exclude_events+/EXCLUDE_EVENTS
-/generate_mean_and_stddev=false +/GENERATE_MEAN_AND_STDDEV=FALSE 
-! /append_to_existing_values=false+! /APPEND_TO_EXISTING_VALUES=FALSE
 ; ;
  
-metric_stddev +Metric_StdDev 
-/result_metric_name=_sd +/RESULT_METRIC_NAME=_SD 
-/apply_as_suffix_to_signal_name=true +/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE 
-/result_metric_folder=emg +/RESULT_METRIC_FOLDER=EMG 
-/signal_types=analog +/SIGNAL_TYPES=ANALOG 
-/signal_names=emg2 +/SIGNAL_NAMES=EMG2 
-/signal_folder=rms +/SIGNAL_FOLDER=RMS 
-! /signal_components=all_components +! /SIGNAL_COMPONENTS=ALL_COMPONENTS 
-/event_sequence=rest1+rest2 +/EVENT_SEQUENCE=REST1+REST2 
-/exclude_events+/EXCLUDE_EVENTS
-/generate_mean_and_stddev=false +/GENERATE_MEAN_AND_STDDEV=FALSE 
-! /append_to_existing_values=false+! /APPEND_TO_EXISTING_VALUES=FALSE
 ; ;
  
-!identify the event emg2_on based on a threshold crossing+!Identify the event EMG2_ON based on a threshold crossing
 !of the median + 3 * standard deviation !of the median + 3 * standard deviation
  
-event_threshold +Event_Threshold 
-/signal_types=analog +/SIGNAL_TYPES=ANALOG 
-/signal_names=emg2 +/SIGNAL_NAMES=EMG2 
-/signal_folder=rms +/SIGNAL_FOLDER=RMS 
-/event_name=emg2_on +/EVENT_NAME=EMG2_ON 
-/select_x=true +/SELECT_X=TRUE 
-! /select_y=false +! /SELECT_Y=FALSE 
-! /select_z=false +! /SELECT_Z=FALSE 
-! /select_residual=false +! /SELECT_RESIDUAL=FALSE 
-/threshold=metric::emg::emg2_med+3*metric::emg::emg2_sd +/THRESHOLD=METRIC::EMG::EMG2_MED+3*METRIC::EMG::EMG2_SD 
-! /frame_window=8 +! /FRAME_WINDOW=8 
-! /frame_offset=0 +! /FRAME_OFFSET=0 
-/ascending=true +/ASCENDING=TRUE 
-! /descending=false +! /DESCENDING=FALSE 
-! /ensure_range_frames_before_threshold_crossing=false +! /ENSURE_RANGE_FRAMES_BEFORE_THRESHOLD_CROSSING=FALSE 
-/ensure_range_frames_after_threshold_crossing=true +/ENSURE_RANGE_FRAMES_AFTER_THRESHOLD_CROSSING=TRUE 
-! /start_at_event+! /START_AT_EVENT
-! /end_at_event+! /END_AT_EVENT
-/event_instance=1+/EVENT_INSTANCE=1
 ; ;
 </code> </code>
Line 117: Line 119:
  
  
-===== count the number of frames the signals is on =====+==== Count the Number of Frames the signals is ON ====
  
 <code> <code>
-create a signal that is zero when the emg is off, and one when it is on+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 +Start with creating a signal that is zero at all frames 
-evaluate_expression +Evaluate_Expression 
-/expression=frame_numbers::original::frames * 0 +/EXPRESSION=FRAME_NUMBERS::ORIGINAL::FRAMES * 0 
-! /signal_types+! /SIGNAL_TYPES
-! /signal_folder=original +! /SIGNAL_FOLDER=ORIGINAL 
-! /signal_names+! /SIGNAL_NAMES
-/result_types=derived +/RESULT_TYPES=DERIVED 
-/result_folders=emg_count +/RESULT_FOLDERS=EMG_COUNT 
-/result_name=emg2 +/RESULT_NAME=EMG2 
-! /apply_as_suffix_to_signal_name=false+! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
 ; ;
  
-set all frames between the on/off events to one +Set all frames between the ON/OFF events to one 
-set_data_to_new_values +Set_Data_To_New_Values 
-/signal_types=derived +/SIGNAL_TYPES=DERIVED 
-/signal_folder=emg_count +/SIGNAL_FOLDER=EMG_COUNT 
-/signal_names=emg2 +/SIGNAL_NAMES=EMG2 
-! /signal_components=all_components +! /SIGNAL_COMPONENTS=ALL_COMPONENTS 
-/result_types=derived +/RESULT_TYPES=DERIVED 
-/result_folders=emg_count +/RESULT_FOLDERS=EMG_COUNT 
-/result_suffix+/RESULT_SUFFIX
-/event_sequence=emg2_on+emg2_off +/EVENT_SEQUENCE=EMG2_ON+EMG2_OFF 
-! /exclude_events+! /EXCLUDE_EVENTS
-! /event_instance=0 +! /EVENT_INSTANCE=0 
-! /start_frame+! /START_FRAME
-! /end_frame+! /END_FRAME
-! /use_point_rate=true +! /USE_POINT_RATE=TRUE 
-/replacement_values=1 +/REPLACEMENT_VALUES=1 
-! /threshold_high=no_data +! /THRESHOLD_HIGH=NO_DATA 
-! /threshold_low=no_data +! /THRESHOLD_LOW=NO_DATA 
-! /set_data_at_single_event=false+! /SET_DATA_AT_SINGLE_EVENT=FALSE
 ; ;
  
-add the signal during the gait cycle  +Add the signal during the gait cycle  
-!   the result will be the number of frames the signal is on during the gait cycle +!   The result will be the number of frames the signal is ON during the gait cycle 
-metric_sum +Metric_Sum 
-/result_metric_folder=emg_count +/RESULT_METRIC_FOLDER=EMG_COUNT 
-/result_metric_name+/RESULT_METRIC_NAME
-/apply_as_suffix_to_signal_name=true +/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE 
-/signal_types=derived +/SIGNAL_TYPES=DERIVED 
-/signal_folder=emg_count +/SIGNAL_FOLDER=EMG_COUNT 
-/signal_names=emg2 +/SIGNAL_NAMES=EMG2 
-/component_sequence=all +/COMPONENT_SEQUENCE=ALL 
-/event_sequence=rhs+rhs +/EVENT_SEQUENCE=RHS+RHS 
-/exclude_events+/EXCLUDE_EVENTS
-/sequence_percent_start+/SEQUENCE_PERCENT_START
-/sequence_percent_end+/SEQUENCE_PERCENT_END
-! /generate_mean_and_stddev=true +! /GENERATE_MEAN_AND_STDDEV=TRUE 
-! /append_to_existing_values=false+! /APPEND_TO_EXISTING_VALUES=FALSE
 ; ;
 </code> </code>
  
  
-}}+
visual3d/documentation/emg/filtering/linear_envelope.1718801261.txt.gz · Last modified: 2024/06/19 12:47 by sgranger