User Tools

Site Tools


visual3d:documentation:pipeline:expressions:examples

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:pipeline:expressions:examples [2024/06/19 12:49] sgrangervisual3d: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 signal using another signal component ====+==== Create signal using another signal component ==== 
  
-extract the z-component of a target.+Extract the z-component of a target. 
 +<code> 
 +Evaluate_Expression 
 +/Expression= TARGET::ORIGINAL::RFT1::
 +/Result_Name=RFT1_Z 
 +/Result_Type=DERIVED 
 +/Result_Folder=PROCESSED 
 +
 +</code>
  
-evaluate_expression +==== Add two ANALOG signals ==== 
-/expressiontarget::original::rft1::+
-/result_name=rft1_z +
-/result_type=derived +
-/result_folder=processed +
-**;** +
-==== example: add two analog signals ====+
  
-evaluate_expression +<code> 
-/expressionanalog::original::emg1 analog::original::emg2 +Evaluate_Expression 
-/result_name=emg_add +/ExpressionANALOG::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 ====+
 +</code>
  
-evaluate_expression +==== Divide the components of signal ==== 
-/expressionforce::original::fp1::y/force::original::fp1::+
-/result_name=fp1y_x +
-! /result_type=derived +
-! /result_folder=processed +
-**;** +
-==== example: create vector between two locations ====+
  
-a vector is created by subtracting one location from another.+<code> 
 +Evaluate_Expression 
 +/Expression= FORCE::ORIGINAL::FP1::Y/FORCE::ORIGINAL::FP1::
 +/Result_Name=FP1Y_X 
 +! /Result_Type=DERIVED 
 +! /Result_Folder=PROCESSED 
 +
 +</code>
  
-evaluate_expression +==== Create a vector between two locations ==== 
-/expressionlink_model_based::original::rt_cop-link_model_based::original::com +
-/result_name=+
-/result_type=derived +
-/result_folder=processed +
-**;** +
-==== example: average several target signals ====+
  
-evaluate_expression +A vector is created by subtracting one location from another.
-/expression= (target::original::targ1 + target::original::targ2 + target::original::targ3) / 3 +
-/result_name=targ_avg +
-! /result_type=derived +
-! /result_folder=processed +
-**;** +
-==== example: distance between a target and a landmark ====+
  
-evaluate_expression +<code> 
-/expressiondistance(landmark::original::right_hip , target::original::lhip) +Evaluate_Expression 
-/result_name=prox_thigh_radius +/ExpressionLINK_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 ====+
 +</code>
  
-compute the perpendicular distance from the knee joint center +==== Average several TARGET signals ==== 
-landmark::original::rt_knee +
-to a vector between the hip joint center and ankle joint center +
-landmark::original::right_hip +
-landmark::original::rt_ankle +
-\\+
  
 +<code>
 +Evaluate_Expression
 +/Expression= (TARGET::ORIGINAL::TARG1 + TARGET::ORIGINAL::TARG2 + TARGET::ORIGINAL::TARG3) / 3
 +/Result_Name=TARG_AVG
 +! /Result_Type=DERIVED
 +! /Result_Folder=PROCESSED
 +;
 +</code>
  
-! create a unit_vector from the hip joint landmark (right_hip) to the ankle joint landmark (rt_ankle) +==== Distance between TARGET and a LANDMARK ==== 
-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 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 +
-**;** +
-==== 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 truncatedso 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.+<code> 
 +Evaluate_Expression 
 +/Expression= distance(LANDMARK::ORIGINAL::RIGHT_HIP TARGET::ORIGINAL::LHIP) 
 +/Result_Name=PROX_THIGH_RADIUS 
 +! /Result_Type=DERIVED 
 +! /Result_Folder=PROCESSED 
 +
 +</code>
  
-**evaluate_expression** +==== Perpendicular distance - LANDMARK to VECTOR ==== 
-/expression=(parameter::visual3d::original_first_frame-1)/parameter::point::rate +
-/result_name=start_time +
-/result_type=metric +
-/result_folder=processed +
-**;** +
-==== example: copying a signal ====+
  
-**evaluate_expression** +Compute the perpendicular distance from the Knee Joint Center (LANDMARK::ORIGINAL::RT_KNEE) to vector between the Hip Joint Center (LANDMARK::ORIGINAL::RIGHT_HIP) and Ankle Joint Center (LANDMARK::ORIGINAL::RT_ANKLE)
-/expression= analog::original::emg1 +
-/result_name=emg1_copy +
-/result_type=analog +
-/result_folder=processed +
-**;** +
-note that the result_folder cannot be original because we frown on artificially labelling signal as original. if original is specified, the data is automatically stored in the processed folder+
  
-==== example: copy signal to the global workspace ====+<code> 
 +! create 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 
 +;
  
-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) 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 
 +;
  
-**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::rth1_mean +/EXPRESSION=LENGTH(CROSS(DERIVED::MIKULICZ::UNIT_VECTOR_HIP_ANKLE,DERIVED::MIKULICZ::VECTOR_HIP_KNEE)) 
-/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 ====+
 +</code>
  
-**evaluate_expression** +==== Get the actual start time of the C3D file ==== 
-/expressionanalog::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.+
  
-==== 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.+<code> 
 +Evaluate_Expression 
 +/EXPRESSION=(PARAMETER::VISUAL3D::ORIGINAL_FIRST_FRAME-1)/PARAMETER::POINT::RATE 
 +/RESULT_NAME=START_TIME 
 +/RESULT_TYPE=METRIC 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code>
  
-**evaluate_expression** +==== Copying a signal ==== 
-/expression=metric::processed::emg1_max - metric::processed::emg1_min +
-/result_name=emg1_range +
-/result_type=metric +
-/result_folder=processed +
-**;** +
-==== example: subtract global mean value from signal ====+
  
-the evaluate_expression command can be used to subtract a global mean value from a signal. in this examplean 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.+<code> 
 +Evaluate_Expression 
 +/Expression= ANALOG::ORIGINAL::EMG1 
 +/Result_Name=EMG1_COPY 
 +/Result_Type=ANALOG 
 +/Result_Folder=PROCESSED 
 +
 +</code> 
 + 
 +**Note:** The Result_Folder cannot be ORIGINAL because we frown on artificially labelling a signal as ORIGINALIf 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.
  
 <code> <code>
-! ----------------------------------------------- +Evaluate_Expression 
-! select a specific trial and compute mean values +/EXPRESSION=METRIC::ORIGINAL::RTH1_MEAN 
-! -----------------------------------------------+/RESULT_NAME=GLOBAL::RTH1_MEAN 
 +/RESULT_TYPE=METRIC 
 +/RESULT_FOLDER=PROCESSED 
 +;
 </code> </code>
 +
 +==== Copy a signal to a different signal type ==== 
  
 <code> <code>
-select offset_trial as active file +Evaluate_Expression 
-select_active_file +/Expression= ANALOG::ORIGINAL::EMG1 
-/file_name=offset_trial+/Result_Name=EMG1_COPY 
 +/Result_Type=DERIVED 
 +/Result_Folder=PROCESSED 
 +
 +</code> 
 + 
 +**Note:** The PROCESSED signal is at the sampling rate of the Analog signal. 
 + 
 +==== Subtracting Two Metrics ====  
 + 
 +Subtract two metric values. 
 + 
 +<code> 
 +Evaluate_Expression 
 +/EXPRESSION=METRIC::PROCESSED::EMG1_MAX - METRIC::PROCESSED::EMG1_MIN 
 +/RESULT_NAME=EMG1_RANGE 
 +/RESULT_TYPE=METRIC 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code> 
 + 
 +=== 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. 
 + 
 +<code> 
 +! ----------------------------------------------- 
 +! 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 adc2the resulting means are named adc1_offset and adc2_offset and +Compute mean of signals ADC1 and ADC2The resulting means are named ADC1_Offset and ADC2_offset and 
-! are located in the metric::offset folder +! are located in the METRIC::OFFSET folder 
-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 remaining trials and subtract mean value+Select remaining trials and subtract mean value
 ! -----------------------------------------------  ! ----------------------------------------------- 
  
-select other_trials as the active files +Select OTHER_TRIALS as the active files 
-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&:&:&::index& - global::metric::offset&:&:&::index&_offset_mean +/EXPRESSION=ANALOG::ORIGINAL&:&:&::INDEX& - GLOBAL::METRIC::OFFSET&:&:&::INDEX&_Offset_MEAN 
-/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
 ; ;
 </code> </code>
  
-==== example: create a vector ====+==== Create a vector ==== 
  
-**evaluate_expression** +<code> 
-/expression=vector(0.4, 1.2) +Evaluate_Expression 
-/result_name=vector +/EXPRESSION=vector(0.4, 1.2) 
-/result_type=derived +/RESULT_NAME=VECTOR 
-/result_folder=processed +/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 +
-**;** +
-==== example: set 2 components of a vector to zero ====+
  
-set the and components of a vector to zero+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 
 +
 +</code>
  
-**evaluate_expression** +==== Set 2 components of a vector to zero ==== 
-/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 +
-**;** +
-==== example: compute the magnitude of a vector ====+
  
-**evaluate_expression** +Set the x and z components of vector to zero
-/expression=length(force::original::fp1) +
-/result_name=vector +
-/result_type=derived +
-/result_folder=processed +
-**;** +
-==== example: create 2x2 matrix ====+
  
-**evaluate_expression** +<code> 
-/expression=vector(list(11,21),list(12,22)+Evaluate_Expression 
-/result_name=2x2 +/EXPRESSION=vector(0*target::processed::rft1::xtarget::processed::rft1::y0*target::processed::rft1::z
-/result_type=derived +/RESULT_NAME=Y_VEC 
-/result_folder=processed +/RESULT_TYPE=DERIVED 
-**;** +/RESULT_FOLDER=PROCESSED 
-the output of this command will be:+
 +</code> 
 + 
 +==== Compute the magnitude of a vector ==== 
  
 <code> <code>
-frame             y +Evaluate_Expression 
-1       11.0000     12.0000 +/EXPRESSION=length(FORCE::ORIGINAL::FP1) 
-2       21.0000     22.0000+/RESULT_NAME=VECTOR 
 +/RESULT_TYPE=DERIVED 
 +/RESULT_FOLDER=PROCESSED 
 +;
 </code> </code>
  
-==== example: create a 1 hz sine wave ====+==== Compute the maximum value of the speed of the COG ====
  
-create the signal at the point rate.+Compute the maximum value of the speed of the Center of Mass of the model between two events
  
-**evaluate_expression** +<code> 
-/expression=sin(2*pi()*frame_numbers::original::time+Evaluate_Expression 
-/result_name=sin_wave +/EXPRESSION=Metric_Maximum(Length(LINK_MODEL_BASED::ORIGINAL::CogVelocity), EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END
-/result_type=derived +/SIGNAL_TYPES
-/result_folder=processed +/SIGNAL_FOLDER
-**;** +/SIGNAL_NAMES
-create the signal at the analog rate.+/SIGNAL_COMPONENTS=X 
 + /RESULT_TYPES=METRIC 
 + /RESULT_FOLDERS=FROM_SCOTT 
 + /RESULT_NAME=CogVelocityMax 
 +! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE 
 +
 +</code> 
 +==== Create a 2x2 matrix ==== 
  
-**evaluate_expression** +<code> 
-/expression=sin(2*pi()*frame_numbers::original::analogtime+Evaluate_Expression 
-/result_name=sin_wave +/EXPRESSION=vector(list(11,21),list(12,22)) 
-/result_type=derived +/RESULT_NAME=2x2 
-/result_folder=processed +/RESULT_TYPE=DERIVED 
-**;** +/RESULT_FOLDER=PROCESSED 
-==== example: compute the cross product of two vectors ====+
 +</code>
  
-**evaluate_expression** +The output of this command will be:
-/expression=cross(target::processed::vec1,target::processed::vec) +
-/result_name=angle_rad +
-/result_type=derived +
-/result_folder=processed +
-**;** +
-\\+
  
 +^Frame   ^X           ^Y       ^
 +|1       |11.0000     |12.0000 |
 +|2       |21.0000     |22.0000 |
  
-==== example: compute the angle between two unit vectors ====+==== Create a 1 Hz Sine wave ==== 
  
-**evaluate_expression** +Create the signal at the POINT rate.
-/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:+<code> 
 +Evaluate_Expression 
 +/EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::TIME) 
 +/RESULT_NAME=SIN_WAVE 
 +/RESULT_TYPE=DERIVED 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code>
  
-**evaluate_expression** 
-/expression=acos(dot(target::processed::unit1,target::processed::unit2))*180/pi() 
-/result_name=angle_deg 
-/result_type=derived 
-/result_folder=processed 
-**;** 
-==== example integrate a signal between events ==== 
  
-integrate a force signal (force::original::fp1) between event labels (start & end) with an initial value of zero+Create the signal at the ANALOG rate.
  
-**evaluate_expression** +<code> 
-/expressionintegrate(force::original::fp1,vector(0,0,0),event_label::original::start,event_label::original::end+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 ====+
 +</code>
  
-based on a threshold signal, make the new signal 1 when the value is greater than a threshold and 0 otherwise.+==== Compute the cross product of two vectors ==== 
  
-**evaluate_expression** +<code> 
-/expressionanalog::original::channel1 > 1 +Evaluate_Expression 
-/result_name=channel1_binary +/EXPRESSION=CROSS(TARGET::PROCESSED::VEC1,TARGET::PROCESSED::VEC) 
-/result_type=derived +/RESULT_NAME=ANGLE_RAD 
-/result_folder=processed +/RESULT_TYPE=DERIVED 
-**;** +/RESULT_FOLDER=PROCESSED 
-\\+
 +</code>
  
 +==== Compute the angle between two unit vectors ==== 
  
-==== examplesignal 1 greater than signal 2 ====+<code> 
 +Evaluate_Expression 
 +/EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2)) 
 +/RESULT_NAME=ANGLE_RAD 
 +/RESULT_TYPE=DERIVED 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code>
  
-given two signals +The resulting values will be expressed in radians.
-target::original::rft1 +
-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::+
-/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 +
-==== 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** +<code> 
-/expression=(force::original::fp1::y>0)*force::original::fp1::y +Evaluate_Expression 
-/result_name=scott_pos +/EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2))*180/PI() 
-/result_type=derived +/RESULT_NAME=ANGLE_DEG 
-/result_folder=processed +/RESULT_TYPE=DERIVED 
-**;** +/RESULT_FOLDER=PROCESSED 
-this expression uses the boolean operator to identify when the y component of fp1 is greater than 0 +
-similarly, you can set the positive values to zero+</code>
  
-**evaluate_expression** +==== Integrate a signal between events ==== 
-/expression=(force::original::fp1::y<0)*force::original::fp1::+
-/result_name=scott_neg +
-/result_type=derived +
-/result_folder=processed +
-**;** +
-==== example: set negative values to no_data ====+
  
-if the z-component of the lelb signal is below 0 set the frame to no_data+Integrate signal FORCE::ORIGINAL::FP1 between event labels START & END with an initial value of zero
  
-**evaluate_expression** +<code> 
-/expression=(target::original::lelb::z>0)/(target::original::lelb::z>0)*target::original::lelb +Evaluate_Expression 
-/result_name=lelb +/EXPRESSIONIntegrate(FORCE::ORIGINAL::FP1,VECTOR(0,0,0),EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END) 
-/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 ====+
 +</code>
  
-when tracking markers drop out or go missing through out trial, there is often an artifact in the segment pose.+==== Create binary signal ==== 
  
-this artifact is related to two issues:+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. 
 + 
 +<code> 
 +Evaluate_Expression 
 +/EXPRESSION= ANALOG::ORIGINAL::CHANNEL1 > 1 
 +/RESULT_NAME=CHANNEL1_BINARY 
 +/RESULT_TYPE=DERIVED 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code> 
 + 
 +==== 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. 
 + 
 +<code> 
 +Evaluate_Expression 
 +/EXPRESSION= TARGET::ORIGINAL::RFT1::Z > TARGET::ORIGINAL::LFT1::
 +/RESULT_NAME=RFT1_GREATER 
 +/RESULT_TYPE=DERIVED 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code> 
 + 
 +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 
 + 
 +<code> 
 +Evaluate_Expression 
 +/EXPRESSION=(FORCE::ORIGINAL::FP1::Y>0)*FORCE::ORIGINAL::FP1::
 +/RESULT_NAME=SCOTT_POS 
 +/RESULT_TYPE=DERIVED 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code> 
 + 
 + 
 +Similarly, you can set the positive values to zero 
 + 
 +<code> 
 +Evaluate_Expression 
 +/EXPRESSION=(FORCE::ORIGINAL::FP1::Y<0)*FORCE::ORIGINAL::FP1::
 +/RESULT_NAME=SCOTT_NEG 
 +/RESULT_TYPE=DERIVED 
 +/RESULT_FOLDER=PROCESSED 
 +
 +</code> 
 + 
 +==== Set negative values to NO_DATA ====  
 + 
 +If the z-component of the LELB signal is below 0 set the frame to NO_DATA 
 + 
 +<code> 
 +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 
 +
 +</code>
  
-  - the filtered signal isn't very good at the point of dropout +==== If one tracking marker is no_data, make all tracking markers no_data ==== 
-  - the best fit to the tracking marker template changes when the template changes.+
  
-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.
  
-  - **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). +The following are different solutions that could be used: 
-  - **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 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 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). like this option, but it may be a while before it is implemented. +  - **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 four:** require that all tracking markers on a segment exist or the pose won't be computed.+  - **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). 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:+An example of **Solution Four** is below:
  
-  * given thigh targets rth1rth2rth3rth4 +  * Given thigh targets RTH1RTH2RTH3RTH4 
-  * 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 "4" instead in the example below.+    * 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.
  
 <code> <code>
-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
 ; ;
 </code> </code>
  
-==== example: conditional statement ====+==== Conditional Statement ==== 
  
-implement a conditional expression like the following:+Implement a conditional expression like the following:
  
 +<code>
 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::original::rft1** and the components of interest are **y** and **z**.+</code>
  
-the expressions (<and >= 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/or z/ythen you add the 2 expressions together, and you get only the expression that evaluated true!+Assume the signal y1 is a target **TARGET::ORIGINAL::RFT1** and the components of interest are **Y** and **Z**. 
 + 
 +The expressions (<and >= 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/or Z/YThen you add the 2 expressions together, and you get only the expression that evaluated true!
  
 <code> <code>
-evaluate_expression +Evaluate_Expression 
-/expression=(target::original::rft1::target::original::rft1::z)*(target::original::rft1::y/target::original::rft1::z +/EXPRESSION=(TARGET::ORIGINAL::RFT1::TARGET::ORIGINAL::RFT1::Z)*(TARGET::ORIGINAL::RFT1::Y/TARGET::ORIGINAL::RFT1::Z 
- +(target::original::rft1::>= target::original::rft1::z)*(target::original::rft1::z/target::original::rft1::y)  + +(TARGET::ORIGINAL::RFT1::>= 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
 ; ;
 </code> </code>
  
-==== example: rank order set of metrics ====+==== Rank Order Set of Metrics ==== 
  
-given a set of metric signals containing one component.+Given a set of metric signals containing one component. 
 +  *METRIC::GROUP1::TIME 
 +  *METRIC::GROUP2::TIME 
 +  *METRIC::GROUP3::TIME 
 +  *METRIC::GROUP4::TIME
  
-metric::group1::time +The result of the following command will be the RANK of the metric (**METRIC::GROUP1::TIME**) amongst the cohort.
-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** +<code> 
-/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 "component" of data from signal ====+
 +</code>
  
-the following command will result in the derived signal test containing the x component values of the target rft1.+==== Example: Extracting one "componentof data from signal ==== 
  
-**evaluate_expression** +The following command will result in the DERIVED signal TEST containing the X component values of the TARGET RFT1.
-/expression=target::original::rft1::+
-/result_name=test +
-/result_type=derived +
-! /result_folder=processed +
-**;** +
-==== 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.+<code> 
 +Evaluate_Expression 
 +/EXPRESSION=TARGET::ORIGINAL::RFT1::
 +/RESULT_NAME=TEST 
 +/RESULT_TYPE=DERIVED 
 +! /RESULT_FOLDER=PROCESSED 
 +
 +</code>
  
-**evaluate_expression** +==== Extracting one frame of data from a signal ==== 
-/expression=target::original::rft1[3] +
-/result_name=test +
-/result_type=metric +
-! /result_folder=processed +
-**;** +
-this can be useful in the following situation.+
  
-signal exists that contains the mean and standard deviation of a signal over a gait cycle+The following command will result in the METRIC signal TEST containing the values of the TARGET RFT1 from Frame 3.
  
-(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)+<code> 
 +Evaluate_Expression 
 +/EXPRESSION=TARGET::ORIGINAL::RFT1[3] 
 +/RESULT_NAME=TEST 
 +/RESULT_TYPE=METRIC 
 +! /RESULT_FOLDER=PROCESSED 
 +; 
 +</code>
  
-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 do the following:+This can be useful in the following situation: 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** +<code> 
-/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 ====+
 +</code>
  
-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.+==== Value of signal at an analog frame ==== 
  
-assume that you want the value of another analog signal at that analog_frame. the grf is at the analog rate, and am assuming the com-cop is computed from the analog signals, so it too is at analog rate.+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 am assuming the COM-COP is computed from the analog signals, so it too is at analog rate.
  
 <code> <code>
-step create an event at frame 1 +Step Create an event at frame 1 
-event_explicit +Event_Explicit 
-/event_name=start +/EVENT_NAME=START 
-/frame=1 +/FRAME=1 
-! /time=+! /TIME=
 ; ;
  
-step create a metric with the threshold value +Step Create a metric with the threshold value 
-presumably you have some method for computing this +Presumably you have some method for computing this 
-! but in this example, just set the metric +! but in this example, just set the metric 
-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
 ; ;
-</code> 
  
-<code> +Step 3 is to create a binary signal FZ2_BIN that is based on the analog signal (in this case FZ2). 
-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 
-any analog frame that is greater than the metric value thresh is set to 1 all other frames are set to 0 +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 an end frame that is after the threshold crossing but before the next time the +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. +! 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
 ; ;
 </code> </code>
  
-==== example: create a sine wave ====+==== Representing the equation R= (Y - M*X - B)^2 ==== 
  
-the following command creates sine wave of frequency 1 hz+Consider DERIVED signal named TEST that is stored in the processed folder and has 2 or more component (X, Y, ....). 
 +  *X => DERIVED::PROCESSED::TEST::
 +  *Y => DERIVED::PROCESSED::TEST::Y
  
-**evaluate_expression** +Consider M and B to be two Metric signals with one component 
-/expression=sin(2*[[visual3d:documentation:pipeline:expressions:overview#functions|pi()]]*1*(frame_numbers::original::time-1)) +  *=> METRIC::PROCESSED::
-/result_name=sin1 +  *B => METRIC::PROCESSED::B
-/result_type=derived +
-/result_folder=sinewaves +
-**;** +
-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 is represented as:
  
-if the frequency was stored as a metric signal (e.g. metric::processed::freq), you could use the following:+<code> 
 +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 
 +
 +</code>
  
-**evaluate_expression** +The resulting signal is named RESULT and stored in the PROCESSED folder
-/expression=sin(2*[[visual3d:documentation:pipeline:expressions:overview#functions|pi()]]*metric::processed::freq*(frame_numbers::original::time-1)) +
-/result_name=sin1 +
-/result_type=derived +
-/result_folder=sinewaves +
-**;** +
-==== representing the equation r= (y - m*x - b)^2 ====+
  
-consider derived signal named test that is stored in the processed folder and has 2 or more component (x, y, ....).+==== Comparing model metric with a string ==== 
  
-x => derived::processed::test::+Consider a model metric that is defined as a string.
-y => derived::processed::test::+
-\\ +
-consider m and b to be two metric signals with one component+
  
-m =metric::processed::m +<code
-=> metric::processed::b +Set_Model_Metric 
-\\ +! /CALIBRATION_FILE
-the expression is represented as:+/METRIC_NAME=TEST 
 +/METRIC_VALUE="TTT" 
 +
 +</code>
  
-**evaluate_expression** +Now compare it to the text string "TTT"
-/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+
  
-==== examplecomparing a model metric with a string ===+<code> 
- +Evaluate_Expression 
-consider a model metric that is defined as a string. +/EXPRESSION=MODEL::METRIC::TEST="TTT" 
- +/RESULT_NAME=SCOTT 
-**set_model_metric** +/RESULT_TYPE=METRIC 
-/calibration_file+/RESULT_FOLDER=PROCESSED 
-/metric_name=test +
-/metric_value="ttt" +</code>
-**;** +
-now compare it to the text string "ttt"+
  
-**evaluate_expression** +The text strings should be equal so the resulting signal contains a 1
-/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+
  
-==== example: exporting a model metric ====+==== 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.+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.
  
 <code> <code>
-copy the model metric rth::length to the global metric folder +Copy the model metric RTH::LENGTH to the GLOBAL metric folder 
-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 the signal +Export the signal 
-prompt for the exported filename +Prompt for the exported filename 
-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
 ; ;
 </code> </code>
  
-==== example store model metric in the data tree ====+==== Store 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+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
  
 <code> <code>
-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
 ; ;
 </code> </code>
  
-==== example: quasi case statement ====+==== 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.+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.+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.
  
 <code> <code>
-define side parameters +Define Side Parameters
-</code>+
  
-<code> +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 for side +!Calculate IN MODEL BASED joint angle - ArmAngle for side 
-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 for opposite side+Calculate IN MODEL BASED joint angle - ArmAngle for opposite side
  
-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 sidedness +Handle sidedness 
-evaluate_expression +Evaluate_Expression 
-/expression=link_model_based::original::rarmangle*("&::side_letter&" = "r") +  link_model_based::original::larmangle*("&::side_letter&" = "l") +/EXPRESSION=LINK_MODEL_BASED::ORIGINAL::RArmAngle*("&::SIDE_LETTER&" = "R") +  LINK_MODEL_BASED::ORIGINAL::LArmAngle*("&::SIDE_LETTER&" = "L") 
-/result_name=primaryarmangle +/RESULT_NAME=PrimaryArmAngle 
-/result_type=derived +/RESULT_TYPE=DERIVED 
-/result_folder=processed+/RESULT_FOLDER=PROCESSED
 ; ;
 </code> </code>
  
-==== 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
  
 <code> <code>
-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
 ; ;
 </code> </code>
visual3d/documentation/pipeline/expressions/examples.1718801393.txt.gz · Last modified: 2024/06/19 12:49 by sgranger