User Tools

Site Tools


visual3d:documentation:modeling:virtual_lab:virtual_lab_direction_of_progression_method_2

This is an old revision of the document!


this script is explained in the virtual lab direction of progression tutorial. this script outlines method 2.

before running this script:

  • a static trial must be loaded into the workspace
  • a model template (with modified virtual lab) must be loaded into the workspace
  • a dynamic trial must be loaded into the workspace

note: a modified virtual lab follows the same outline as the dynamic virtual lab, except instead of using the lab_x landmark, the dir_prog_x landmark is used. an example of this model template can be found here.


**__add_a_comment__**
! /comment= 1. get the initial position of the origin of the pelvis (rpvo) 
;

! get the position of the pelvis at the start of the trial

event_explicit
/event_name=trial_start
/frame=20
! /time=
;

metric_signal_value_at_event
/result_metric_name=rpv_start
! /apply_as_suffix_to_signal_name=false
/result_metric_folder=prog
/signal_types=kinetic_kinematic
/signal_names=cgpos
/signal_folder=rpv
! /signal_components=
/component_sequence=all
/event_name=trial_start
/generate_mean_and_stddev=false
! /append_to_existing_values=false
! /generate_vector_length_metric=false
! /retain_no_data_values=false
;

! project the pelvis location onto the floor

evaluate_expression
/expression=vector ( metric::prog::rpv_start::1 , metric::prog::rpv_start::2 , 0 )
/result_name=rpv_start_proj
/result_type=metric
/result_folder=prog
;

! create a time based signal from the metric location of the projected pelvis

evaluate_expression
/expression=metric::prog::rpv_start_proj * ( (frame_numbers::original::frames * 0 + 1 ) )
/result_name=rpv_start_vec
/result_type=derived
/result_folder=prog
;

**__add_a_comment__**
! /comment= 
;

! 2. create a vector from the origin of the pelvis that offset in the -y direction of the lab (-y) 

evaluate_expression
/expression=( vector ( 0 , -1 , 0 ) * ( (frame_numbers::original::frames * 0+1 ) ) ) + derived::prog::rpv_start_vec
/result_name=rpv_start_vec_x
/result_type=derived
/result_folder=prog
;

! 3. project the pelvis origin onto the floor 

evaluate_expression
/expression=vector (kinetic_kinematic::rpv::proxendpos::x , kinetic_kinematic::rpv::proxendpos::y , 0)
/result_name=rpv_origin
/result_type=derived
/result_folder=prog
;

! 4. calculate the angle between the origin of the pelvis at t=0, the -y direction of the lab, and the direction of progression (dop) at each time point in the trial 

compute_planar_angle
/signal_types=derived
/signal_folder=prog
/signal_names=rpv_start_vec_x+rpv_start_vec+rpv_origin
/result_folder=prog
/result_name=rpv_orientation
! /compute_3pt_angle=true
! /normalx=
! /normaly=
! /normalz=
! /reference_segment=lab
! /projection_plane=xy
! /use_right_hand_rule=true
/use_0_to_360_degrees=false
;

! 5. calculate the metric direction of progression based on the angle (theta y) between the direction of progression and the y axis 

metric_median
/result_metric_folder=prog
/result_metric_name=_med
/apply_as_suffix_to_signal_name=true
/signal_types=derived
/signal_folder=prog
/signal_names=rpv_orientation
/signal_components=
/component_sequence=all
/event_sequence=
/exclude_events=
! /sequence_percent_start=0
! /sequence_percent_end=100
! /generate_mean_and_stddev=true
! /append_to_existing_values=false
;

**__add_a_comment__**
! /comment= define the virtual lab based on theta y
;

set_pipeline_parameter_from_expression
/parameter_name=angle
/expression=global::metric::prog::rpv_orientation_med_mean
! /as_integer=true
;

add_landmark
/landmark_name=dir_prog_x
! /calibration_file=
! /user_generated=true
! /use_percentage=false
! /calibration_only=false
! /use_targets=false
/segment_name=lab
! /target_types=
! /target_names=
/mcs_ml= - 0.1 * sin ( ( 90 - &::angle& ) * pi()/180 )
/mcs_ap= - 0.1* cos ( ( 90 - &::angle& ) * pi()/180 )
/mcs_axial=0
! /landmark_location=
! /reference_location_type=
! /reference_location_name=
! /use_reference_location=false
;

build_model
! /calibration_file=
! /rebuild_all_models=false
! /display_results=true
;

recalc

;
visual3d/documentation/modeling/virtual_lab/virtual_lab_direction_of_progression_method_2.1718804192.txt.gz · Last modified: 2024/06/19 13:36 by sgranger