====== Examples ====== ==== Create signal using another signal component ==== Extract the z-component of a target. Evaluate_Expression /Expression= TARGET::ORIGINAL::RFT1::Z /Result_Name=RFT1_Z /Result_Type=DERIVED /Result_Folder=PROCESSED ; ==== Add two ANALOG signals ==== Evaluate_Expression /Expression= ANALOG::ORIGINAL::EMG1 + ANALOG::ORIGINAL::EMG2 /Result_Name=EMG_ADD ! /Result_Type=DERIVED ! /Result_Folder=PROCESSED ; ==== Divide the components of a signal ==== Evaluate_Expression /Expression= FORCE::ORIGINAL::FP1::Y/FORCE::ORIGINAL::FP1::X /Result_Name=FP1Y_X ! /Result_Type=DERIVED ! /Result_Folder=PROCESSED ; ==== Create a vector between two locations ==== A vector is created by subtracting one location from another. Evaluate_Expression /Expression= LINK_MODEL_BASED::ORIGINAL::RT_COP-LINK_MODEL_BASED::ORIGINAL::COM /Result_Name=R /Result_Type=DERIVED /Result_Folder=PROCESSED ; ==== Average several TARGET signals ==== Evaluate_Expression /Expression= (TARGET::ORIGINAL::TARG1 + TARGET::ORIGINAL::TARG2 + TARGET::ORIGINAL::TARG3) / 3 /Result_Name=TARG_AVG ! /Result_Type=DERIVED ! /Result_Folder=PROCESSED ; ==== Distance between a TARGET and a LANDMARK ==== Evaluate_Expression /Expression= distance(LANDMARK::ORIGINAL::RIGHT_HIP , TARGET::ORIGINAL::LHIP) /Result_Name=PROX_THIGH_RADIUS ! /Result_Type=DERIVED ! /Result_Folder=PROCESSED ; ==== Perpendicular distance - LANDMARK to VECTOR ==== Compute the perpendicular distance from the Knee Joint Center (LANDMARK::ORIGINAL::RT_KNEE) to a vector between the Hip Joint Center (LANDMARK::ORIGINAL::RIGHT_HIP) and Ankle Joint Center (LANDMARK::ORIGINAL::RT_ANKLE) ! create a unit_vector from the hip joint landmark (RIGHT_HIP) to the ankle joint landmark (RT_ANKLE) Evaluate_Expression /EXPRESSION=(LANDMARK::ORIGINAL::RIGHT_HIP-LANDMARK::ORIGINAL::RT_ANKLE)/DISTANCE(LANDMARK::ORIGINAL::RIGHT_HIP,LANDMARK::ORIGINAL::RT_ANKLE) /RESULT_NAME=UNIT_VECTOR_HIP_ANKLE /RESULT_TYPE=DERIVED /RESULT_FOLDER=MIKULICZ ; ! create a vector from the hip joint landmark (RIGHT_HIP) to the knee joint landmark (RT_KNEE) Evaluate_Expression /EXPRESSION=LANDMARK::ORIGINAL::RIGHT_HIP-LANDMARK::ORIGINAL::RT_KNEE /RESULT_NAME=VECTOR_HIP_KNEE /RESULT_TYPE=DERIVED /RESULT_FOLDER=MIKULICZ ; ! compute the perpendicular distance from the RT_KNEE to the vector from the HIP to the ANKLE Evaluate_Expression /EXPRESSION=LENGTH(CROSS(DERIVED::MIKULICZ::UNIT_VECTOR_HIP_ANKLE,DERIVED::MIKULICZ::VECTOR_HIP_KNEE)) /RESULT_NAME=PERPENDICULAR_DISTANCE /RESULT_TYPE=DERIVED /RESULT_FOLDER=MIKULICZ ; ==== 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 /EXPRESSION=(PARAMETER::VISUAL3D::ORIGINAL_FIRST_FRAME-1)/PARAMETER::POINT::RATE /RESULT_NAME=START_TIME /RESULT_TYPE=METRIC /RESULT_FOLDER=PROCESSED ; ==== Copying a signal ==== Evaluate_Expression /Expression= ANALOG::ORIGINAL::EMG1 /Result_Name=EMG1_COPY /Result_Type=ANALOG /Result_Folder=PROCESSED ; **Note:** The Result_Folder cannot be ORIGINAL because we frown on artificially labelling a signal as ORIGINAL. If ORIGINAL is specified, the data is automatically stored in the PROCESSED folder ==== Copy a signal to the Global Workspace ==== 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. Evaluate_Expression /EXPRESSION=METRIC::ORIGINAL::RTH1_MEAN /RESULT_NAME=GLOBAL::RTH1_MEAN /RESULT_TYPE=METRIC /RESULT_FOLDER=PROCESSED ; ==== Copy a signal to a different signal type ==== Evaluate_Expression /Expression= ANALOG::ORIGINAL::EMG1 /Result_Name=EMG1_COPY /Result_Type=DERIVED /Result_Folder=PROCESSED ; **Note:** The PROCESSED signal is at the sampling rate of the Analog signal. ==== Subtracting Two Metrics ==== Subtract two metric values. Evaluate_Expression /EXPRESSION=METRIC::PROCESSED::EMG1_MAX - METRIC::PROCESSED::EMG1_MIN /RESULT_NAME=EMG1_RANGE /RESULT_TYPE=METRIC /RESULT_FOLDER=PROCESSED ; === 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 as active file Select_Active_File /FILE_NAME=OFFSET_TRIAL ; ! Compute mean of signals ADC1 and ADC2. The resulting means are named ADC1_Offset and ADC2_offset and ! are located in the METRIC::OFFSET folder Metric_Mean /RESULT_METRIC_NAME=_Offset /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE /RESULT_METRIC_FOLDER=OFFSET /SIGNAL_TYPES=ANALOG /SIGNAL_NAMES=ADC1+ADC2 /SIGNAL_FOLDER=ORIGINAL ! /SIGNAL_COMPONENTS=ALL_COMPONENTS /EVENT_SEQUENCE= /EXCLUDE_EVENTS= ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! ----------------------------------------------- ! Select remaining trials and subtract mean value ! ----------------------------------------------- ! Select OTHER_TRIALS as the active files Select_Active_File /FILE_NAME=OTHER_TRIALS ; ! Loop for each signal For_Each /ITERATION_PARAMETER_NAME=INDEX /ITEMS=ADC1+ADC2 ; ! Subtract Global Mean Value from Signal Evaluate_Expression /EXPRESSION=ANALOG::ORIGINAL&:&:&::INDEX& - GLOBAL::METRIC::OFFSET&:&:&::INDEX&_Offset_MEAN /RESULT_NAME=::INDEX /RESULT_TYPE=ANALOG /RESULT_FOLDER=PROCESSED ; End_For_Each /ITERATION_PARAMETER_NAME=INDEX ; ==== Example: Create a vector ==== Evaluate_Expression /EXPRESSION=vector(0.4, 1.2) /RESULT_NAME=VECTOR /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; Evaluate_Expression /EXPRESSION=vector(target::processed::rft1::x, target::processed::lft1::y, target::processed::rpv4::z) /RESULT_NAME=VECTOR /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Set 2 components of a vector to zero ==== Set the x and z components of a vector to zero Evaluate_Expression /EXPRESSION=vector(0*target::processed::rft1::x, target::processed::rft1::y, 0*target::processed::rft1::z) /RESULT_NAME=Y_VEC /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Compute the magnitude of a vector ==== Evaluate_Expression /EXPRESSION=length(FORCE::ORIGINAL::FP1) /RESULT_NAME=VECTOR /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Create a 2x2 matrix ==== Evaluate_Expression /EXPRESSION=vector(list(11,21),list(12,22)) /RESULT_NAME=2x2 /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; The output of this command will be: ^Frame ^X ^Y ^ |1 |11.0000 |12.0000 | |2 |21.0000 |22.0000 | ==== Create a 1 Hz Sine wave ==== Create the signal at the POINT rate. Evaluate_Expression /EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::TIME) /RESULT_NAME=SIN_WAVE /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; Create the signal at the ANALOG rate. Evaluate_Expression /EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::ANALOGTIME) /RESULT_NAME=SIN_WAVE /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Compute the cross product of two vectors ==== Evaluate_Expression /EXPRESSION=CROSS(TARGET::PROCESSED::VEC1,TARGET::PROCESSED::VEC) /RESULT_NAME=ANGLE_RAD /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Compute the angle between two unit vectors ==== Evaluate_Expression /EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2)) /RESULT_NAME=ANGLE_RAD /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; The resulting values will be expressed in radians. The equivalent command that will have the result expressed in degrees is: Evaluate_Expression /EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2))*180/PI() /RESULT_NAME=ANGLE_DEG /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Integrate a signal between events ==== Integrate signal FORCE::ORIGINAL::FP1 between event labels START & END with an initial value of zero Evaluate_Expression /EXPRESSION= Integrate(FORCE::ORIGINAL::FP1,VECTOR(0,0,0),EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END) /RESULT_NAME=IMPULSE /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Create a binary signal ==== Based on a threshold signal, make the newly created signal contain the value 1 when the original signal's value is greater than a threshold and 0 otherwise. Evaluate_Expression /EXPRESSION= ANALOG::ORIGINAL::CHANNEL1 > 1 /RESULT_NAME=CHANNEL1_BINARY /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Test whether Signal 1 greater than Signal 2 ==== Given two signals, TARGET::ORIGINAL::RFT1 and TARGET::ORIGINAL::LFT1. Use the Boolean operator > to identify when the Z component of RFT1 is greater than the Z component of LFT1. Evaluate_Expression /EXPRESSION= TARGET::ORIGINAL::RFT1::Z > TARGET::ORIGINAL::LFT1::Z /RESULT_NAME=RFT1_GREATER /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; 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 /EXPRESSION=(FORCE::ORIGINAL::FP1::Y>0)*FORCE::ORIGINAL::FP1::Y /RESULT_NAME=SCOTT_POS /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; Similarly, you can set the positive values to zero Evaluate_Expression /EXPRESSION=(FORCE::ORIGINAL::FP1::Y<0)*FORCE::ORIGINAL::FP1::Y /RESULT_NAME=SCOTT_NEG /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== 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 /EXPRESSION=(TARGET::ORIGINAL::LELB::Z>0)/(TARGET::ORIGINAL::LELB::Z>0)*TARGET::ORIGINAL::LELB /RESULT_NAME=LELB /RESULT_TYPE=TARGET /RESULT_FOLDER=PROCESSED ; ==== 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. 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 One:** Remove all signal processing until the very end. In other words filter the LINK_MODEL_BASED signals, but don't filter the TARGET or ANALOG signals. This option is consistent with Ton van den Bogert's recommendation that all signals be filtered with the same filter characteristics (see attached). - **Solution Two:** Filter the data, and apply a median filter to the LINK_MODEL_BASED signals. This removes artifacts but we aren't sure if this is appropriate. - **Solution Three:** This solution isn't available in Visual3D yet, but we are exploring the possibility of filtering the rotation matrix (e.g. after the pose is computed). I like this option, but it may be a while before it is implemented. - **Solution Four:** Require that all tracking markers on a segment exist or the pose won't be computed. An example of **Solution Four** is below: * Given thigh targets RTH1, RTH2, RTH3, RTH4 * If one of the targets is NO_DATA, you want all targets to be NO_DATA. * 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 "4" instead in the example below. Evaluate_Expression /EXPRESSION=TARGET::ORIGINAL::RTH2 /    (      (TARGET::ORIGINAL::RTH1::R>=0) &      (TARGET::ORIGINAL::RTH2::R>=0) &      (TARGET::ORIGINAL::RTH3::R>=0) &      (TARGET::ORIGINAL::RTH4::R>=0)    ) /RESULT_NAME=RTH2 /RESULT_TYPE=TARGET /RESULT_FOLDER=PROCESSED ; ==== Conditional Statement ==== Implement a conditional expression like the following: for i=1:nframe if y1(i,3)< y1(i,4) data(i)= y1(i,3)/y1(i,4); else data(i)= y1(i,4)/y1(i,3); end end Assume the signal y1 is a target **TARGET::ORIGINAL::RFT1** and the components of interest are **Y** and **Z**. The expressions (Y = Z) evaluate to "0" or "1" depending on if they are True or False, and then you multiply by the value you want to use if the expression is true in this case Y/Z or Z/Y. Then you add the 2 expressions together, and you get only the expression that evaluated true! Evaluate_Expression /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) /RESULT_NAME=SCOTT /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Rank Order a Set of Metrics ==== Given a set of metric signals containing one component. *METRIC::GROUP1::TIME *METRIC::GROUP2::TIME *METRIC::GROUP3::TIME *METRIC::GROUP4::TIME 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) /RESULT_NAME=RANK_GROUP1 /RESULT_TYPE=METRIC /RESULT_FOLDER=GROUP1 ; ==== Example: Extracting one "component" of data from signal ==== The following command will result in the DERIVED signal TEST containing the X component values of the TARGET RFT1. Evaluate_Expression /EXPRESSION=TARGET::ORIGINAL::RFT1::X /RESULT_NAME=TEST /RESULT_TYPE=DERIVED ! /RESULT_FOLDER=PROCESSED ; ==== 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 /EXPRESSION=TARGET::ORIGINAL::RFT1[3] /RESULT_NAME=TEST /RESULT_TYPE=METRIC ! /RESULT_FOLDER=PROCESSED ; This can be useful in the following situation: a signal exists that contains the mean and standard deviation of a signal over a gait cycle (e.g. created using [[Visual3D:Documentation:Pipeline:Signal_Commands:Signal_Management_Commands#Global_Normalized_Signal_Mean|Global_Normalized_Signal_Mean]]; this creates a P2D signal in the Global Workspace). A mean signal is time normalized (by default to 101 frames). If you want one specific value of this signal, you cannot use an Event Label to specify the frame of data because Event Labels have no meaning for a signal that does not have a time base (e.g. a data rate). However, you can take advantage of the fact that you know exactly how many frames of data are in the signal. If you want the value at 25% of the range, you can simply use the following expression: Evaluate_Expression /EXPRESSION=GLOBAL::P2D::ORIGINAL::TESTX[25] /RESULT_NAME=TEST /RESULT_TYPE=METRIC ! /RESULT_FOLDER=PROCESSED ; ==== Value of signal at an analog frame ==== Assume that you have an analog signal and the frame that you are looking for is based on a threshold crossing which usually doesn't occur at a point frame rate but occurs at the analog frame rate. Thus, you cannot use events since they are in reference to the point frame rate and not the analog frame rate. Assume that you want the value of another analog signal at that analog_frame. The GRF is at the analog rate, and I am assuming the COM-COP is computed from the analog signals, so it too is at analog rate. ! Step 1 Create an event at frame 1 Event_Explicit /EVENT_NAME=START /FRAME=1 ! /TIME= ; ! Step 2 Create a metric with the threshold value ! Presumably you have some method for computing this ! but in this example, I just set the metric Metric_Explicit /RESULT_METRIC_NAME=THRESH ! /RESULT_METRIC_FOLDER=PROCESSED /METRIC_VALUE=-10 ; ! Step 3 is to create a binary signal FZ2_BIN that is based on the analog signal (in this case FZ2). ! Any analog frame that is greater than the metric value THRESH is set to 1 all other frames are set to 0 Evaluate_Expression /EXPRESSION=ANALOG::ORIGINAL::FZ2>METRIC::PROCESSED::THRESH /RESULT_NAME=FZ2_BIN /RESULT_TYPE=ANALOG /RESULT_FOLDER=BINARY ; ! Step 4 - Create an END frame that is after the threshold crossing but before the next time the ! binary signal becomes 1. This will be at the POINT rate. Event_Onset /SIGNAL_TYPES=ANALOG /SIGNAL_NAMES=FZ2_BIN /SIGNAL_FOLDER=BINARY /EVENT_NAME=END ! /SELECT_X=TRUE ! /SELECT_Y=FALSE ! /SELECT_Z=FALSE /THRESHOLD=1 ! /THRESHOLD_INSTANCE=0 ! /BASELINE=0 ! /FRAME_WINDOW=8 ! /ASCENDING=FALSE ! /DESCENDING=FALSE /START_AT_EVENT=START ! /END_AT_EVENT= ; ! Step 5 - Now sum the binary signal from START to END ! The resulting number is the analog frame number Metric_Sum /RESULT_METRIC_NAME=ANALOG_FRAME ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ! /RESULT_METRIC_FOLDER=PROCESSED /SIGNAL_TYPES=ANALOG /SIGNAL_NAMES=FZ2_BIN /SIGNAL_FOLDER=BINARY ! /SIGNAL_COMPONENTS=ALL_COMPONENTS /EVENT_SEQUENCE=START+END /EXCLUDE_EVENTS= /GENERATE_MEAN_AND_STDDEV=FALSE ! /APPEND_TO_EXISTING_VALUES=FALSE ; ! Step 6 - This is kind of a goofy step, but we need to create a pipeline ! parameter to hold the metric value analog frame Set_Pipeline_Parameter_To_Data_Value /PARAMETER_NAME=ANALOG_FRAME /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=ANALOG_FRAME /SIGNAL_FOLDER=PROCESSED ! /SIGNAL_COMPONENTS=ALL_COMPONENTS ; ! Step 7 - Now you can get the value of an analog signal at the analog frame Evaluate_Expression /EXPRESSION=FORCE::ORIGINAL::FP1[&::ANALOG_FRAME&] /RESULT_NAME=FORCE /RESULT_TYPE=METRIC ! /RESULT_FOLDER=PROCESSED ; ==== Representing the equation R= (Y - M*X - B)^2 ==== Consider a DERIVED signal named TEST that is stored in the processed folder and has 2 or more component (X, Y, ....). *X => DERIVED::PROCESSED::TEST::X *Y => DERIVED::PROCESSED::TEST::Y Consider M and B to be two Metric signals with one component *M => METRIC::PROCESSED::M *B => METRIC::PROCESSED::B The expression is represented as: Evaluate_Expression /EXPRESSION=(DERIVED::PROCESSED::TEST::Y-METRIC::PROCESSED::M*DERIVED::PROCESSED::TEST::X-METRIC::PROCESSED::B)^2 /RESULT_NAME=RESULT /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; The resulting signal is named RESULT and stored in the PROCESSED folder ==== Comparing a model metric with a string ==== Consider a model metric that is defined as a string. Set_Model_Metric ! /CALIBRATION_FILE= /METRIC_NAME=TEST /METRIC_VALUE="TTT" ; Now compare it to the text string "TTT" Evaluate_Expression /EXPRESSION=MODEL::METRIC::TEST="TTT" /RESULT_NAME=SCOTT /RESULT_TYPE=METRIC ! /RESULT_FOLDER=PROCESSED ; The text strings should be equal so the resulting signal contains a 1 ==== Exporting a model metric ==== Model metrics cannot be exported directly. You can, however, copy the model metric to a regular metric signal that can be exported. It is probably safest to create the new metric signal as a global metric because it isn't associated with any particular movement trial. For example the commands below will export the length of the right thigh segment. ! Copy the model metric RTH::LENGTH to the GLOBAL metric folder Evaluate_Expression /EXPRESSION=MODEL::SEGMENT::RTH::LENGTH /RESULT_NAME=GLOBAL::RTH_LENGTH /RESULT_TYPE=METRIC /RESULT_FOLDER=EXPORT ; ! Make the global workspace active Select_Active_File /FILE_NAME=GLOBAL ; ! Export the signal ! Prompt for the exported filename Export_Data_To_Ascii_File ! /FILE_NAME= /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=RTH_LENGTH /SIGNAL_FOLDER=EXPORT ; ==== Store a Model Metric 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). This example will multiply the model metrics for mass and height to use for normalizing a signal. The resulting metric is called MASS_X_HEIGHT and will be stored in the METRIC::MODEL folder Evaluate_Expression /EXPRESSION=MODEL::METRIC::MASS*MODEL::METRIC::HEIGHT /RESULT_NAME=MASS_X_HEIGHT /RESULT_TYPE=METRIC /RESULT_FOLDER=MODEL ; ==== Quasi Case Statement ==== Given a group of unilaterally affected subjects. The Left side calculations could be the "affected” side and the right side could be the "normal” side, but for other subjects the opposite would be true. The data should be collected as "affected" or "normal" rather than "left" or "right" export them as a group. 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. The final command uses **Evaluate_Expression** to check to see which is the primary side and compute the arms angle of the primary side using Evaluate Expression's string comparison conditional statement. If ("&::SIDE_LETTER&" = "R") is TRUE, then the value will be 1, if not the value will be zero. If ("&::SIDE_LETTER&" = "L") is TRUE, then the value will be 1, if not the value will be zero. In the example commands below, the primary side will be the "right side" and therefore the primary side will be the right arm angle. You can change this by defining "L" as the SIDE_LETTER and "R" as the OPP_SIDE_LETTER in the first two commands. ! Define Side Parameters Set_Pipeline_Parameter /PARAMETER_NAME=SIDE_LETTER /PARAMETER_VALUE=R ; Set_Pipeline_Parameter /PARAMETER_NAME=OPP_SIDE_LETTER /PARAMETER_VALUE=L ; !Calculate IN MODEL BASED joint angle - ArmAngle for side Compute_Model_Based_Data /RESULT_NAME=::SIDE_LETTER&ArmAngle /FUNCTION=JOINT_ANGLE /SEGMENT=::SIDE_LETTER&AR /REFERENCE_SEGMENT=RTA /RESOLUTION_COORDINATE_SYSTEM= ! /USE_CARDAN_SEQUENCE=FALSE ! /NORMALIZATION=FALSE ! NORMALIZATION_METHOD= /NORMALIZATION_METRIC= /NEGATEX=FALSE ! /NEGATEY=FALSE /NEGATEZ=TRUE /AXIS1=z !/AXIS2=Y /AXIS3=Z ; ! Calculate IN MODEL BASED joint angle - ArmAngle for opposite side Compute_Model_Based_Data /RESULT_NAME=::OPP_SIDE_LETTER&ArmAngle /FUNCTION=JOINT_ANGLE /SEGMENT=::OPP_SIDE_LETTER&AR /REFERENCE_SEGMENT=RTA /RESOLUTION_COORDINATE_SYSTEM= ! /USE_CARDAN_SEQUENCE=FALSE ! /NORMALIZATION=FALSE ! NORMALIZATION_METHOD= /NORMALIZATION_METRIC= /NEGATEX=FALSE ! /NEGATEY=FALSE /NEGATEZ=TRUE /AXIS1=z !AXIS2=Y /AXIS3=Z ; ! Handle sidedness Evaluate_Expression /EXPRESSION=LINK_MODEL_BASED::ORIGINAL::RArmAngle*("&::SIDE_LETTER&" = "R") + LINK_MODEL_BASED::ORIGINAL::LArmAngle*("&::SIDE_LETTER&" = "L") /RESULT_NAME=PrimaryArmAngle /RESULT_TYPE=DERIVED /RESULT_FOLDER=PROCESSED ; ==== Get Time At Event ==== Get the event times for the label **ONSET** and place them in the metric folder Evaluate Expression /EXPRESSION=EVENT_LABEL::ORIGINAL::ONSET /RESULT_NAME=ONSETS /RESULT_TYPE=METRIC /RESULT_FOLDER=PROCESSED ;