Batch Processing Procedure
Good afternoon everyone,
At our lab out at Boise State University we’ve recently been using LifeMOD and the underlying platform rather heavily to compute subject-specific tibial strain values. Due to the large number of subjects in our data pool and the large number of trials per subject, we found it to be advantageous to develop a workflow that allows for batch processing of LifeMOD models. Below is an outline of the procedure we used as well as an example of modifications to the LifeMOD startup batch file like the ones we used after discussing options with Scott at Lifemodeler and looking through the MSC knowledge base.
1) Preparation. Be sure you have all the input files you’ll need generated (for us, this was a PiG motion file, joint position file, two augmented motion files, a ground reaction force file, and a flexible tibia file set per subject per trial generated through MATLAB from C3D files).
2) In our project it was worthwhile to build a “calibrated” model for each subject for subsequent use with each of the associated dynamic trials later, so we first built 20 foo_calibrated.bin files. Depending on your procedure you may wish to incorporate building the initial model into your command files, but this made the most sense for us.
3) Go through the entirety of your modeling and data export process once (starting either from scratch or from loading a calibrated binary file) and build a command file capable of running from start to finish. This may take a few tries and some troubleshooting.
4) Build desired command files by editing the previously built command file. It helps to use easily modified naming conventions, such as ‘subject_condition_trial’ as a prefix for every file name for easier editing later. Note that some things will be path specific in these files and should be paid close attention to.
5) Put all of these command files in the LifeMOD working directory; *ensure that no other command files are present in this directory level.
a. *required if MATLAB code I wrote is used; may be modified so this isn’t necessary if you’re a better programmer than me
6) Run M file with MATLAB running in your LifeMOD working directory as its current folder. The code, in a nutshell, will populate a list of all the command files in a folder, build a Windows batch file from the LifeMOD.bat file for each command file, and executes the batch file.
a. Note that I chose to close aview after every command file has run by including the exit command at the end of each cmd file; this may or may not be necessary for your purposes. If you’re running a large enough amount of data to require a batch process, though, it likely will be needed.
b. Also note that this isn’t the “cleanest” way to run the batch files. It will create a sort of backlog of work depending on how many licenses you have available on your machine and may display license checkout errors if running in interactive mode; in batch mode this will happen as well, but the errors will not be displayed and the batch files will all run.
Example modified LifeMOD batch file – note that the only changes are to run in batch mode and to execute a command file.
"%TOPDIR%\common\mdi.bat" aview ru-st b foo.cmd ex