Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Code/CodeIndex.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Code Index
A list of the code contributed by our community members. This is either hosted here on the CMAS open-code repository, or externally.
A list of the code contributed by our community members. This is either hosted here on the CMAS open-code repository, or externally.
When you add a new entry, make sure you include a link to the code, the required software, and your name, so we know who to thank! :heart::clap:

- [Gait Profile Score & Movement Analysis Profile](https://github.com/cmasuki/open-code/tree/master/Code/Gait_profile_score) by [Neil Postans](https://github.com/npostans).
- [Gait Profile Score & Movement Analysis Profile](https://github.com/cmasuki/open-code/tree/master/Code/Gait_profile_score) by [Neil Postans](https://github.com/npostans).
Needs Python 2.7 (32 bit version) & Vicon Nexus 2.x
- [Local Dynamic Stability code (Rosensteins Algorithm)](https://github.com/SjoerdBruijn/LocalDynamicStability) by [Sjoerd Bruijn](https://github.com/SjoerdBruijn) Needs Matlab (any version)
- [Code to read accelerometry data from a mobile phone via Matlab in realtime](https://github.com/SjoerdBruijn/StreamPhoneData) by [Sjoerd Bruijn](https://github.com/SjoerdBruijn) Needs Matlab (any version)
- [visualisation and statistical processing of 3D gait data with R](https://github.com/pyCGM2/rCGM2) bu [Fabien Leboeuf](https://github.com/pyCGM2/rCGM2) Needs Rstudio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your name should link to your github profile. (The name of the package should link to the package itself)

62 changes: 62 additions & 0 deletions Code/anonymising c3d/matlab/ChangeSubjectName-btk.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
function ChangeSubjectName
% change the name of subject in C3D files associated with models, markers,
% events
% vsk file should have the same name of the new name of the subject.
DefaultName = '\\DEFAULT PATH'; % TO EDIT
[C3D_filename,C3D_path]=uigetfile({'*.C3D'},'Select C3D file',DefaultName,'MultiSelect','on');
nbre_fichier = size(C3D_filename,2);

f=findstr(C3D_path,'\');
def=C3D_path(f(end-2)+1:f(end-1)-1);
subject = inputdlg('Name of the new subject','Name of the new subject',1,{def});
subject=char(subject);

for t=1:nbre_fichier
C3D_file=char(C3D_filename(t));

if nbre_fichier ==1
C3D_file = C3D_filename;
end
acq= btkReadAcquisition(char([C3D_path C3D_file]));
METADATA = btkGetMetaData(acq);
I1=struct();
I3=struct();
info1=struct();
info3=struct();
B={};
% change subject name in the metadata
if isfield(METADATA.children,'SUBJECTS')==1
info1=METADATA.children.SUBJECTS.children.NAMES.info;
I1 = btkMetaDataInfo('Char', {subject});
btkAppendMetaData(acq,'SUBJECTS','NAMES',I1);
info2=METADATA.children.POINT.children.ANGLES.info;
I2 = btkMetaDataInfo('Char', {subject});
btkAppendMetaData(acq,'POINT','ANGLES',I2);
end

% change subject name in the events
n_event=btkGetEventNumber(acq);
if isempty(n_event)==0
if n_event>0
for i=1:n_event
btkSetEventSubject(acq, i, subject);
end
end
end

% change subject name in analysis
if isfield(METADATA.children,'ANALYSIS')==1
info3=METADATA.children.ANALYSIS.children.SUBJECTS.info;
if info3.dims(2)>0
for i=1:info3.dims(2)
B{i}=subject;
end
I3 = btkMetaDataInfo('Char', B');
btkAppendMetaData(acq,'ANALYSIS','SUBJECTS',I3);
end
end

btkWriteAcquisition(acq,(char([C3D_path C3D_file])));
disp(['Write - ' char([C3D_path C3D_file])]);
end
disp('Change Name finished')
32 changes: 32 additions & 0 deletions Code/anonymising c3d/matlab/changeSubjectName-btk.readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
**DESCRIPTION**
change subject name of a several c3d files

**SYNOPSIS**



**AUTHOR**

Stephane Armand : HUG - Geneva (SW)



**REQUIREMENT**

* BTK ( matlab) 0



**CHANGELOG**

* *[2018-05-07]* proposal to CMASUKI


**TODO**



**HOW TO**

1. Run the m file
2. Select your c3d set i the dialog box
14 changes: 14 additions & 0 deletions Code/anonymising c3d/python/anonymising-pyCGM2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-

import os
from pyCGM2.Tools import btkTools


if __name__ == "__main__":

c3dFilename = "TO EDIT"
DATA_PATH = os.getcwd() + "//"

btkAcq = btkTools.smartReader(DATA_PATH+c3dFilename)
btkAcqUn = btkTools.changeSubjectName(btkAcq,subjectName)
btkTools.smartWriter(btkAcqUn, DATA_PATH+c3dFilename[:-4]+"-Anonymised.c3d")
39 changes: 39 additions & 0 deletions Code/anonymising c3d/python/anonymising-pyCGM2.readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
**DESCRIPTION**
change name of the subject into the c3d

(@CarolineORLAUKeele : ready to sell your scripted USB stick on ebay :-) )

**SYNOPSIS**

When you export a c3d, from Vicon Nexus for instance, the name of the subject is defined in different sections of the c3d.
This function allows to change the subject name everywhere and export a new c3d with *-anonymised" as suffix



**AUTHOR**

Fabien Leboeuf : University Salford (UK)



**REQUIREMENT**

* this function need installation of [pyCGM2](https://pycgm2.github.io)
* compatible python2.7 only


**CHANGELOG**

* *[2018-05-07]* proposal to CMASUKI


**TODO**



**HOW TO**

1. place the script "anonymising-pyCGM2.py" into your data folder
2. open it with either your python editor pycharmm, spyder or a text editor like notepad
3. edit you c3d filename (replace TOEDIT)
4 run the python script ( double click on "anonymising-pyCGM2.py") if *python.exe* is associated with *.py file or use the run command of your python IDE)