visual3d:documentation:pipeline:expressions:examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:documentation:pipeline:expressions:examples [2024/06/19 12:49] – sgranger | visual3d:documentation:pipeline:expressions:examples [2024/11/25 20:02] (current) – [Compute the magnitude of a vector] wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== examples | + | ====== Examples ====== |
- | ==== example: create | + | ==== Create |
- | extract | + | Extract |
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | evaluate_expression | + | ==== Add two ANALOG |
- | /expression= target:: | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: add two analog | + | |
- | evaluate_expression | + | < |
- | /expression= analog::original::emg1 + analog::original::emg2 | + | Evaluate_Expression |
- | /result_name=emg_add | + | /Expression= ANALOG::ORIGINAL::EMG1 + ANALOG::ORIGINAL::EMG2 |
- | ! /result_type=derived | + | /Result_Name=EMG_ADD |
- | ! /result_folder=processed | + | ! /Result_Type=DERIVED |
- | **;** | + | ! /Result_Folder=PROCESSED |
- | ==== example: divide the components of a signal ==== | + | ; |
+ | </ | ||
- | evaluate_expression | + | ==== Divide the components of a signal |
- | /expression= force:: | + | |
- | / | + | |
- | ! / | + | |
- | ! / | + | |
- | **;** | + | |
- | ==== example: create | + | |
- | a vector is created by subtracting one location from another. | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
- | evaluate_expression | + | ==== Create a vector between two locations |
- | /expression= link_model_based:: | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: average several target signals | + | |
- | evaluate_expression | + | A vector is created by subtracting one location from another. |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | ! / | + | |
- | **;** | + | |
- | ==== example: distance between a target and a landmark ==== | + | |
- | evaluate_expression | + | < |
- | /expression= distance(landmark::original::right_hip , target::original::lhip) | + | Evaluate_Expression |
- | /result_name=prox_thigh_radius | + | /Expression= LINK_MODEL_BASED::ORIGINAL::RT_COP-LINK_MODEL_BASED::ORIGINAL::COM |
- | ! /result_type=derived | + | /Result_Name=R |
- | ! /result_folder=processed | + | /Result_Type=DERIVED |
- | **;** | + | /Result_Folder=PROCESSED |
- | ==== example: perpendicular distance - landmark to vector ==== | + | ; |
+ | </ | ||
- | compute the perpendicular distance from the knee joint center | + | ==== Average several TARGET signals ==== |
- | landmark:: | + | |
- | to a vector between the hip joint center and ankle joint center | + | |
- | landmark:: | + | |
- | landmark:: | + | |
- | \\ | + | |
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
- | ! create a unit_vector from the hip joint landmark (right_hip) to the ankle joint landmark (rt_ankle) | + | ==== Distance between |
- | evaluate_expression | + | |
- | /expression=(landmark:: | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ! create | + | |
- | evaluate_expression | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ! compute the perpendicular distance from the rt_knee to the vector from the hip to the ankle | + | |
- | evaluate_expression | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: get the actual start time of the c3d file ==== | + | |
- | visual3d always treats the first frame of data in the c3d file as frame 1. if the original c3d file was truncated, so that the first frame is not 1, visual3d retains that information and stores it in the visual3d parameter group. if a user wants to compute the actual start time for the file, the following command can be used. | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
- | **evaluate_expression** | + | ==== Perpendicular distance - LANDMARK to VECTOR |
- | /expression=(parameter:: | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: copying a signal | + | |
- | **evaluate_expression** | + | Compute the perpendicular distance from the Knee Joint Center (LANDMARK::ORIGINAL::RT_KNEE) to a vector between |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | note that the result_folder cannot be original because we frown on artificially labelling | + | |
- | ==== example: copy a signal | + | < |
+ | ! create | ||
+ | Evaluate_Expression | ||
+ | /EXPRESSION=(LANDMARK:: | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
- | in order to pass data between files, it is necessary to use the [[visual3d:documentation:definitions:global_workspace|global workspace]] which is common to all files in the workspace. | + | ! create a vector from the hip joint landmark (RIGHT_HIP) |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
- | **evaluate_expression** | + | ! compute the perpendicular distance from the RT_KNEE to the vector from the HIP to the ANKLE |
- | /expression=metric::original::rth1_mean | + | Evaluate_Expression |
- | /result_name=global:: | + | /EXPRESSION=LENGTH(CROSS(DERIVED::MIKULICZ::UNIT_VECTOR_HIP_ANKLE, |
- | /result_type=metric | + | /RESULT_NAME=PERPENDICULAR_DISTANCE |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=MIKULICZ |
- | ==== example: copy a signal to a different signal type ==== | + | ; |
+ | </ | ||
- | **evaluate_expression** | + | ==== Get the actual start time of the C3D file ==== |
- | /expression= analog:: | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | note: the processed signal is at the sampling rate of the analog signal. | + | |
- | ==== example: subtracting two metrics ==== | + | Visual3D always treats the first frame of data in the C3D file as Frame 1. If the original c3d file was truncated, so that the first frame is not 1, Visual3D retains that information and stores it in the Visual3D Parameter Group. If a user wants to compute the actual start time for the file, the following command can be used. |
- | subtract two metric signals. | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | **evaluate_expression** | + | ==== Copying a signal ==== |
- | /expression=metric:: | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: subtract global mean value from signal ==== | + | |
- | the evaluate_expression command can be used to subtract a global mean value from a signal. | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | **Note:** The Result_Folder cannot | ||
+ | |||
+ | ==== Copy a signal to the Global Workspace ==== | ||
+ | |||
+ | In order to pass data between files, it is necessary to use the [[Visual3D: | ||
< | < | ||
- | ! ----------------------------------------------- | + | Evaluate_Expression |
- | ! select a specific trial and compute mean values | + | / |
- | ! ----------------------------------------------- | + | / |
+ | / | ||
+ | / | ||
+ | ; | ||
</ | </ | ||
+ | |||
+ | ==== Copy a signal to a different signal type ==== | ||
< | < | ||
- | ! select offset_trial | + | Evaluate_Expression |
- | select_active_file | + | / |
- | /file_name=offset_trial | + | / |
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | **Note:** The PROCESSED signal is at the sampling rate of the Analog signal. | ||
+ | |||
+ | ==== Subtracting Two Metrics ==== | ||
+ | |||
+ | Subtract two metric values. | ||
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | === Subtract Global Mean Value from Signal === | ||
+ | |||
+ | The Evaluate_Expression command can be used to subtract a global mean value from a signal. In this example, an offset (mean value of the signal) is found for two analog signals from one trial and the offset value is subtracted from the same two analog signals found in other trials. | ||
+ | |||
+ | < | ||
+ | ! ----------------------------------------------- | ||
+ | ! Select a specific trial and compute mean values | ||
+ | ! ----------------------------------------------- | ||
+ | |||
+ | ! Select OFFSET_TRIAL | ||
+ | Select_Active_File | ||
+ | /FILE_NAME=OFFSET_TRIAL | ||
; | ; | ||
- | ! compute | + | ! Compute |
- | ! are located in the metric::offset | + | ! are located in the METRIC::OFFSET |
- | metric_mean | + | Metric_Mean |
- | /result_metric_name=_offset | + | /RESULT_METRIC_NAME=_Offset |
- | /apply_as_suffix_to_signal_name=true | + | /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE |
- | /result_metric_folder=offset | + | /RESULT_METRIC_FOLDER=OFFSET |
- | /signal_types=analog | + | /SIGNAL_TYPES=ANALOG |
- | /signal_names=adc1+adc2 | + | /SIGNAL_NAMES=ADC1+ADC2 |
- | /signal_folder=original | + | /SIGNAL_FOLDER=ORIGINAL |
- | ! /signal_components=all_components | + | ! /SIGNAL_COMPONENTS=ALL_COMPONENTS |
- | /event_sequence= | + | /EVENT_SEQUENCE= |
- | /exclude_events= | + | /EXCLUDE_EVENTS= |
- | ! /generate_mean_and_stddev=true | + | ! /GENERATE_MEAN_AND_STDDEV=TRUE |
- | ! /append_to_existing_values=false | + | ! /APPEND_TO_EXISTING_VALUES=FALSE |
; | ; | ||
! ----------------------------------------------- | ! ----------------------------------------------- | ||
- | ! select | + | ! Select |
! ----------------------------------------------- | ! ----------------------------------------------- | ||
- | ! select other_trials | + | ! Select OTHER_TRIALS |
- | select_active_file | + | Select_Active_File |
- | /file_name=other_trials | + | /FILE_NAME=OTHER_TRIALS |
; | ; | ||
- | ! loop for each signal | + | ! Loop for each signal |
- | for_each | + | For_Each |
- | /iteration_parameter_name=index | + | /ITERATION_PARAMETER_NAME=INDEX |
- | /items=adc1+adc2 | + | /ITEMS=ADC1+ADC2 |
; | ; | ||
- | ! subtract global mean value from signal | + | ! Subtract Global Mean Value from Signal |
- | evaluate_expression | + | Evaluate_Expression |
- | /expression=analog::original&:&:&:: | + | /EXPRESSION=ANALOG::ORIGINAL&:&:&:: |
- | /result_name=::index | + | /RESULT_NAME=::INDEX |
- | /result_type=analog | + | /RESULT_TYPE=ANALOG |
- | /result_folder=processed | + | /RESULT_FOLDER=PROCESSED |
; | ; | ||
- | end_for_each | + | End_For_Each |
- | /iteration_parameter_name=index | + | /ITERATION_PARAMETER_NAME=INDEX |
; | ; | ||
</ | </ | ||
- | ==== example: create | + | ==== Create |
- | **evaluate_expression** | + | < |
- | /expression=vector(0.4, | + | Evaluate_Expression |
- | /result_name=vector | + | /EXPRESSION=vector(0.4, |
- | /result_type=derived | + | /RESULT_NAME=VECTOR |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=PROCESSED |
- | **evaluate_expression** | + | ; |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: set 2 components of a vector to zero ==== | + | |
- | set the x and z components of a vector to zero | + | Evaluate_Expression |
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | **evaluate_expression** | + | ==== Set 2 components |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: compute the magnitude | + | |
- | **evaluate_expression** | + | Set the x and z components of a vector to zero |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: create | + | |
- | **evaluate_expression** | + | < |
- | /expression=vector(list(11,21),list(12,22)) | + | Evaluate_Expression |
- | /result_name=2x2 | + | /EXPRESSION=vector(0*target:: |
- | /result_type=derived | + | /RESULT_NAME=Y_VEC |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=PROCESSED |
- | the output | + | ; |
+ | </ | ||
+ | |||
+ | ==== Compute | ||
< | < | ||
- | frame | + | Evaluate_Expression |
- | 1 | + | / |
- | 2 | + | / |
+ | / | ||
+ | / | ||
+ | ; | ||
</ | </ | ||
- | ==== example: create a 1 hz sine wave ==== | + | ==== Compute the maximum value of the speed of the COG ==== |
- | create | + | Compute |
- | **evaluate_expression** | + | < |
- | /expression=sin(2*pi()*frame_numbers::original::time) | + | Evaluate_Expression |
- | /result_name=sin_wave | + | /EXPRESSION=Metric_Maximum(Length(LINK_MODEL_BASED:: |
- | /result_type=derived | + | /SIGNAL_TYPES= |
- | /result_folder=processed | + | ! /SIGNAL_FOLDER= |
- | **;** | + | /SIGNAL_NAMES= |
- | create the signal at the analog rate. | + | / |
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
+ | ==== Create a 2x2 matrix ==== | ||
- | **evaluate_expression** | + | < |
- | /expression=sin(2*pi()*frame_numbers:: | + | Evaluate_Expression |
- | /result_name=sin_wave | + | /EXPRESSION=vector(list(11, |
- | /result_type=derived | + | /RESULT_NAME=2x2 |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=PROCESSED |
- | ==== example: compute the cross product of two vectors ==== | + | ; |
+ | </ | ||
- | **evaluate_expression** | + | The output of this command will be: |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | \\ | + | |
+ | ^Frame | ||
+ | |1 | ||
+ | |2 | ||
- | ==== example: compute the angle between two unit vectors | + | ==== Create a 1 Hz Sine wave ==== |
- | **evaluate_expression** | + | Create |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the resulting values will be expressed in radians. | + | |
- | the equivalent command that will have the result expressed in degrees is: | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | **evaluate_expression** | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | **;** | ||
- | ==== example integrate a signal between events ==== | ||
- | integrate a force signal | + | Create the signal |
- | **evaluate_expression** | + | < |
- | /expression= integrate(force:: | + | Evaluate_Expression |
- | /result_name=impulse | + | /EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::ANALOGTIME) |
- | /result_type=derived | + | /RESULT_NAME=SIN_WAVE |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=PROCESSED |
- | ==== example: create a binary signal ==== | + | ; |
+ | </ | ||
- | based on a threshold signal, make the new signal 1 when the value is greater than a threshold and 0 otherwise. | + | ==== Compute |
- | **evaluate_expression** | + | < |
- | /expression= analog::original::channel1 > 1 | + | Evaluate_Expression |
- | /result_name=channel1_binary | + | /EXPRESSION=CROSS(TARGET::PROCESSED::VEC1, |
- | /result_type=derived | + | /RESULT_NAME=ANGLE_RAD |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=PROCESSED |
- | \\ | + | ; |
+ | </ | ||
+ | ==== Compute the angle between two unit vectors ==== | ||
- | ==== example: signal 1 greater than signal 2 ==== | + | < |
+ | Evaluate_Expression | ||
+ | /EXPRESSION=ACOS(DOT(TARGET:: | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | given two signals | + | The resulting values |
- | target:: | + | |
- | target:: | + | |
- | use the boolean operator > to identify when the z component of rft1 is greater than the z component of lft1 | + | |
- | **evaluate_expression** | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the output signal | + | |
- | ==== example: set negative values to zero ==== | + | |
- | set all of the negative values of a signal to 0.0. | + | The equivalent command that will have the result expressed in degrees is: |
- | **evaluate_expression** | + | < |
- | /expression=(force::original::fp1::y>0)*force:: | + | Evaluate_Expression |
- | /result_name=scott_pos | + | /EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1, |
- | /result_type=derived | + | /RESULT_NAME=ANGLE_DEG |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=PROCESSED |
- | this expression uses the boolean operator | + | ; |
- | similarly, you can set the positive values to zero | + | </code> |
- | **evaluate_expression** | + | ==== Integrate a signal between events |
- | /expression=(force:: | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== example: set negative values to no_data | + | |
- | if the z-component of the lelb signal | + | Integrate |
- | **evaluate_expression** | + | < |
- | /expression=(target::original::lelb::z>0)/(target::original::lelb::z> | + | Evaluate_Expression |
- | /result_name=lelb | + | /EXPRESSION= Integrate(FORCE::ORIGINAL::FP1, |
- | /result_type=target | + | /RESULT_NAME=IMPULSE |
- | /result_folder=processed | + | /RESULT_TYPE=DERIVED |
- | **;** | + | /RESULT_FOLDER=PROCESSED |
- | ==== example: if one tracking marker is no_data, make all tracking markers no_data ==== | + | ; |
+ | </ | ||
- | when tracking markers drop out or go missing through out a trial, there is often an artifact in the segment pose. | + | ==== Create |
- | this artifact | + | Based on a threshold signal, make the newly created signal contain the value 1 when the original signal' |
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | ==== Test whether Signal 1 greater than Signal 2 ==== | ||
+ | |||
+ | Given two signals, TARGET:: | ||
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | The output signal will be 1 when RFT1::Z is greater than LFT1::Z and 0 otherwise | ||
+ | |||
+ | ==== Set negative values to zero ==== | ||
+ | |||
+ | Set all of the negative values of a signal to 0.0. This expression uses the Boolean operator > to identify when the Y component of FP1 is greater than 0 | ||
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | |||
+ | Similarly, you can set the positive values to zero | ||
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | ==== Set negative values to NO_DATA ==== | ||
+ | |||
+ | If the z-component of the LELB signal is below 0 set the frame to NO_DATA | ||
+ | |||
+ | < | ||
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | - the filtered signal isn't very good at the point of dropout | + | ==== If one tracking marker |
- | - the best fit to the tracking marker | + | |
- | the following are different solutions that could be used:\\ | + | When tracking markers drop out or go missing through out a trial, there is often an artifact in the segment pose. |
+ | This artifact is related to two issues: | ||
+ | - The filtered signal isn't very good at the point of dropout | ||
+ | - The best fit to the tracking marker template changes when the template changes. | ||
- | | + | The following are different solutions that could be used: |
- | - **solution two:** filter | + | |
- | - **solution three:** this solution isn't available in visual3d | + | - **Solution Two:** Filter |
- | - **solution four:** require | + | - **Solution Three:** This solution isn't available in Visual3D |
+ | - **Solution Four:** Require | ||
- | an example of **solution four** is below: | + | An example of **Solution Four** is below: |
- | * given thigh targets | + | * Given thigh targets |
- | * if one of the targets is no_data, you want all targets to be no_data. | + | * If one of the targets is NO_DATA, you want all targets to be NO_DATA. |
- | * use a boolean operator on the target residual. | + | * Use a boolean operator on the target residual. |
- | * the target residual is specified using the component "r" - if you are using an older version of visual3d, try using component " | + | * The target residual is specified using the component "R" - if you are using an older version of Visual3D, try using component " |
< | < | ||
- | evaluate_expression | + | Evaluate_Expression |
- | /expression=target::original::rth2 / | + | /EXPRESSION=TARGET::ORIGINAL::RTH2 / |
( | ( | ||
- | (target::original::rth1::r>=0) & | + | (TARGET::ORIGINAL::RTH1::R>=0) & |
- | (target::original::rth2::r>=0) & | + | (TARGET::ORIGINAL::RTH2::R>=0) & |
- | (target::original::rth3::r>=0) & | + | (TARGET::ORIGINAL::RTH3::R>=0) & |
- | (target::original::rth4::r>=0) | + | (TARGET::ORIGINAL::RTH4::R>=0) |
) | ) | ||
- | /result_name=rth2 | + | /RESULT_NAME=RTH2 |
- | /result_type=target | + | /RESULT_TYPE=TARGET |
- | /result_folder=processed | + | /RESULT_FOLDER=PROCESSED |
; | ; | ||
</ | </ | ||
- | ==== example: conditional statement | + | ==== Conditional Statement |
- | implement | + | Implement |
+ | < | ||
for i=1:nframe | for i=1:nframe | ||
if y1(i,3)< y1(i,4) | if y1(i,3)< y1(i,4) | ||
Line 404: | Line 486: | ||
end | end | ||
end | end | ||
- | assume the signal y1 is a target **target:: | + | </ |
- | the expressions (y <z and y >= z) evaluate to " | + | Assume |
+ | |||
+ | The expressions (Y <Z and Y >= Z) evaluate to " | ||
< | < | ||
- | evaluate_expression | + | Evaluate_Expression |
- | /expression=(target::original::rft1::y < target::original::rft1::z)*(target::original::rft1::y/target::original::rft1::z | + | /EXPRESSION=(TARGET::ORIGINAL::RFT1::Y < TARGET::ORIGINAL::RFT1::Z)*(TARGET::ORIGINAL::RFT1::Y/TARGET::ORIGINAL::RFT1::Z |
- | +(target::original::rft1::y >= target::original::rft1::z)*(target::original::rft1::z/target::original::rft1::y) | + | +(TARGET::ORIGINAL::RFT1::Y >= TARGET::ORIGINAL::RFT1::Z)*(TARGET::ORIGINAL::RFT1::Z/TARGET::ORIGINAL::RFT1::Y) |
- | /result_name=scott | + | /RESULT_NAME=SCOTT |
- | /result_type=derived | + | /RESULT_TYPE=DERIVED |
- | /result_folder=processed | + | /RESULT_FOLDER=PROCESSED |
; | ; | ||
</ | </ | ||
- | ==== example: rank order a set of metrics | + | ==== Rank Order a Set of Metrics |
- | given a set of metric signals containing one component. | + | Given a set of metric signals containing one component. |
+ | *METRIC:: | ||
+ | *METRIC:: | ||
+ | *METRIC:: | ||
+ | *METRIC:: | ||
- | metric:: | + | The result of the following command will be the RANK of the metric (**METRIC::GROUP1::TIME**) amongst the cohort. |
- | metric:: | + | |
- | metric:: | + | |
- | metric:: | + | |
- | the result of the following command will be the rank of the metric (**metric::group1::time**) amongst the cohort. | + | |
- | **evaluate_expression** | + | < |
- | /expression= 1 + (metric::group1::time > metric::group2::time) + (metric::group1::time > metric::group3::time) + (metric::group1::time > metric::group4::time) | + | Evaluate_Expression |
- | /result_name=rank_group1 | + | /EXPRESSION= 1 + (METRIC::GROUP1::TIME > METRIC::GROUP2::TIME) + (METRIC::GROUP1::TIME > METRIC::GROUP3::TIME) + (METRIC::GROUP1::TIME > METRIC::GROUP4::TIME) |
- | /result_type=metric | + | /RESULT_NAME=RANK_GROUP1 |
- | /result_folder=group1 | + | /RESULT_TYPE=METRIC |
- | **;** | + | /RESULT_FOLDER=GROUP1 |
- | ==== example: extracting one " | + | ; |
+ | </ | ||
- | the following command will result in the derived signal test containing the x component | + | ==== Example: Extracting one "component" |
- | **evaluate_expression** | + | The following command will result in the DERIVED |
- | / | + | |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | **;** | + | |
- | ==== example: extracting one frame of data from a signal | + | |
- | the following command will result in the metric signal test containing the values of the target rft1 from frame 3. | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
- | **evaluate_expression** | + | ==== Extracting one frame of data from a signal ==== |
- | /expression=target:: | + | |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | **;** | + | |
- | this can be useful in the following situation. | + | |
- | a signal | + | The following command will result in the METRIC |
- | (e.g. created using [[visual3d:documentation:pipeline:signal_commands:signal_management_commands# | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ! / | ||
+ | ; | ||
+ | </ | ||
- | a mean signal is time normalized (by default to 101 frames). | + | This can be useful in the following situation: |
- | **evaluate_expression** | + | < |
- | /expression=global::p2d::original::testx[25] | + | Evaluate_Expression |
- | /result_name=test | + | /EXPRESSION=GLOBAL::P2D::ORIGINAL::TESTX[25] |
- | /result_type=metric | + | /RESULT_NAME=TEST |
- | ! /result_folder=processed | + | /RESULT_TYPE=METRIC |
- | **;** | + | ! /RESULT_FOLDER=PROCESSED |
- | ==== example: value of signal at an analog frame ==== | + | ; |
+ | </ | ||
- | assume that you have an analog | + | ==== Value of signal at an analog frame ==== |
- | assume | + | Assume that you have an analog signal and the frame that you are looking for is based on a threshold crossing which usually doesn' |
+ | |||
+ | Assume | ||
< | < | ||
- | ! step 1 create | + | ! Step 1 Create |
- | event_explicit | + | Event_Explicit |
- | /event_name=start | + | /EVENT_NAME=START |
- | /frame=1 | + | /FRAME=1 |
- | ! /time= | + | ! /TIME= |
; | ; | ||
- | ! step 2 create | + | ! Step 2 Create |
- | ! presumably | + | ! Presumably |
- | ! but in this example, | + | ! but in this example, |
- | metric_explicit | + | Metric_Explicit |
- | /result_metric_name=thresh | + | /RESULT_METRIC_NAME=THRESH |
- | ! /result_metric_folder=processed | + | ! /RESULT_METRIC_FOLDER=PROCESSED |
- | /metric_value=-10 | + | /METRIC_VALUE=-10 |
; | ; | ||
- | </ | ||
- | < | + | ! Step 3 is to create a binary signal |
- | ! step 3 is to create a binary signal | + | ! Any analog frame that is greater than the metric value THRESH |
- | ! any analog frame that is greater than the metric value thresh | + | Evaluate_Expression |
- | evaluate_expression | + | /EXPRESSION=ANALOG::ORIGINAL::FZ2>METRIC::PROCESSED::THRESH |
- | /expression=analog::original::fz2>metric::processed::thresh | + | /RESULT_NAME=FZ2_BIN |
- | /result_name=fz2_bin | + | /RESULT_TYPE=ANALOG |
- | /result_type=analog | + | /RESULT_FOLDER=BINARY |
- | /result_folder=binary | + | |
; | ; | ||
- | ! step 4 - create | + | ! Step 4 - Create |
- | ! binary signal becomes 1. this will be at the point rate. | + | ! binary signal becomes 1. This will be at the POINT rate. |
- | event_onset | + | Event_Onset |
- | /signal_types=analog | + | /SIGNAL_TYPES=ANALOG |
- | /signal_names=fz2_bin | + | /SIGNAL_NAMES=FZ2_BIN |
- | /signal_folder=binary | + | /SIGNAL_FOLDER=BINARY |
- | /event_name=end | + | /EVENT_NAME=END |
- | ! /select_x=true | + | ! /SELECT_X=TRUE |
- | ! /select_y=false | + | ! /SELECT_Y=FALSE |
- | ! /select_z=false | + | ! /SELECT_Z=FALSE |
- | /threshold=1 | + | /THRESHOLD=1 |
- | ! /threshold_instance=0 | + | ! /THRESHOLD_INSTANCE=0 |
- | ! /baseline=0 | + | ! /BASELINE=0 |
- | ! /frame_window=8 | + | ! /FRAME_WINDOW=8 |
- | ! /ascending=false | + | ! /ASCENDING=FALSE |
- | ! /descending=false | + | ! /DESCENDING=FALSE |
- | /start_at_event=start | + | /START_AT_EVENT=START |
- | ! /end_at_event= | + | ! /END_AT_EVENT= |
; | ; | ||
- | ! step 5 - now sum the binary signal from start to end | + | ! Step 5 - Now sum the binary signal from START to END |
- | ! the resulting number is the analog frame number | + | ! The resulting number is the analog frame number |
- | metric_sum | + | Metric_Sum |
- | /result_metric_name=analog_frame | + | /RESULT_METRIC_NAME=ANALOG_FRAME |
- | ! /apply_as_suffix_to_signal_name=false | + | ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE |
- | ! /result_metric_folder=processed | + | ! /RESULT_METRIC_FOLDER=PROCESSED |
- | /signal_types=analog | + | /SIGNAL_TYPES=ANALOG |
- | /signal_names=fz2_bin | + | /SIGNAL_NAMES=FZ2_BIN |
- | /signal_folder=binary | + | /SIGNAL_FOLDER=BINARY |
- | ! /signal_components=all_components | + | ! /SIGNAL_COMPONENTS=ALL_COMPONENTS |
- | /event_sequence=start+end | + | /EVENT_SEQUENCE=START+END |
- | /exclude_events= | + | /EXCLUDE_EVENTS= |
- | /generate_mean_and_stddev=false | + | /GENERATE_MEAN_AND_STDDEV=FALSE |
- | ! /append_to_existing_values=false | + | ! /APPEND_TO_EXISTING_VALUES=FALSE |
; | ; | ||
- | ! step 6 - this is kind of a goofy step, but we need to create a pipeline | + | ! Step 6 - This is kind of a goofy step, but we need to create a pipeline |
! parameter to hold the metric value analog frame | ! parameter to hold the metric value analog frame | ||
- | set_pipeline_parameter_to_data_value | + | Set_Pipeline_Parameter_To_Data_Value |
- | /parameter_name=analog_frame | + | /PARAMETER_NAME=ANALOG_FRAME |
- | /signal_types=metric | + | /SIGNAL_TYPES=METRIC |
- | /signal_names=analog_frame | + | /SIGNAL_NAMES=ANALOG_FRAME |
- | /signal_folder=processed | + | /SIGNAL_FOLDER=PROCESSED |
- | ! /signal_components=all_components | + | ! /SIGNAL_COMPONENTS=ALL_COMPONENTS |
; | ; | ||
- | ! step 7 - now you can get the value of an analog signal at the analog frame | + | ! Step 7 - Now you can get the value of an analog signal at the analog frame |
- | evaluate_expression | + | Evaluate_Expression |
- | /expression=force::original::fp1[&::analog_frame&] | + | /EXPRESSION=FORCE::ORIGINAL::FP1[&::ANALOG_FRAME&] |
- | /result_name=force | + | /RESULT_NAME=FORCE |
- | /result_type=metric | + | /RESULT_TYPE=METRIC |
- | ! /result_folder=processed | + | ! /RESULT_FOLDER=PROCESSED |
; | ; | ||
</ | </ | ||
- | ==== example: create a sine wave ==== | + | ==== Representing the equation R= (Y - M*X - B)^2 ==== |
- | the following command creates | + | Consider |
+ | *X => DERIVED:: | ||
+ | *Y => DERIVED:: | ||
- | **evaluate_expression** | + | Consider M and B to be two Metric signals with one component |
- | /expression=sin(2*[[visual3d:documentation:pipeline:expressions:overview# | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | this command takes advantage of the frame_numbers data type, which stores frames and time. | + | |
- | this data type is hidden in all versions of visual3d prior to version 4.1 | + | The expression |
- | if the frequency was stored as a metric signal | + | < |
+ | Evaluate_Expression | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
- | **evaluate_expression** | + | The resulting signal is named RESULT and stored in the PROCESSED folder |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | ==== representing | + | |
- | consider | + | ==== Comparing |
- | x => derived:: | + | Consider a model metric |
- | y => derived:: | + | |
- | \\ | + | |
- | consider m and b to be two metric | + | |
- | m => metric:: | + | <code> |
- | b => metric:: | + | Set_Model_Metric |
- | \\ | + | ! / |
- | the expression is represented as: | + | / |
+ | / | ||
+ | ; | ||
+ | </ | ||
- | **evaluate_expression** | + | Now compare it to the text string " |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | **;** | + | |
- | the resulting signal is named result and stored in the processed folder | + | |
- | ==== example: comparing a model metric with a string ==== | + | < |
- | + | Evaluate_Expression | |
- | consider a model metric that is defined as a string. | + | /EXPRESSION=MODEL:: |
- | + | /RESULT_NAME=SCOTT | |
- | **set_model_metric** | + | /RESULT_TYPE=METRIC |
- | ! /calibration_file= | + | ! /RESULT_FOLDER=PROCESSED |
- | /metric_name=test | + | ; |
- | /metric_value=" | + | </ |
- | **;** | + | |
- | now compare it to the text string " | + | |
- | **evaluate_expression** | + | The text strings should be equal so the resulting signal contains a 1 |
- | / | + | |
- | / | + | |
- | / | + | |
- | ! / | + | |
- | **;** | + | |
- | the text strings should be equal so the resulting signal contains a 1 | + | |
- | ==== example: exporting | + | ==== Exporting |
- | model metrics cannot be exported directly. | + | Model metrics cannot be exported directly. |
< | < | ||
- | ! copy the model metric | + | ! Copy the model metric |
- | evaluate_expression | + | Evaluate_Expression |
- | /expression=model::segment::rth::length | + | /EXPRESSION=MODEL::SEGMENT::RTH::LENGTH |
- | /result_name=global::rth_length | + | /RESULT_NAME=GLOBAL::RTH_LENGTH |
- | /result_type=metric | + | /RESULT_TYPE=METRIC |
- | /result_folder=export | + | /RESULT_FOLDER=EXPORT |
; | ; | ||
- | ! make the global workspace active | + | ! Make the global workspace active |
- | select_active_file | + | Select_Active_File |
- | /file_name=global | + | /FILE_NAME=GLOBAL |
; | ; | ||
- | ! export | + | ! Export |
- | ! prompt | + | ! Prompt |
- | export_data_to_ascii_file | + | Export_Data_To_Ascii_File |
- | ! /file_name= | + | ! /FILE_NAME= |
- | /signal_types=metric | + | /SIGNAL_TYPES=METRIC |
- | /signal_names=rth_length | + | /SIGNAL_NAMES=RTH_LENGTH |
- | /signal_folder=export | + | /SIGNAL_FOLDER=EXPORT |
; | ; | ||
</ | </ | ||
- | ==== example store a model metric | + | ==== Store a Model Metric |
- | model metrics are stored with the model, but the data can be moved to each c3d file (stored in the data tree). | + | Model metrics are stored with the model, but the data can be moved to each C3D file (stored in the data tree). |
< | < | ||
- | evaluate_expression | + | Evaluate_Expression |
- | /expression=model::metric::mass*model::metric::height | + | /EXPRESSION=MODEL::METRIC::MASS*MODEL::METRIC::HEIGHT |
- | /result_name=mass_x_height | + | /RESULT_NAME=MASS_X_HEIGHT |
- | /result_type=metric | + | /RESULT_TYPE=METRIC |
- | /result_folder=model | + | /RESULT_FOLDER=MODEL |
; | ; | ||
</ | </ | ||
- | ==== example: quasi case statement | + | ==== Quasi Case Statement |
- | given a group of unilaterally affected subjects. | + | Given a group of unilaterally affected subjects. |
- | in the commands below, wo parameters specify the letter of primary side (side_letter) and the letter of opposite side (opp_side_letter). the script then uses these parameters to compute the arm angle relative to the trunk for the two sides. | + | In the commands below, wo parameters specify the letter of primary side (SIDE_LETTER) and the letter of opposite side (OPP_SIDE_LETTER). The script then uses these parameters to compute the Arm angle relative to the trunk for the two sides. |
< | < | ||
- | ! define side parameters | + | ! Define Side Parameters |
- | </ | + | |
- | < | + | Set_Pipeline_Parameter |
- | set_pipeline_parameter | + | /PARAMETER_NAME=SIDE_LETTER |
- | /parameter_name=side_letter | + | /PARAMETER_VALUE=R |
- | /parameter_value=r | + | |
; | ; | ||
- | set_pipeline_parameter | + | Set_Pipeline_Parameter |
- | /parameter_name=opp_side_letter | + | /PARAMETER_NAME=OPP_SIDE_LETTER |
- | /parameter_value=l | + | /PARAMETER_VALUE=L |
; | ; | ||
- | !calculate in model based joint angle - armangle | + | !Calculate IN MODEL BASED joint angle - ArmAngle |
- | compute_model_based_data | + | Compute_Model_Based_Data |
- | /result_name=::side_letter&armangle | + | /RESULT_NAME=::SIDE_LETTER&ArmAngle |
- | /function=joint_angle | + | /FUNCTION=JOINT_ANGLE |
- | /segment=::side_letter&ar | + | /SEGMENT=::SIDE_LETTER&AR |
- | /reference_segment=rta | + | /REFERENCE_SEGMENT=RTA |
- | /resolution_coordinate_system= | + | /RESOLUTION_COORDINATE_SYSTEM= |
- | ! /use_cardan_sequence=false | + | ! /USE_CARDAN_SEQUENCE=FALSE |
- | ! /normalization=false | + | ! /NORMALIZATION=FALSE |
- | ! normalization_method= | + | ! NORMALIZATION_METHOD= |
- | /normalization_metric= | + | /NORMALIZATION_METRIC= |
- | /negatex=false | + | /NEGATEX=FALSE |
- | ! /negatey=false | + | ! /NEGATEY=FALSE |
- | /negatez=true | + | /NEGATEZ=TRUE |
- | /axis1=z | + | /AXIS1=z |
- | !/axis2=y | + | !/AXIS2=Y |
- | /axis3=z | + | /AXIS3=Z |
; | ; | ||
- | ! calculate in model based joint angle - armangle | + | ! Calculate IN MODEL BASED joint angle - ArmAngle |
- | compute_model_based_data | + | Compute_Model_Based_Data |
- | /result_name=::opp_side_letter&armangle | + | /RESULT_NAME=::OPP_SIDE_LETTER&ArmAngle |
- | /function=joint_angle | + | /FUNCTION=JOINT_ANGLE |
- | /segment=::opp_side_letter&ar | + | /SEGMENT=::OPP_SIDE_LETTER&AR |
- | /reference_segment=rta | + | /REFERENCE_SEGMENT=RTA |
- | /resolution_coordinate_system= | + | /RESOLUTION_COORDINATE_SYSTEM= |
- | ! /use_cardan_sequence=false | + | ! /USE_CARDAN_SEQUENCE=FALSE |
- | ! /normalization=false | + | ! /NORMALIZATION=FALSE |
- | ! normalization_method= | + | ! NORMALIZATION_METHOD= |
- | /normalization_metric= | + | /NORMALIZATION_METRIC= |
- | /negatex=false | + | /NEGATEX=FALSE |
- | ! /negatey=false | + | ! /NEGATEY=FALSE |
- | /negatez=true | + | /NEGATEZ=TRUE |
- | /axis1=z | + | /AXIS1=z |
- | !axis2=y | + | !AXIS2=Y |
- | /axis3=z | + | /AXIS3=Z |
; | ; | ||
- | ! handle | + | ! Handle |
- | evaluate_expression | + | Evaluate_Expression |
- | /expression=link_model_based::original::rarmangle*("&:: | + | /EXPRESSION=LINK_MODEL_BASED::ORIGINAL::RArmAngle*("&:: |
- | /result_name=primaryarmangle | + | /RESULT_NAME=PrimaryArmAngle |
- | /result_type=derived | + | /RESULT_TYPE=DERIVED |
- | /result_folder=processed | + | /RESULT_FOLDER=PROCESSED |
; | ; | ||
</ | </ | ||
- | ==== example: at event ==== | + | ==== Get Time At Event ==== |
- | get the event times for the label **onset** and place them in the metric folder | + | Get the event times for the label **ONSET** and place them in the metric folder |
< | < | ||
- | evaluate expression | + | Evaluate Expression |
- | /expression=event_label::original::onset | + | /EXPRESSION=EVENT_LABEL::ORIGINAL::ONSET |
- | /result_name=onsets | + | /RESULT_NAME=ONSETS |
- | /result_type=metric | + | /RESULT_TYPE=METRIC |
- | /result_folder=processed | + | /RESULT_FOLDER=PROCESSED |
; | ; | ||
</ | </ |
visual3d/documentation/pipeline/expressions/examples.1718801393.txt.gz · Last modified: 2024/06/19 12:49 by sgranger