Skip to content

Commit 86d2bba

Browse files
committed
scripts
1 parent 3cf454f commit 86d2bba

File tree

2 files changed

+42
-16
lines changed

2 files changed

+42
-16
lines changed

unused/get_labels_from_class.m

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
1-
ppath = 'C:\Users\Avgoustinos\Desktop\MWMGEN\tiago_original\segmentation';
2-
mclassification = 'C:\Users\Avgoustinos\Desktop\MWMGEN\tiago_original\Mclassification\class_1301_10388_250_07_10_10_mr0\merged_1.mat';
3-
output_file = 'C:\Users\Avgoustinos\Desktop\labels.csv';
4-
5-
files = dir(fullfile(ppath,'*.mat'));
6-
segmentations = cell(1,length(files));
7-
for i = 1:length(files)
8-
load(fullfile(ppath,files(i).name));
9-
segmentations{i} = segmentation_configs;
10-
end
11-
[output,~] = match_segments(segmentations);
1+
mclassification = 'I:\Documents\MWMGEN\tiago_original\Mclassification\class_2322_29476_250_09_10_10_mr0-correct2\merged_1.mat';
2+
output_file = 'I:\Documents\labels.csv';
123

134
load(mclassification);
14-
labels = classification_configs.CLASSIFICATION.class_map(output(:,2))';
15-
table = [num2cell(output(:,1)), num2cell(labels)];
5+
labels = classification_configs.CLASSIFICATION.class_map';
6+
segments = 1:length(labels);
7+
segments = segments';
8+
table = [num2cell(segments), num2cell(labels)];
169
tags = classification_configs.CLASSIFICATION_TAGS;
1710
for i = 1:size(table,1)
1811
if table{i,2} > 0
1912
table{i,2} = tags{table{i,2}}{1};
2013
else
21-
table{i,1} = [];
22-
table{i,2} = [];
14+
table{i,2} = 'UD';
2315
end
2416
end
25-
table(all(cellfun(@isempty,table),2),:) = [];
2617

2718
VariableNames = cell(1,length(tags)+2);
2819
VariableNames{1} = 'Segment';

unused/match_segments_test.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
ppath = 'I:\Documents\MWMGEN\tiago_original\segmentation';
2+
mclassification = 'I:\Documents\MWMGEN\tiago_original\Mclassification\class_2322_29476_250_09_10_10_mr0-correct2\merged_1.mat';
3+
output_file = 'I:\Documents\labels.csv';
4+
5+
files = dir(fullfile(ppath,'*.mat'));
6+
segmentations = cell(1,length(files));
7+
for i = 1:length(files)
8+
load(fullfile(ppath,files(i).name));
9+
segmentations{i} = segmentation_configs;
10+
end
11+
[output,~] = match_segments(segmentations);
12+
13+
load(mclassification);
14+
labels = classification_configs.CLASSIFICATION.class_map(output(:,2))';
15+
table = [num2cell(output(:,1)), num2cell(labels)];
16+
tags = classification_configs.CLASSIFICATION_TAGS;
17+
for i = 1:size(table,1)
18+
if table{i,2} > 0
19+
table{i,2} = tags{table{i,2}}{1};
20+
else
21+
table{i,1} = [];
22+
table{i,2} = [];
23+
end
24+
end
25+
table(all(cellfun(@isempty,table),2),:) = [];
26+
27+
VariableNames = cell(1,length(tags)+2);
28+
VariableNames{1} = 'Segment';
29+
for i = 2:length(VariableNames)
30+
VariableNames{i} = strcat('label',num2str(i-1));
31+
end
32+
table{1,length(VariableNames)} = [];
33+
table = cell2table(table,'VariableNames',VariableNames);
34+
writetable(table,output_file,'WriteVariableNames',1);
35+

0 commit comments

Comments
 (0)