-
Notifications
You must be signed in to change notification settings - Fork 0
/
MF3D_PlotStimImages.m
127 lines (116 loc) · 5.69 KB
/
MF3D_PlotStimImages.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
if ismac
Append = '/Volumes';
end
StimDir = fullfile(Append, 'projects/murphya/MacaqueFace3D/BlenderFiles/Renders/Monkey_1/');
%========== Plot stimulus images for Exp. 1/ 2
Subject = 'Matcha';
Date = '20160615';
TimingData = fullfile(Append, '/procdata/murphya/Physio/StereoFaces/Timing/StereoFaces/',sprintf('StimTimes_%s_%s.mat', Subject, Date));
load(TimingData)
ImCrop = [650, 200]; % Number of pixels to crop from each edge in X and Y
figure('position', [-1911, 168, 1799, 840]);
Axh = tight_subplot(3,7,0, 0,0);
AxIndx = 1;
Dist = 1;
Scale = 1;
for el = 1:numel(Params.Elevations)
for az = 1:numel(Params.Azimuths)
Cond = find(ismember(Params.ConditionMatrix, [1, az, el, Dist, Scale],'rows'));
axes(Axh(AxIndx));
[Im, cm, Alpha] = imread(fullfile(StimDir, Params.Filenames{Cond}));
Imsize = size(Im);
Im = Im(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)),:);
Alpha = Alpha(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)));
imh(Cond) = image(Im);
alpha(imh(Cond), Alpha);
axis tight equal off
AxIndx = AxIndx+1;
end
end
% export_fig('/Volumes/projects/murphya/MacaqueFace3D/PilotData/PNGs/OrientStim_Fear.png', '-png','-transparent');
%========== Plot stimulus images for Exp. 3
Subject = 'Avalanche';
Date = '20160630';
TimingData = fullfile(Append, '/procdata/murphya/Physio/StereoFaces/Timing/StereoFaces/',sprintf('StimTimes_%s_%s.mat', Subject, Date));
load(TimingData)
ImCrop = [650, 100]; % Number of pixels to crop from each edge in X and Y
Dist = 1;
Scale = 1;
for exp = 1:numel(Params.Expressions)
figure('position', [-1911, 168, 786, 840]);
Axh = tight_subplot(3,3,0, 0,0);
AxIndx = 1;
for el = 1:numel(Params.Elevations)
for az = 1:numel(Params.Azimuths)
Cond = find(ismember(Params.ConditionMatrix, [exp, az, el, Dist, Scale, 1],'rows'));
axes(Axh(AxIndx));
[Im, cm, Alpha] = imread(fullfile(StimDir, Params.Filenames{Cond}));
Imsize = size(Im);
Im = Im(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)),:);
Alpha = Alpha(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)));
imh(Cond) = image(Im);
alpha(imh(Cond), Alpha);
axis tight equal off
AxIndx = AxIndx+1;
end
end
export_fig(fullfile('/Volumes/projects/murphya/MacaqueFace3D/PilotData/PNGs/',sprintf('OrientStim3x3_%s.png',Params.Expressions{exp})), '-png','-transparent');
end
%========== Plot stimulus images for Exp. 4
Subject = 'Avalanche';
Date = '20160712';
StimDir = fullfile(Append, 'projects/murphya/MacaqueFace3D/BlenderFiles/Renders/');
TimingData = fullfile(Append, '/procdata/murphya/Physio/StereoFaces/Timing/StereoFaces/',sprintf('StimTimes_%s_%s.mat', Subject, Date));
load(TimingData)
ImCrop = [650, 100]; % Number of pixels to crop from each edge in X and Y
Scale = 1;
Dist = 1;
for id = 1:numel(Params.MonkeyIDs)
figure('position', [-1911, 168, 786, 840]);
Axh = tight_subplot(3,3,0, 0,0);
AxIndx = 1;
for el = 1:numel(Params.Elevations)
for az = 1:numel(Params.Azimuths)
Cond = find(ismember(Params.ConditionMatrix, [id, az, el, Dist, Scale],'rows'));
axes(Axh(AxIndx));
[Im, cm, Alpha] = imread(fullfile(StimDir, sprintf('Monkey_%d', id), Params.Filenames{Cond}));
Imsize = size(Im);
Im = Im(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)),:);
Alpha = Alpha(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)));
imh(Cond) = image(Im);
alpha(imh(Cond), Alpha);
axis tight equal off
AxIndx = AxIndx+1;
end
end
export_fig(fullfile('/Volumes/projects/murphya/MacaqueFace3D/PilotData/PNGs/',sprintf('MonkeyID_%d.png',id)), '-png','-transparent');
end
%========== Plot stimulus images for Exp. 5
Subject = 'Avalanche';
Date = '20160715';
StimDir = fullfile(Append, 'projects/murphya/Stimuli/BlenderRenders/HumanFaces/');
TimingData = fullfile(Append, '/procdata/murphya/Physio/StereoFaces/Timing/StereoFaces/',sprintf('StimTimes_%s_%s.mat', Subject, Date));
load(TimingData);
ImCrop = [500, 100]; % Number of pixels to crop from each edge in X and Y
Scale = 1;
Dist = 1;
for id = 1:numel(Params.MonkeyIDs)
figure('position', get(0,'Screensize'));
Axh = tight_subplot(numel(Params.Elevations),numel(Params.Azimuths),0, 0,0);
AxIndx = 1;
for el = 1:numel(Params.Elevations)
for az = 1:numel(Params.Azimuths)
Cond = find(ismember(Params.ConditionMatrix, [id, az, el, Dist, Scale],'rows'));
axes(Axh(AxIndx));
[Im, cm, Alpha] = imread(fullfile(StimDir, Params.Filenames{Cond}));
Imsize = size(Im);
Im = Im(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)),:);
Alpha = Alpha(ImCrop(2):(Imsize(1)-ImCrop(2)), ImCrop(1):((Imsize(2)/2)-ImCrop(1)));
imh(Cond) = image(Im);
alpha(imh(Cond), Alpha);
axis tight equal off
AxIndx = AxIndx+1;
end
end
export_fig(fullfile('/Volumes/projects/murphya/MacaqueFace3D/PilotExpStim/',sprintf('HumanID_%d.png',id)), '-png','-transparent');
end