[8406bc]: / MATLAB / plotManualLandmarks.m

Download this file

85 lines (76 with data), 2.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
% PLOTMANUALLANDMARKS plots the manually selected landmarks.
%
% AUTHOR: Maximilian C. M. Fischer
% COPYRIGHT (C) 2019-2023 Maximilian C. M. Fischer
% LICENSE: EUPL v1.2
%
clearvars; close all
addpath(genpath('src'))
% Select the bone
bone = 'Femur'; % 'Pelvis' or 'Femur'
% Select subjects of the VSD
files=dir(['..\ManualLandmarks\' bone '\*.mat']);
load(fullfile(files(1).folder, files(1).name),'Results')
switch bone
case 'Pelvis'
Subjects = Results(:,5);
case 'Femur'
Subjects = Results(:,5:6);
end
% Number of Rater
NoR=length(files);
Rater=cell(NoR,1);
for r=1:NoR
load(fullfile(files(r).folder, files(r).name),'Results')
Rater{r} = Results;
clearvars Results
end
RaterNames=cellfun(@(x) strrep(x, '.mat', ''), {files.name},'uni',0);
% Number of Subjects
NoS = size(Rater{1,1},1);
% Number of Trials
NoT = sum(all(~cellfun(@ischar, Rater{1,1}),1));
% Number of Landmarks
NoL = size(Rater{1,1}{1,1},1);
% Reshape results of the raters to manuLM cell
manuLM_CT_Cell=cell(NoL,NoS,NoR,NoT);
for l=1:NoL
for s=1:NoS
for r=1:NoR
for t=1:NoT
manuLM_CT_Cell{l,s,r,t}=Rater{r}{s,t}{l,2};
end
end
end
end
% Visualize subjects in the CT coordinate system
cMapLM=lines(NoL);
markerR={'o','s','d','p','h'};
for s=1:NoS
name = Subjects{s,1};
% Load surface data
load(['..\Bones\' name '.mat'], 'B')
switch bone
case 'Pelvis'
mesh = concatenateMeshes(B(1:3).mesh);
case 'Femur'
side = Subjects{s,2};
mesh = B(ismember({B.name}, ['Femur_' side])).mesh;
end
% Construct pelvis and visualize
[~, axH, figH] = visualizeMeshes(mesh);
set(figH,'NumberTitle','off', 'Name',['Subject: ' name])
anatomicalViewButtons(axH,'LPS')
for r=1:NoR
for t=1:NoT
for l=1:NoL
% Draw manual identified landmarks with a different marker
% style for each rater
drawPoint3d(axH, manuLM_CT_Cell{l,s,r,t}, 'Marker', markerR{r},...
'MarkerFaceColor', cMapLM(l,:), 'MarkerEdgeColor', 'k');
end
end
end
end
% [List.f, List.p] = matlab.codetools.requiredFilesAndProducts([mfilename '.m']);
% List.f = List.f'; List.p = List.p';