===== Shift Frames =====
In some cases, [[visual3d:documentation:emg:emg_overview|EMG]] data and [[visual3d:documentation:definitions:motion_capture_mocap|motion capture]] data may be out of sync with each other. This can occur because of a physiological issue known as electromechanical delay (EMD), or because of technical issues with data collection, e.g. the saved EMG signal might be delayed because the EMG system is wireless. The command **Shift_Frames** shifts a signal forward/backward in time by a number of frames to accommodate this issue.
Shift_Frames
/SIGNAL_TYPES=TARGET
! /SIGNAL_NAMES=
! /SIGNAL_FOLDER=ORIGINAL
! /RESULT_SUFFIX=
! /RESULT_FOLDER=PROCESSED
/FRAME_SHIFT= 5
/REPLACEMENT_VALUE=DATA_NOT_FOUND
;
==== Parameters ====
^ Parameter ^ Description ^
| SIGNAL_TYPES | The Type(s) of the signal to be shifted. |
| SIGNAL_NAMES| The Name(s) of the signal to be shifted. |
| SIGNAL_FOLDER | The Folder(s) of the signal to be shifted. |
| RESULT_SUFFIX | The suffix to append to the signal's name after it has been shifted. |
| RESULT_FOLDER | The folder in which to store the shifted signal. |
| FRAME_SHIFT| The number of frames to shift. Can be an [[visual3d:documentation:pipeline:expressions:expressions_overview|expression]]. |
| REPLACEMENT_VALUE | The value to replace any unknown values caused by the shift. The default value is 0, except when the **Signal_Type** parameter is a **TARGET** in which case **[[visual3d:documentation:c3d_signal_types:data_not_found|DATA_NOT_FOUND]]** (e.g. unreliable value) is used. |
==== Dialog ====
The Shift_Frames command can be edited interactively using the following dialog.
{{:Shift_Frames.png}}
==== Notes ====
* When a signal is shifted forward in time, the frames at the beginning of the file have unknown values.
* When a signal is shifted backward in time, the frames at the end of the file have unknown values.
* These unknown values can be specified by the **/Replacement_Value** parameter.
* If no **/Replacement_Value** is specified Visual 3D uses a value of 0 except when the **Signal_Type** parameter is a **TARGET** and value of **[[visual3d:documentation:c3d_signal_types:data_not_found|DATA_NOT_FOUND]]** (e.g. unreliable value) is used.
==== Examples ====
With Visual3D's flexible signal specification syntax and the power of expressions, it is possible to precisely specify how any signals should be shifted.
=== Example 1: Shift a single signal ===
Shift the signal 1FX by one analog frame and to replace the first frame with the value -99
Shift_Frames
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=1FX
! /SIGNAL_FOLDER=ORIGINAL
! /RESULT_SUFFIX=
! /RESULT_FOLDER=PROCESSED
/FRAME_SHIFT=1
/REPLACEMENT_VALUE=-99
;
=== Example 2: Shift all analog signals using an expression ===
Shift all analog signals in time based on the value of a Metric signal and replace the unknown values with **DATA_NOT_FOUND** (e.g. no value).
! Shift Frames - the shift value METRIC::PROCESSED::SHIFT was calculated previously
Shift_Frames
/SIGNAL_TYPES=ANALOG
! /SIGNAL_NAMES=
! /SIGNAL_FOLDER=ORIGINAL
! /RESULT_SUFFIX=
! /RESULT_FOLDER=PROCESSED
/FRAME_SHIFT= METRIC::PROCESSED::SHIFT
/REPLACEMENT_VALUE= DATA_NOT_FOUND
;
**NOTE:** [[visual3d:documentation:visual3d_signal_types:force_data_type|FORCE]], [[visual3d:documentation:visual3d_signal_types:cofp_data_type|COFP]], and [[visual3d:documentation:visual3d_signal_types:freemoment_data_type|FREEMOMENT]] signals are derived from [[visual3d:documentation:c3d_signal_types:analog_data_type|ANALOG]] signals, so these values cannot be shifted; the ANALOG signals should be shifted, and the option to use PROCESSED analog signals for computing forces should be set to true.