32
32
% - n_rows : number of rows (in-plane resolution)
33
33
% - n_cols : number of columns (in-plance resolution)
34
34
% - n_slices : number of slices
35
- % - w_stimulus: width of stimulus images in pixels
36
- % - h_stimulus: height of stimulus images in pixels
35
+ % - r_stimulus: width/height of stimulus images in pixels
37
36
%
38
37
% optional inputs are
39
38
% - hrf : either a column vector containing a single hemodynamic
81
80
n_slices
82
81
n_total
83
82
l_hrf
84
- w_stimulus
85
- h_stimulus
83
+ r_stimulus
86
84
idx
87
85
ecc
88
86
pa
115
113
self.n_cols = p .Results .params .n_cols ;
116
114
self.n_slices = p .Results .params .n_slices ;
117
115
self.n_total = self .n_rows * self .n_cols * self .n_slices ;
118
- self.w_stimulus = p .Results .params .w_stimulus ;
119
- self.h_stimulus = p . Results . params . h_stimulus ;
116
+ self.r_stimulus = p .Results .params .r_stimulus ;
117
+
120
118
if ~isempty(p .Results .hrf )
121
119
self.l_hrf = size(p .Results .hrf ,1 );
122
120
if ndims(p .Results .hrf )>2
151
149
function stimulus = get_stimulus(self )
152
150
% returns the stimulus used by the class as a 3D matrix of
153
151
% dimensions height-by-width-by-time.
154
- stimulus = reshape(self .stimulus ,self .h_stimulus ,...
155
- self .w_stimulus ,self .n_samples );
152
+ stimulus = reshape(self .stimulus ,self .r_stimulus ,...
153
+ self .r_stimulus ,self .n_samples );
156
154
end
157
155
158
156
function tc = get_timecourses(self )
@@ -184,7 +182,7 @@ function set_stimulus(self,stimulus)
184
182
% (height-by-width-by-time) or 2D (height*width-by-time).
185
183
if ndims(stimulus )==3
186
184
self.stimulus = reshape(stimulus ,...
187
- self .w_stimulus * self . h_stimulus ,...
185
+ self .r_stimulus ^ 2 ,...
188
186
self .n_samples );
189
187
else
190
188
self.stimulus = stimulus ;
@@ -206,7 +204,7 @@ function import_stimulus(self)
206
204
wb = waitbar(0 ,text ,' Name' ,self .is );
207
205
208
206
im = imread([path ,files(1 ).name]);
209
- self.stimulus = zeros(self .h_stimulus ,self .w_stimulus ,...
207
+ self.stimulus = zeros(self .r_stimulus ,self .r_stimulus ,...
210
208
self .n_samples );
211
209
self .stimulus(: ,: ,1 ) = im(: ,: ,1 );
212
210
l = regexp(files(1 ).name,' \d' )-1 ;
@@ -225,7 +223,7 @@ function import_stimulus(self)
225
223
range = max(self .stimulus(: ))-mn ;
226
224
227
225
self.stimulus = (reshape(self .stimulus ,...
228
- self .w_stimulus * self . h_stimulus ,...
226
+ self .r_stimulus ^ 2 ,...
229
227
self .n_samples )-mn )/range ;
230
228
close(wb )
231
229
fprintf(' done\n ' );
@@ -239,52 +237,58 @@ function create_timecourses(self,varargin)
239
237
%
240
238
% optional inputs are
241
239
% - max_radius : radius of the field of fiew (default = 10.0)
242
- % - number_XY : steps in x and y direction (default = 30.0)
240
+ % - num_xy : steps in x and y direction (default = 30.0)
243
241
% - min_slope : lower bound of RF size slope (default = 0.1)
244
242
% - max_slope : upper bound of RF size slope (default = 1.2)
245
- % - number_slope : steps from lower to upper bound (default = 10.0)
243
+ % - num_slope : steps from lower to upper bound (default = 10.0)
246
244
247
245
text = ' creating timecourses...' ;
248
246
fprintf(' %s\n ' ,text )
249
247
wb = waitbar(0 ,text ,' Name' ,self .is );
250
248
251
249
p = inputParser ;
252
- addOptional(p ,' number_XY ' ,30 );
250
+ addOptional(p ,' num_xy ' ,30 );
253
251
addOptional(p ,' max_radius' ,10 );
254
- addOptional(p ,' number_slope ' ,10 );
252
+ addOptional(p ,' num_slope ' ,10 );
255
253
addOptional(p ,' min_slope' ,0.1 );
256
254
addOptional(p ,' max_slope' ,1.2 );
255
+ addoptional(p ,' css_exponent' ,1 );
256
+ addoptional(p ,' sampling' ,' log' );
257
257
p .parse(varargin{: });
258
258
259
- n_xy = p .Results .number_XY ;
259
+ num_xy = p .Results .num_xy ;
260
260
max_r = p .Results .max_radius ;
261
- n_slope = p .Results .number_slope ;
261
+ num_slope = p .Results .num_slope ;
262
262
min_slope = p .Results .min_slope ;
263
263
max_slope = p .Results .max_slope ;
264
- self.n_points = n_xy ^ 2 * n_slope ;
264
+ css_exponent = p .Results .css_exponent ;
265
+ sampling = p .Results .sampling ;
266
+ self.n_points = num_xy ^ 2 * num_slope ;
265
267
266
- X_ = ones(self .h_stimulus ,1 ) * linspace(-max_r ,...
267
- max_r ,self .w_stimulus );
268
+ X_ = ones(self .r_stimulus ,1 ) * linspace(-max_r ,...
269
+ max_r ,self .r_stimulus );
268
270
Y_ = - linspace(-max_r ,max_r ,...
269
- self .h_stimulus )' * ones(1 ,self .w_stimulus );
271
+ self .r_stimulus )' * ones(1 ,self .r_stimulus );
270
272
271
- X_ = reshape(X_ ,self .w_stimulus * self . h_stimulus ,1 );
272
- Y_ = reshape(Y_ ,self .w_stimulus * self . h_stimulus ,1 );
273
+ X_ = reshape(X_ ,self .r_stimulus ^ 2 ,1 );
274
+ Y_ = reshape(Y_ ,self .r_stimulus ^ 2 ,1 );
273
275
274
276
i = (0 : self .n_points - 1 )' ;
275
- self.idx = [floor(i /(n_xy * n_slope ))+1 ,...
276
- mod(floor(i /(n_slope )),n_xy )+1 ,...
277
- mod(i ,n_slope )+1 ];
277
+ self.idx = [floor(i /(num_xy * num_slope ))+1 ,...
278
+ mod(floor(i /(num_slope )),num_xy )+1 ,...
279
+ mod(i ,num_slope )+1 ];
280
+
281
+ if strcmp(sampling ,' log' )
282
+ self.ecc = exp(linspace(log(.1 ),log(max_radius ),num_xy ));
283
+ elseif strcmp(sampling ,' linear' )
284
+ self.ecc = linspace(.1 ,max_radius ,num_xy );
285
+ end
278
286
279
- n_lower = ceil(n_xy / 2 );
280
- n_upper = floor(n_xy / 2 );
281
- self.ecc = exp([linspace(log(max_r ),log(.1 ),n_lower ),...
282
- linspace(log(.1 ),log(max_r ),n_upper )]);
283
- self.pa = linspace(0 ,(n_xy - 1 )/n_xy * 2 * pi ,n_xy );
284
- self.slope = linspace(min_slope ,max_slope ,n_slope );
287
+ self.pa = linspace(0 ,(num_xy - 1 )/num_xy * 2 * pi ,num_xy );
288
+ self.slope = linspace(min_slope ,max_slope ,num_slope );
285
289
286
290
W = single(zeros(self .n_points ,...
287
- self .w_stimulus * self . h_stimulus ));
291
+ self .r_stimulus ^ 2 ));
288
292
for j= 1 : self .n_points
289
293
x = cos(self .pa(self .idx(j ,1 ))) * self .ecc(self .idx(j ,2 ));
290
294
y = sin(self .pa(self .idx(j ,1 ))) * self .ecc(self .idx(j ,2 ));
@@ -293,7 +297,7 @@ function create_timecourses(self,varargin)
293
297
waitbar(j / self .n_points *.9 ,wb );
294
298
end
295
299
296
- tc = W * self .stimulus ;
300
+ tc = ( W * self .stimulus ).^ css_exponent ;
297
301
waitbar(1 ,wb );
298
302
self.tc_fft = fft(tc ' );
299
303
close(wb )
0 commit comments