Switch to unified view

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