====== Computing a Time Normalized Average Event ====== ===== Introduction ===== \\ A customer wanted to add an annotation to the normative graph at the location of the corresponding **normative** event label. This would be equivalent to the option to [[Visual3D:Documentation:Reports:Report_2D_Graph#Annotations|annotate a graph comprised of time based signals]]. Rather than leave the customer with no options, we explored the following "kludgy workaround".\\ \\ This example allows you to specify the normative event from the datatable (i.e. you can calculate the time of the normative event). [[Visual3D:Documentation:Reports:Adding_an_annotation_at_60%_along_the_x-axis|This example shows you another method which lets you explicitly define when the annotation should be created]].\\ \\ [[https://www.has-motion.com/download/examples/Reporting/Annotation_From_P2D.zip|You can download the sample files for this tutorial here]]. ===== Create Event stored in P2D ===== The first step is to store the value we want to create the annotation at. In this tutorial, the value is going to be stored GLOBAL::P2D::NORM_EVENTS::LTO. * Option 1: Explicitly specify this value as 40% of the gait cycle (running data) * Option 2: Calculate the average time toe off occurs from a normal databse === Option 1: Explicit === Explicitly define the value: Evaluate_Expression /EXPRESSION=40 ! /SIGNAL_TYPES= ! /SIGNAL_FOLDER=ORIGINAL ! /SIGNAL_NAMES= /RESULT_TYPES=P2D /RESULT_FOLDERS=NORM_EVENTS /RESULT_NAME=GLOBAL::LTO ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ; === Option 2: Calculate from database === Calculate the average value from the normal database: - [[Visual3D:Documentation:Reports:Normative_Data_From_CMO_Library#Step_1:_Organize_.26_Catalog_the_CMO_files|Load the database (Step 1)]] - Run a script to calculate theĀ % the event occurs during the gait cycle (example, when toe off occurs during the gait cycle). An example script is provided below: Select_Active_File /FILE_NAME=EACH_CMO_WORKSPACE /QUERY= ; Metric_Time_Between_Events /RESULT_METRIC_NAME=LStance /RESULT_METRIC_FOLDER=EVENTS /EVENT_SEQUENCE=LHS+LTO /EXCLUDE_EVENTS= ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; Metric_Time_Between_Events /RESULT_METRIC_NAME=LGaitCycle /RESULT_METRIC_FOLDER=EVENTS /EVENT_SEQUENCE=LHS+LHS /EXCLUDE_EVENTS= ! /GENERATE_MEAN_AND_STDDEV=TRUE ! /APPEND_TO_EXISTING_VALUES=FALSE ; Evaluate_Expression /EXPRESSION=100*GLOBAL::METRIC::EVENTS::LStance_MEAN/GLOBAL::METRIC::EVENTS::LGaitCycle_MEAN /RESULT_NAME=GLOBAL::LTO /RESULT_TYPE=P2D /RESULT_FOLDER=NORM_EVENTS ; === Save P2D File === |You can then export the P2D data as a Normal Database (Normal_Data_Events.vnd) | {{:Annotation_ExportP2D.png}}| ===== Plot Event stored in P2D ===== === Getting Started === [[Visual3D:Documentation:Reports:Plotting_P2D_Data#Plot_P2D_Data|It's assumed that you have followed the steps described here]]. |If you followed the steps correctly, you would be starting with a graph that looks like this. | {{:P2D_2DGraph.png}}| === Load the P2D Data === Loads the P2D file which contains the average events: - **File -> Open** - Select the **Normal_Data_Events.vnd** file === Option 1: Manually Graph Event === |* Annotation Style: **Vertical Line**\\ * Color: **Black**\\ * Size: **Normal**\\ * Event Name or Numeric Value: **GLOBAL::P2D::NORM_EVENTS::LTO**\\ * Check **"Average Event or Numeric Value"** | {{:P2D_Annotation_Define.png}}| === Option 2: Pipeline Graph Event === Add_Graph_Annotation /PAGE_NUMBER=1 /COLUMN_NUMBER=1 /ROW_NUMBER=1 /DRAW_ORDER=2 /ANNOTATION_EVENT=GLOBAL::P2D::NORM_EVENTS::LTO /ANNOTATION_STYLE=Vertical Line /ANNOTATION_COLOR=Black ! /ANNOTATION_SIZE=Normal /ANNOTATION_GLOBAL=FALSE /ANNOTATION_AVERAGE_EVENT=TRUE ; === Final === |If everything is correct, you should see a black vertical line. | {{:P2D_Annotation_2DGraphFinal.png}}|