18
18
datasets_folder = ' bone_datasets' ;
19
19
% datasets that you would like to process
20
20
datasets = {' TLEM2_MRI' , ' JIA_MRI' };
21
+ % masses for models
22
+ subj_mass_set = [45 , 76.5 ]; % kg
23
+
21
24
% format of input geometries
22
25
input_geom_format = ' tri' ;
23
26
% visualization geometry format (options: 'stl' or 'obj')
42
45
% folder from which triangulations will be read
43
46
tri_folder = fullfile(datasets_folder , cur_dataset , input_geom_format );
44
47
48
+ % log printout
49
+ log_file = fullfile(output_models_folder , [cur_dataset ,' _bilateral.log' ]);
50
+ logConsolePrintout(' on' , log_file );
51
+
45
52
for n_side = 1 : 2
46
53
47
54
% get current body side
48
55
[sign_side , cur_side ] = bodySide2Sign(sides{n_side });
49
56
50
57
% cell array with the bone geometries that you would like to process
51
58
bones_list = {' pelvis_no_sacrum' , [' femur_' , cur_side ],...
52
- [' tibia_' , cur_side ],[' talus_' , cur_side ],...
59
+ [' tibia_' , cur_side ], [' talus_' , cur_side ],...
53
60
[' calcn_' , cur_side ]};
54
61
55
62
% model and model file naming
56
63
cur_model_name = [' auto_' ,datasets{n_d },' _' ,upper(cur_side )];
57
64
model_file_name = [cur_model_name , ' .osim' ];
58
65
59
- % log printout
60
- log_file = fullfile(output_models_folder , [cur_model_name , ' .log' ]);
61
- logConsolePrintout(' on' , log_file );
62
-
63
66
% create geometry set structure for all 3D bone geometries in the dataset
64
67
triGeom_set = createTriGeomSet(bones_list , tri_folder );
65
68
81
84
82
85
% create joints
83
86
createOpenSimModelJoints(osimModel , JCS , joint_defs );
87
+
88
+ % update mass properties to those estimated using a scale version of
89
+ % gait2392 with COM based on Winters's book.
90
+ osimModel = assignMassPropsToSegments(osimModel , JCS , subj_mass_set(n_d ));
84
91
85
92
% add markers to the bones
86
93
addBoneLandmarksAsMarkers(osimModel , BL );
99
106
disp([' Model geometries saved in folder: ' , geometry_folder_path ,' .' ])
100
107
disp(' -------------------------' )
101
108
clear triGeom_set JCS BL CS
102
- logConsolePrintout( ' off ' );
109
+
103
110
% store model file (with path) for merging
104
111
osim_model_set(n_side ) = {osim_model_file }; % #ok<SAGROW>
105
112
end
106
113
% merge the two sides
107
114
merged_model_file = fullfile(output_models_folder ,[cur_dataset ,' _bilateral.osim' ]);
108
115
mergeOpenSimModels(osim_model_set{1 }, osim_model_set{2 }, merged_model_file );
109
-
116
+
117
+ % stop logger
118
+ logConsolePrintout(' off' );
110
119
end
111
120
% remove paths
112
121
rmpath(genpath(' STAPLE' ));
0 commit comments