Page MenuHomec4science

MOMENT_ARM_TOOL_main_file.m
No OneTemporary

File Metadata

Created
Sun, Jan 12, 06:51

MOMENT_ARM_TOOL_main_file.m

%{
--------------------------------------------------------------------------
EPFL - LA - LBO UPPER EXTREMITY MODEL
Created by : David Ingram (LA - EPFL) ..............30.07.2014
Updates by : Ehsan Sarshari (LA/LBO - EPFL) ........since 01.06.2015
GUI FOR RUNNING THE MOMENT ARM VISUALISATION TOOL
--------------------------------------------------------------------------
File Description :
This is the main file for running the muscle moment-arms
visualisation tool. From this file, all the moment arms of each muscle
can be visualised.
--------------------------------------------------------------------------
File Structure :
The file creates the figure in MAHandle. The uicontrols are added in
MAGUIHandle and the axes are generated in MAVisualisationAxes. The axes
are built such that clicking on an axes opens a figure containing the
plot.
--------------------------------------------------------------------------
%}
% Create a new figure
MAHandle = figure(...
'color', 'white',...
'units', 'normalized',...
'position', [0.1, 0.1, 0.4, 0.8],...
'toolbar', 'figure',...
'name', 'EPFL - LBO Upper Extremity Model: Moment arms');
MAGUIHandle.Close_Button = uicontrol(...
'units', 'normalized',...
'position', [0.85, 0.95, 0.15, 0.05],...
'style', 'pushbutton',...
'string', 'CLOSE GUI',...
'fontsize', 14,...
'fontweight', 'bold',...
'callback', MOMENT_ARM_TOOL_script_generator('Close GUI'));
MAGUIHandle.Save_Button = uicontrol(...
'units', 'normalized',...
'position', [0.85, 0.9, 0.15, 0.05],...
'style', 'pushbutton',...
'string', 'SAVE DATA',...
'fontsize', 14,...
'fontweight', 'bold',...
'callback', MOMENT_ARM_TOOL_script_generator('Save Data'));
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% CREATE AXES
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Initialise the MADATA structure
MADATA = cell(42, 1);
% Each element in the cell will contain a 9 x N matrix
for MuscleId = 1:42
MADATA{MuscleId, 1}.MomentArms = cell(1,20);
MADATA{MuscleId, 1}.MomentArmsNum = cell(1,20);
MADATA{MuscleId, 1}.FDirection = cell(1,20);
MADATA{MuscleId, 1}.ScapularPlane_GnP = cell(1,20);
MADATA{MuscleId, 1}.ScapularPlane = cell(1,20);
for SegmentId = 1:20
MADATA{MuscleId, 1}.MomentArms{1,SegmentId} = zeros(size(KEDATA.Joint_Angle_Evolution,2),15);
MADATA{MuscleId, 1}.MomentArmsNum{1,SegmentId} = zeros(size(KEDATA.Joint_Angle_Evolution,2),15);
MADATA{MuscleId, 1}.FDirection{1,SegmentId} = zeros(size(KEDATA.Joint_Angle_Evolution,2),15);
MADATA{MuscleId, 1}.MuscleLength(:,SegmentId) = zeros(size(KEDATA.Joint_Angle_Evolution,2),1);
MADATA{MuscleId, 1}.ScapularPlane_GnP{1,SegmentId} = zeros(size(KEDATA.Joint_Angle_Evolution,2),15);
MADATA{MuscleId, 1}.ScapularPlane {1,SegmentId} = zeros(size(KEDATA.Joint_Angle_Evolution,2),15);
end
end
% Central Axis
MAVisualisationAxis.Central = axes(...
'units', 'normalized',...
'position', [0.2, 0.064, 0.45, 0.8760],...
'xcolor', 'white',...
'ycolor', 'white');
% Subclavius
MAVisualisationAxis.Muscle(1,1) = axes(...
'units', 'normalized',...
'position', [0, 0.94, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 1, MADATA, KEDATA));
% Serratus Anterior (Superior)
MAVisualisationAxis.Muscle(2,1) = axes(...
'units', 'normalized',...
'position', [0, 0.72, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 2, MADATA, KEDATA));
% Serratus Anterior (Middle)
MAVisualisationAxis.Muscle(3,1) = axes(...
'units', 'normalized',...
'position', [0, 0.6650, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 3, MADATA, KEDATA));
% Serratus Anterior (Inferior)
MAVisualisationAxis.Muscle(4,1) = axes(...
'units', 'normalized',...
'position', [0, 0.445, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 4, MADATA, KEDATA));
% Trapezius (C1 - C6)
MAVisualisationAxis.Muscle(5,1) = axes(...
'units', 'normalized',...
'position', [0.35, 0.94, 0.15, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 5, MADATA, KEDATA));
% Trapezius (C7)
MAVisualisationAxis.Muscle(6,1) = axes(...
'units', 'normalized',...
'position', [0.5, 0.94, 0.15, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 6, MADATA, KEDATA));
% Trapezius (T1 - T2)
MAVisualisationAxis.Muscle(7,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.94, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 7, MADATA, KEDATA));
% Trapezius (T3 - T7)
MAVisualisationAxis.Muscle(8,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.8850, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 8, MADATA, KEDATA));
% Levator Scapuale
MAVisualisationAxis.Muscle(9,1) = axes(...
'units', 'normalized',...
'position', [0.2, 0.94, 0.15, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 9, MADATA, KEDATA));
% Rhomboid Minor
MAVisualisationAxis.Muscle(10,1) = axes(...
'units', 'normalized',...
'position', [0.35, 0.009, 0.15, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 10, MADATA, KEDATA));
% Rhomboid Major (T1 - T2)
MAVisualisationAxis.Muscle(11,1) = axes(...
'units', 'normalized',...
'position', [0.5, 0.009, 0.15, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 11, MADATA, KEDATA));
% Rhomboid Major (T3 - T4)
MAVisualisationAxis.Muscle(12,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.009, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 12, MADATA, KEDATA));
% Pectoralis Minor
MAVisualisationAxis.Muscle(13,1) = axes(...
'units', 'normalized',...
'position', [0, 0.83, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 13, MADATA, KEDATA));
% Pectoralis Major (Clavicular)
MAVisualisationAxis.Muscle(14,1) = axes(...
'units', 'normalized',...
'position', [0.2, 0.009, 0.15, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 14, MADATA, KEDATA));
% Pectoralis Major (Sternal)
MAVisualisationAxis.Muscle(15,1) = axes(...
'units', 'normalized',...
'position', [0, 0.0640, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 15, MADATA, KEDATA));
% Pectoralis Major (Ribs)
MAVisualisationAxis.Muscle(16,1) = axes(...
'units', 'normalized',...
'position', [0, 0.009, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 16, MADATA, KEDATA));
% Latissimus Doris (Thoracic)
MAVisualisationAxis.Muscle(17,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.6650, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 17, MADATA, KEDATA));
% Latissimus Doris (Lumbar)
MAVisualisationAxis.Muscle(18,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.61, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 18, MADATA, KEDATA));
% Latissimus Doris (Iliae)
MAVisualisationAxis.Muscle(19,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.555, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 19, MADATA, KEDATA));
% Deltoid (Anterior)
MAVisualisationAxis.Muscle(20,1) = axes(...
'units', 'normalized',...
'position', [0, 0.335, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 20, MADATA, KEDATA));
% Deltoid (Middle)
MAVisualisationAxis.Muscle(21,1) = axes(...
'units', 'normalized',...
'position', [0, 0.39, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 21, MADATA, KEDATA));
% Deltoid (Posterior)
MAVisualisationAxis.Muscle(22,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.83, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 22, MADATA, KEDATA));
% Supraspinatus
MAVisualisationAxis.Muscle(23,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.39, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 23, MADATA, KEDATA));
% Infraspinatus
MAVisualisationAxis.Muscle(24,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.335, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 24, MADATA, KEDATA));
% Subscapularis
MAVisualisationAxis.Muscle(25,1) = axes(...
'units', 'normalized',...
'position', [0, 0.8850, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 25, MADATA, KEDATA));
% Teres Minor
MAVisualisationAxis.Muscle(26,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.28, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 26, MADATA, KEDATA));
% Teres Major
MAVisualisationAxis.Muscle(27,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.225, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 27, MADATA, KEDATA));
% Coracobrachialis
MAVisualisationAxis.Muscle(28,1) = axes(...
'units', 'normalized',...
'position', [0, 0.7750, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 28, MADATA, KEDATA));
% Triceps Brachii Long
MAVisualisationAxis.Muscle(29,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.7750, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 29, MADATA, KEDATA));
% Triceps Brachii Medial
MAVisualisationAxis.Muscle(30,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.17, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 30, MADATA, KEDATA));
% Triceps Brachii Lateral
MAVisualisationAxis.Muscle(31,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.72, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 31, MADATA, KEDATA));
% Biceps Brachii Short
MAVisualisationAxis.Muscle(32,1) = axes(...
'units', 'normalized',...
'position', [0, 0.225, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 32, MADATA, KEDATA));
% Biceps Brachii Long
MAVisualisationAxis.Muscle(33,1) = axes(...
'units', 'normalized',...
'position', [0, 0.28, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 33, MADATA, KEDATA));
% Brachialis
MAVisualisationAxis.Muscle(34,1) = axes(...
'units', 'normalized',...
'position', [0, 0.61, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 34, MADATA, KEDATA));
% Brachioradialis
MAVisualisationAxis.Muscle(35,1) = axes(...
'units', 'normalized',...
'position', [0, 0.17, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 35, MADATA, KEDATA));
% Supinator
MAVisualisationAxis.Muscle(36,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.0640, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 36, MADATA, KEDATA));
% Pronator Teres
MAVisualisationAxis.Muscle(37,1) = axes(...
'units', 'normalized',...
'position', [0, 0.5, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 37, MADATA, KEDATA));
% Flexor Carpi Radialis
MAVisualisationAxis.Muscle(38,1) = axes(...
'units', 'normalized',...
'position', [0, 0.1190, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 38, MADATA, KEDATA));
% Flexor Carpi Ulnaris
MAVisualisationAxis.Muscle(39,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.445, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 39, MADATA, KEDATA));
% Extensor Carpi Radialis Long
MAVisualisationAxis.Muscle(40,1) = axes(...
'units', 'normalized',...
'position', [0, 0.555, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 40, MADATA, KEDATA));
% Extensor Carpi Radialis Brevis
MAVisualisationAxis.Muscle(41,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.1190, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 41, MADATA, KEDATA));
% Extensor Carpi Ulnaris
MAVisualisationAxis.Muscle(42,1) = axes(...
'units', 'normalized',...
'position', [0.65, 0.5, 0.2, 0.055],...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', 42, MADATA, KEDATA));
% Create a help
MAGUIHandle.Help(1,1) = uimenu(MAHandle,...
'label', 'MOMENT-ARMS GUI HELP');
MAGUIHandle.Help(2,1) = uimenu(MAGUIHandle.Help(1,1),...
'label', 'About?',...
'callback', MOMENT_ARM_TOOL_script_generator('Help'));
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% INITIALISATION CODE
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Set the current axes
set(MAHandle, 'currentaxes', MAVisualisationAxis.Central);
% Get the current file path
Cpath = pwd;
% Differentiate for non unix systems
if isunix
Cpath = [Cpath, '/LOGOS/MusclesFigure2.png'];
else
Cpath = [Cpath, '\LOGOS\MusclesFigure2.png'];
end
% Load the image of the muscles
Image = imread(Cpath);
image(Image)
set(gca, 'xcolor', 'white','ycolor', 'white');
%--------------------------------------------------------------------------
% Compute the moment arms
%--------------------------------------------------------------------------
% Create a waitbar to let the user know what's taking so long
WBHandle = waitbar(0,'Computing Moment-Arms, please wait...');
MADATA = MOMENT_ARM_TOOL_compute_all(MWDATA, BLDATA, KEDATA, WBHandle);
delete(WBHandle);
% Define a time vector for plotting the lengths in the axes
Time = linspace(0, 1, size(KEDATA.Joint_Angle_Evolution,2));
% Legend List
LegendList = {...
'Subclavius',...
'Serratus Anterior (Sup.)',...
'Serratus Anterior (Mid.)',...
'Serratus Anterior (Inf.)',...
'Trapezius (C1 - C6)',...
'Trapezius (C7)',...
'Trapezius (T1 - T2)',...
'Trapezius (T3 - T7)',...
'Levator Scapulae',...
'Rhomboid Minor',...
'Rhomboid Major (T1-T2)',...
'Rhomboid Major (T3-T4)',...
'Pectoralis Minor',...
'Pectoralis Major (Clavicula)',...
'Pectoralis Major (Sternal)',...
'Pectoralis Major (Ribs)',...
'Latissimus Dorsi (Thoracic)',...
'Latissimus Dorsi (Lumbar)',...
'Latissimus Dorsi (Iliae)',...
'Deltoid (Anterior)',...
'Deltoid (Middle)',...
'Deltoid (Posterior)',...
'Supraspinatus',...
'Infraspinatus',...
'Subscaularis',...
'Teres Minor',...
'Teres Major',...
'Coracobrachialis',...
'Triceps Brachii Long',...
'Triceps Brachii Medial',...
'Triceps Brachii Lateral',...
'Biceps Brachii Short',...
'Biceps Brachii Long',...
'Brachialis',...
'Brachioradialis',...
'Supinator',...
'Pronator Teres',...
'Flexor Carpi Radialis',...
'Flexor Carpi Ulnaris',...
'Extensor Carpi Radialis Long',...
'Extensor Carpi Radialis Brevis',...
'Extensor Carpi Ulnaris'};
% Set all the visualisation
for MuscleId = 1:42
% Set the current axis
set(MAHandle, 'currentaxes', MAVisualisationAxis.Muscle(MuscleId,1));
% Create the plot
plot(Time', MADATA{MuscleId, 1}.MuscleLength(:,1), 'color', 'red', 'linewidth', 1);
%plot(Time', MADATA{MuscleId, 1}.MomentArms{1,1}(:,7:9), 'color', 'red', 'linewidth', 1);
% The axis properties must be reset.
set(gca,...
'xtick', [],...
'ytick', [],...
'box', 'on',...
'buttondownfcn', MOMENT_ARM_TOOL_script_generator('View Data', MuscleId));
legend(LegendList{1,MuscleId});
end

Event Timeline