-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readmes here, readmes there, readmes everywhere
- Loading branch information
Showing
11 changed files
with
57 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,8 @@ | ||
This folder collects MATLAB scripts commonly used for processing raw data. | ||
|
||
In `OpenSim4.3` you can find scripts that use OpenSim functionalities specifically. They described here, to view all of them on the same page | ||
|
||
When adding a new file, please edit the following list with the file name and a short description of how to use it (and why). | ||
|
||
- `EMGcrunch_example.m` : example of how to process EMG signals of specific (user defined muscles). Requires MVC experiments and generic motions to be analyzed (in format `MVC*.mat` and `motion*.mat`). The EMG data are filtered, rectified, and normalized. | ||
|
||
- `OpenSim4.3/c3dExport_markersOnly.m` : extracts marker trajectories (`.trc`) from motion capture results (`.c3d`). When run, prompts the user to navigate to the desired `.c3d` file, processes it and saves it with a user-defined name in the same folder. | ||
|
||
- `EMG_analysis.m`: processes EMG signals of specific (user defined muscles). Requires MVC experiments and generic motions to be analyzed (in format `MVC*.mat` and `motion*.mat`). The EMG data are filtered, rectified, and normalized. | ||
Uses: `butterworth_filter.m`, `extract_data.m`, `extract_mvc.m`, and `normalize_emg.m` | ||
|
||
- `butterworth_filter.m`: filters raw data by applying a bandpass filter, rectification and low pass filter to the EMG data. Output is filtered EMG prepped for analysis | ||
|
||
- `extract_data.m`: takes `.mat` files with analog data as input and extracts EMG channels. NB: EMG channel should be the first channel per muscle. | ||
|
||
- `extract_mvc.m` takes the maximum of the maximum of the filtered data, this results in one value per muscle: the highest measured activation over all trials. | ||
|
||
- `normalize_emg.m`: normalizes trial data with the use of the MVC data. Scales activation between 0 and 1. | ||
|
||
- `readTRC.m`: reads a `.trc` file (only input) and loads it into the workspace. It returns the x-y-z trajectories for each marker in form of a single 2D array. Timestamps, labels for the markers and units of measurement used can also be retrieved. | ||
|
||
- `writeMarkersToTRC.m`: saves a new `.trc` file. Takes as inputs the name of the files, the markers to be saved (3D markers trajectories as a single 2D array), marker labels, rate of acquisition, optionally the frames, the timestamps and the units of measurement used. A GUI will be prompted at the end to ask the directory for the `.trc' file to be saved in. | ||
|
||
- `read_motionFile.m`: reads a `.mot` file (only input) and returns a Matlab structure with fields corresponding to column labels, 2D matrix of data, dimensions of the matrix of data. | ||
|
||
- `CSV2TRC.m`: opens a `.CSV` file (or other ASCII text file that can be converted to a table) and transforms it to match the `.trc` format. Uses `writeMarkersToTRC.m`. | ||
|
||
|
||
- ... [add new script here] | ||
|
||
This folder collects scripts used for data processing. Many of them are general purpose scripts, whose use is documented in other functions or in the scripts themselves. | ||
|
||
In particular: | ||
- `SPM_robustness_analysis.m` allows to reproduce the robustness analysis performed in our paper. It requires 4 steps before running it: | ||
1. installing the SP1D package for Matlab (instructions at https://spm1d.org/install/InstallationMatlab.html) | ||
2. generating the perturbed models (using the scripts in `Code/Model Perturbation`) | ||
3. getting the marker data from the open-access study from Seth et al (available at: https://simtk.org/projects/thoracoscapular). The marker data should be copied into the `ExperimentalData/Markers` folder of this repository | ||
4. running the RMR solver on the models and markers retrieved above. The analysis can be performed through `Code/Compute Muscle Activity/RMR solver/analyse_perturbed_models.m`. Results should be stored in `Results/RMR analysis/robustness analysis`, following the indications provided there. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
In order to generate the plots provided in our paper, simply run `PlotResults.m` and select the tasks you want to analyse. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
In our paper we generated 200 different models to test for the robustness of our conclusions against intrinsic uncertainty of the study. We do not share the models, as this would clutter this repo, but we provide the scripts to generate them. | ||
|
||
In order to achieve similar results to ours: | ||
1. run the `perturb_models.m` to produce 100 different models, selecting as input the model in `OpenSim Models/for RMR solver/TSM_subject_noWeight.osim`. Copy-paste the resulting models into `OpenSim Models/for RMR solver/perturbed models/noWeight`. | ||
3. Run the script `add_2kgLoad_toModels.m`, selecting the results of the previous step, and copy-paste the resulting models in `OpenSim Models/for RMR solver/perturbed models/2kgWeight`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
The code collected here is divided in 3 folders: | ||
The code collected here is divided in 4 folders: | ||
|
||
- `Compute Muscle Activation`: stores the scripts required to perform both CMC and RMR analysis on the dataset | ||
- `Data Processing`: contains all the scripts necessary to process the data | ||
- `Image Generation`: stores the scripts used to analyze our results and generate the images included in the paper | ||
- `Data Processing`: contains all the scripts necessary to process the data (utilities, and scripts used to perform statistical analysis on our results) | ||
- `Image Generation`: stores the scripts used to analyze our results and generate the images included in the paper | ||
- `Model Perturbation`: stores the scripts used to perturb randomly our models, accounting for intrinsic uncertainty in marker-based biomechanical studies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## EMG data | ||
This folder is used to collect the EMG data corresponding to the various tasks that are analyzed in our paper. | ||
The movements were performed by a single subject, and are: | ||
- unloaded abduction (ABD01, ABD02, ABD03) | ||
- loaded abduction (ABD21, ABD22, ABD23) | ||
- unloaded forward flexion (FLX01, FLX02, FLX03) | ||
- loaded forward flexion (FLX21, FLX22, FLX23) | ||
- unloaded shrugging (SHRUG01, SHRUG02, SHRUG03) | ||
- loaded shrugging (SHRUG21, SHRUG22, SHRUG23) | ||
|
||
You can get the data and populate your local version of the repository from the dataset available at https://simtk.org/projects/thoracoscapular. | ||
|
||
It could be annoying, but we do not provide the dataset directly on purpose. | ||
Why? We want to avoid duplicating it over and over, so that we can save memory and energy in the servers and appropriately credit the researchers who collected the data in the first place! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
The folder `perturbed_100` comes empty. | ||
The folder `perturbed` comes empty. | ||
Instructions on how to generate the models that can be used in the robustness analysis are contained in the two sub-folders above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
In this folder we store the results of our study. | ||
|
||
- in `CMC analysis` you can find the results of analysing the various shoulder movements with the computed muscle control algorithm | ||
- in `RMR analysis`, we store the results of the same analysis, performed with our solver on the same marker data (with and without including the glenohumeral constraint) | ||
- in `IK solutions`, we share the results of our inverse kinematics analysis (which are the same both for the CMC and RMR tools) | ||
|
||
|
||
Note that in `RMR analysis/robustness analysis` we provide the structure that you should populate yourself with the results that the RMR solver delivers when considering different perturbed models (see our paper and the content of `OpenSim Models/for RMR solver/perturbed models`). We do not share our results here as they consist of over 3000 files, that would make this repository very heavy to clone and store. However, we hope to provide sufficient instructions so that our results can be reproduced fully. |