$!
$!  VAX/VMS command file to automate the processing of clinical gait data
$!  This file was created for the Mayo clinic Orthopaedic Biomechanics
$!  Motion Analysis Corporation system with the Helen Hayes marker set and
$!  up to 3 force plates. This command file is set up to use the old
$!  versions of ANZ,TELIO and SHOW3D which were exclusively for the VAX
$!  and whose graphics depended on DI3000. This file is not usable on
$!  a pc under DOS, but the process followed here should be useful to those
$!  who want to develop their own automated methods for processing data.
$! 
$!  Written by Dwight Meglan, Feb. 1993
$!
$!  This command file is run after GAIT1.COM has been run and the gait events
$!  of the gait cycle have been identified from the printouts of the heel and
$!  toe markers generated by TELIO as part of GAIT1.COM. The relevant data
$!  specific to the gait cycle/subject being processed must be changed below
$!  before this command file is run.
$!
$!  NOTE:
$!  A minimum of 4 entries below must be changed for an individual gait rum
$!
$!
$!  Set up the locations of the various programs and files used 
$!
$   PREFIX   :== cln$user3:[chao_eys.meglan
$   define ANZ_PATH 'PREFIX'.anz.source]
$   define TEL_PATH 'PREFIX'.telio.source]
$   define SHW_PATH 'PREFIX'.show3d]
$   define TELMAC   'PREFIX'.telio]
$   define DATA_PATH " "
$!
$!  Setup DI3000 device drivers
$!  Default drivers are a tektronix 4105 and a postscript printer
$!
$   DI3_TERMINAL :== 405
$   DI3_PRINTER  :== PST
$!
$!  Change information below for specific gait run
$!
$   FILENAME :== jfm117
$!
$!  Gait event sequences- Uncomment the proper sequence below
$!
$!  Right - Left - Right Sequence
$!
$!   EVENT1_NAME   :== rhs
$!   EVENT2_NAME   :== lto
$!   EVENT3_NAME   :== lhs
$!   EVENT4_NAME   :== rto
$!   EVENT5_NAME   :== rhs
$!
$!  Left - Right - Left Sequence
$!
$  EVENT1_NAME   :== lhs
$  EVENT2_NAME   :== rto
$  EVENT3_NAME   :== rhs
$  EVENT4_NAME   :== lto
$  EVENT5_NAME   :== lhs
$!
$!  Change below to the specific gait event frame numbers
$!
$   EVENT1_FRM    :== "19"
$   EVENT2_FRM    :== "24"
$   EVENT3_FRM    :== "51"
$   EVENT4_FRM    :== "57"
$   EVENT5_FRM    :== "78"
$!
$!  Force plate to motion alignment parameters. Uncomment the appropriate
$!  situation below.
$!  NOTE: Number in /rft= and /lft= corresponds to how data is recorded/stored
$!        in ANZ and NOT the order in which the plates contacted !!!
$!        Also, these combinations are set up for having TWO force plates and
$!        the Kistler referred to can be either the old kistler plate used 
$!        before 2/21/93 at Mayo or the new kistler plate used in the same
$!        location after 2/21/93.
$!
$!  Left Heelstrike on Kistler (2) and right heelstrike on Bertec (1)
$  FP :== /rft=1/lft=2
$!
$!  Right Heelstrike on Kistler (2) and left heelstrike on Bertec (1)
$!  FP :== /rft=2/lft=1
$!
$!  Left Heelstrike on Kistler (2) and right heelstrike on Bertec (1)
$!  Also, the first heelstrike sorted is before the Kistler, i.e. the second
$!  heelstrike sorted is the first heelstrike on a force plate.
$!  FP :== /sec/rft=1/lft=2
$!                    
$!  Left Heelstrike on Kistler (1) and right heelstrike on Bertec (2)
$!  FP :== /sec/rft=2/lft=1
$!
$!  Only right foot struck the SINGLE force plate active OR
$!  Only the right foot struck a force plate and it was the Bertec (1)
$!  FP :== /rft=1
$!
$!  Only right foot struck the SINGLE force plate active OR
$!  Only the right foot struck a force plate and it was the Bertec (1)
$!  The first heelstrike sorted is before the force plate, i.e. the second
$!  heelstrike sorted is the first heelstrike on a force plate.
$!  FP :== /sec/rft=1
$!
$!  Only left foot struck the SINGLE force plate active OR
$!  Only the left foot struck a force plate and it was the Bertec (1)
$!  FP :== /lft=1
$!
$!  Only left foot struck the SINGLE force plate active OR
$!  Only the left foot struck a force plate and it was the Bertec (1)
$!  The first heelstrike sorted is before the force plate, i.e. the second
$!  heelstrike sorted is the first heelstrike on a force plate.
$!  FP :== /sec/lft=1
$!
$!  Only the right foot struck the Kistler (2) and both plates are active
$!  FP :== /rft=2
$!
$!  Only the right foot struck the Kistler (2) and both plates are active
$!  The first heelstrike sorted is before the force plate, i.e. the second
$!  heelstrike sorted is the first heelstrike on a force plate.
$!  FP :== /sec/rft=2
$!
$!  Only the left foot struck the Kistler (2) and both plates are active
$!  FP :== /lft=2
$!
$!  Only the left foot struck the Kistler (2) and both plates are active
$!  The first heelstrike sorted is before the force plate, i.e. the second
$!  heelstrike sorted is the first heelstrike on a force plate.
$!  FP :== /sec/lft=2
$!
$!
$!  End of things that should be changed for each gait trial. DO NOT modify
$!  any of the remaining lines in this command file unless you know exactly
$!  why you are doing it!
$!
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$!
$!  Write out a command file
$!                                
$ open/write file 'FILENAME'2.com
$!
$ write file "$ set def DATA_PATH"         
$ write file "$ run/nodebug ANZ_PATH:anz"
$ write file " opt gen nup"
$ write file " rea ''FILENAME'.anz"
$!
$! Define the gait cycle events
$!
$ write file " cyc eve/rel
$ write file " ''EVENT1_NAME' ''EVENT1_FRM'"
$ write file " ''EVENT2_NAME' ''EVENT2_FRM'"
$ write file " ''EVENT3_NAME' ''EVENT3_FRM'"
$ write file " ''EVENT4_NAME' ''EVENT4_FRM'"
$ write file " ''EVENT5_NAME' ''EVENT5_FRM'"
$ write file " done"
$ write file " cyc sta"
$ write file " frc ali''FP'"
$ write file " frc cpr"
$ write file " save ''FILENAME'.anz"
$!
$! Do the joint resultant load calculations
$!
$ write file " frc cli"
$ write file " frc lcp"       
$ write file " jnt loa"
$ write file " jnt pow"
$ write file " save ''FILENAME'j.anz"
$!
$! Dump out VIS files
$!
$ write file " exp seg prm/vis ''FILENAME'j.byu"
$ write file " exp seg pos/vis ''FILENAME'j.ani"
$ write file " exp jnt loa vis ''FILENAME'j.jrl"
$ write file " exit"
$ write file "y"          
$!
$!  Produce graphs of the gait cycle
$!
$ write file "$ setdrv ''DI3_TERMINAL' ''DI3_PRINTER'"
$ write file "$ run/nodebug TEL_PATH:telio"
$ write file " opt mac ech off"
$ write file " rea ''FILENAME'j.anz"
$ write file " rea TELMAC:norm_ang.anz"
$!
$! Generate Ohio State University style plots of the joint angles and
$! time-distance parameters
$!
$ write file " mac rea TELMAC:clinical.mac"
$ write file " opt gra/all pst on"
$ write file " opt gra/all scr off"
$ write file " opt sch pst on"
$ write file " opt sch scr off"     
$ write file " mac 8"
$ write file " mac 9"      
$!
$! Produce San Diego Children's Hospital style plots of joint angles
$!
$ write file " opt gra/all res"
$ write file " opt sch res"
$ write file " opt gra/all pst on"
$ write file " opt gra/all scr off"
$ write file " opt sch pst on"
$ write file " opt sch scr off"
$ write file " mac rea TELMAC:sandiego.mac"                         
$ write file " mac 0"
$ write file " mac 2"      
$!
$!  Produce plots of the joint moments of the legs
$!
$ write file " opt gra/all res"
$ write file " opt sch res"
$ write file " opt gra/all pst on"
$ write file " opt gra/all scr off"
$ write file " opt sch pst on"
$ write file " opt sch scr off"
$ write file " mac rea TELMAC:jloads.mac"         
$ write file " mac 0"                        
$!
$!  Produce plots of the joint moments normalized by weight and height and 
$!  the joint powers normalized by weight and height
$!
$ write file " opt gra/all res"
$ write file " opt sch res"
$ write file " opt gra/all pst on"
$ write file " opt gra/all scr off"                      
$ write file " opt sch pst on"
$ write file " opt sch scr off"
$ write file " mac rea TELMAC:normloadpower.mac"
$ write file " mac 0"
$ write file " mac 2"
$!
$!  Produce plots of the ground reaction loads
$!
$ write file " opt gra/all res"
$ write file " opt sch res"                                   
$ write file " opt gra/all pst on"
$ write file " opt gra/all scr off"
$ write file " opt sch pst on"
$ write file " opt sch scr off"            
$ write file " mac rea TELMAC:grls.mac"       
$ write file " mac 0"
$ write file " mac 1"
$ write file " mac 2"
$ write file " mac 3"
$ write file " mac 4"
$ write file " mac 5"
$ write file " mac 6"
$ write file " mac 7"
$ write file " mac 8"
$ write file " exit"
$ write file "y"
$! write file "$ print/que=brutus$print posts.dat"
$ write file "$ print/que=lps_post$print posts.dat"
$ close file
$!            
$! Now execute the command file                               
$!
$ @'FILENAME'2                 
