-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsaveMap.m
72 lines (67 loc) · 3 KB
/
saveMap.m
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
function saveMap(subject, trial, heatmap, img, type)
%SAVEMAP Save the heat map to the appropriate directory
settings;
addDir = '';
suffix = '.png';
if ~strcmp(DISTINGUISH, '')
if RENDER == OBJECT
if strcmp(DISTINGUISH, 'correct')
word = 'correct_incorrect';
elseif strcmp(DISTINGUISH, 'same')
word = 'same_different';
end
else
word = DISTINGUISH;
end
addDir = [word, '/'];
suffix = ['_', word, '.png'];
end
clear word;
subjectDir = [subject, '/'];
switch RENDER
case TRIAL
dir = [HEATMAP_DIRECTORY, subjectDir, TRIAL_DIRECTORY, ...
int2str(trial.objectSet), '_', ...
int2str(trial.leftObject), '_', ...
int2str(trial.rightObject), '/'];
createDir(dir);
filename = [dir, 'trial_', int2str(trial.trialNum), suffix];
imwrite(heatmap, filename);
case PAIR
dir = [HEATMAP_DIRECTORY, subjectDir, PAIR_DIRECTORY, addDir];
createDir(dir);
filename = [dir, int2str(trial.objectSet), '_', ...
int2str(trial.leftObject), '_', ...
int2str(trial.rightObject), suffix];
imwrite(heatmap, filename);
case OBJECT
if USE_MAP == COLOR_MAP
dir = [HEATMAP_DIRECTORY, subjectDir, OBJECT_DIRECTORY, addDir];
createDir(dir);
if strcmp(type, 'LEFT')
filename = [dir, int2str(trial.objectSet), '_', ...
int2str(trial.leftObject), suffix];
elseif strcmp(type, 'RIGHT')
filename = [dir, int2str(trial.objectSet), '_', ...
int2str(trial.rightObject), suffix];
elseif strcmp(type, 'EITHER')
filename = [dir, int2str(trial.objectSet), '_', ...
int2str(trial.leftObject), suffix];
end
imwrite(heatmap, filename);
elseif USE_MAP == CURVE_MAP
dir = [HEATMAP_DIRECTORY, subjectDir, OBJECT_DIRECTORY, CURVE_DIRECTORY];
createDir(dir);
filename = [dir, 'curvemap_', int2str(trial.objectSet), '_', ...
int2str(trial.leftObject), suffix];
imwrite(img, filename, 'Alpha', heatmap);
elseif USE_MAP == NORMAL_MAP
dir = [HEATMAP_DIRECTORY, subjectDir, OBJECT_DIRECTORY, NORMAL_DIRECTORY];
createDir(dir);
filename = [dir, 'normalmap_', int2str(trial.objectSet), '_', ...
int2str(trial.leftObject), suffix];
imwrite(img, filename, 'Alpha', heatmap);
end
end
clear trial heatmap type addDir suffix dir filename;
end