Christoph Budziszewski commited on 2009-05-03 04:08:13
Zeige 4 geänderte Dateien mit 46 Einfügungen und 23 Löschungen.
git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@191 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... | ... |
@@ -16,6 +16,8 @@ end |
16 | 16 |
function preprocess(model,task) |
17 | 17 |
% parse the GUI and pass parameters as structure |
18 | 18 |
|
19 |
+evalin('base','clear(''preprocessedData'')'); |
|
20 |
+ |
|
19 | 21 |
timeLine = getTimeLineParams(model); |
20 | 22 |
subjects = getSubjectCellList(model); |
21 | 23 |
classDef = parseClassDef(model); |
... | ... |
@@ -112,7 +114,7 @@ if(~(isa(preprocessedData,'struct'))) |
112 | 114 |
display('you need to preprocess some data before this step'); |
113 | 115 |
return |
114 | 116 |
end |
115 |
- |
|
117 |
+warn = warning('off','all'); |
|
116 | 118 |
header = preprocessedData.header; |
117 | 119 |
header.frameShift = getFrameShiftParams(model); |
118 | 120 |
data = preprocessedData.subjectdata; |
... | ... |
@@ -163,8 +165,8 @@ switch task |
163 | 165 |
|
164 | 166 |
end |
165 | 167 |
|
166 |
-% disp('warings restored'); |
|
167 |
-% warning('on',warn); |
|
168 |
+disp('warings restored'); |
|
169 |
+warning(warn); |
|
168 | 170 |
end |
169 | 171 |
|
170 | 172 |
function decode_plot(model,type) |
... | ... |
@@ -1,7 +1,8 @@ |
1 | 1 |
function output = runFBSImageMaskMode(header,subjectdata,fbsargs) |
2 | 2 |
addpath('NIFTI_20090325'); |
3 | 3 |
|
4 |
-DEBUG = 1; |
|
4 |
+DEBUG = 0; |
|
5 |
+NORM_DECODE = 0; % 1: normalize to [-1:1], 0: normalize to [0:1] |
|
5 | 6 |
|
6 | 7 |
savePath = fullfile('output',datestr(now,30)); |
7 | 8 |
mkdir(savePath); |
... | ... |
@@ -196,7 +197,6 @@ for timeShiftIdx = fbsTimeLine |
196 | 197 |
svmdata = svmdata(rndindex,:); |
197 | 198 |
svmlabel = svmlabel(rndindex); |
198 | 199 |
end |
199 |
- decode = 0; |
|
200 | 200 |
decode = svm_single_crossval(svmlabel,svmdata,svmopts); |
201 | 201 |
% save the decode value to the corresponding coordinate |
202 | 202 |
|
... | ... |
@@ -205,7 +205,12 @@ for timeShiftIdx = fbsTimeLine |
205 | 205 |
y = coord(2); |
206 | 206 |
z = coord(3); |
207 | 207 |
|
208 |
+ if NORM_DECODE |
|
208 | 209 |
img3D{rIdx}(x,y,z) = ((decode/100)-0.5)*2; % range [-1:1] |
210 |
+ else |
|
211 |
+ img3D{rIdx}(x,y,z) = (decode/100); % range [0:1] |
|
212 |
+ end |
|
213 |
+ |
|
209 | 214 |
|
210 | 215 |
end %for each radius |
211 | 216 |
end %for each voxel |
... | ... |
@@ -17,6 +17,9 @@ DEFAULT.svmnfold = '6'; |
17 | 17 |
DEFAULT.svmrnd = 1; |
18 | 18 |
DEFAULT.searchlightradius = 3; |
19 | 19 |
DEFAULT.searchlightTimeline = ''; |
20 |
+DEFAULT.somM = 3; |
|
21 |
+DEFAULT.somN = 3; |
|
22 |
+DEFAULT.somLattice = 1; |
|
20 | 23 |
|
21 | 24 |
|
22 | 25 |
DEFAULT.wd = fullfile('d:','Analyze','Choice','24pilot'); |
... | ... |
@@ -339,13 +342,25 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.4 0.5 0.4]); |
339 | 342 |
set(pSOM,'Title','SOM Classification'); |
340 | 343 |
set(pSOM,'BackgroundColor',basecolor); |
341 | 344 |
|
342 |
- model.txtSOMopts = createTextField(pSOM,[0 0.75 1 0.25],'3x3 rect'); |
|
343 |
- set(model.txtSOMopts,'HorizontalAlignment','left'); |
|
344 |
- set(model.txtSOMopts,'Enable','off'); |
|
345 |
+ createLabel(pSOM,[0 0.75 0.3 0.20],'Size:'); |
|
346 |
+ model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.2],DEFAULT.somM); |
|
347 |
+ somsizemal = createLabel(pSOM,[0.55 0.75 0.2 0.20],'x'); |
|
348 |
+ set(somsizemal,'HorizontalAlignment','center'); |
|
349 |
+ model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.20],DEFAULT.somN); |
|
350 |
+ |
|
351 |
+ latticeModel = {'rect','hexa'}; |
|
352 |
+ model.selSomLattice = uicontrol(pSOM,'Style','popupmenu',... |
|
353 |
+ 'Units','normalized',... |
|
354 |
+ 'Position',[0.0 0.5 0.3 0.20],... |
|
355 |
+ 'String',latticeModel,... |
|
356 |
+ 'UserData',latticeModel,... |
|
357 |
+ 'Value',1); |
|
358 |
+ set(model.selSomLattice,'BackgroundColor','w'); |
|
359 |
+ |
|
360 |
+ model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.20],DEFAULT.svmnfold); |
|
361 |
+% set(model.txtSOMnfold,'Enable','off'); |
|
362 |
+ createLabel(pSOM,[0.75 0.5 0.25 0.20 ],'-Fold CrossVal'); |
|
345 | 363 |
|
346 |
- model.txtSOMnfold = createTextField(pSOM,[0.0 0.50 0.5 0.25],DEFAULT.svmnfold); |
|
347 |
- set(model.txtSOMnfold,'Enable','off'); |
|
348 |
- createLabel(pSOM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal'); |
|
349 | 364 |
|
350 | 365 |
btnRunSOM = uicontrol(pSOM,'String','run SOM Crossvalidation',... |
351 | 366 |
'Units','normalized',... |
... | ... |
@@ -357,14 +372,14 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.4 0.5 0.4]); |
357 | 372 |
'Position',[0.0 0.0 1 0.25]); |
358 | 373 |
set(btnRunXSOM,'Enable','on'); |
359 | 374 |
|
360 |
-pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 1 0.3]); |
|
375 |
+pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3]); |
|
361 | 376 |
set(pSearchlight,'Title','Spatiotemporal FB classification'); |
362 | 377 |
set(pSearchlight,'BackgroundColor',basecolor); |
363 | 378 |
|
364 | 379 |
lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius'); |
365 | 380 |
model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],DEFAULT.searchlightradius); |
366 | 381 |
|
367 |
- lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'''); |
|
382 |
+ lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'')'); |
|
368 | 383 |
model.txtSearchlightTimeline = createTextField(pSearchlight,[0.5 0.3 0.5 0.3],DEFAULT.searchlightTimeline); |
369 | 384 |
|
370 | 385 |
btnRunFBS = uicontrol(pSearchlight,'String','run Spatiotemporal FB classification',... |
... | ... |
@@ -389,17 +404,23 @@ function model = createVisualStepPanel(model,parent,DEFAULT) |
389 | 404 |
plot_grid{1,1} = [0.0 0.63 grid_w grid_h]; |
390 | 405 |
plot_grid{1,2} = [0.0 0.33 grid_w grid_h]; |
391 | 406 |
plot_grid{1,3} = [0.0 0.03 grid_w grid_h]; |
392 |
- plot_grid{2,1} = [0.5 0.63 grid_w grid_h]; |
|
393 |
- plot_grid{2,2} = [0.5 0.33 grid_w grid_h]; |
|
394 |
- plot_grid{2,3} = [0.5 0.03 grid_w grid_h]; |
|
407 |
+ plot_grid{2,1} = [0.25 0.63 grid_w grid_h]; |
|
408 |
+ plot_grid{2,2} = [0.25 0.33 grid_w grid_h]; |
|
409 |
+ plot_grid{2,3} = [0.25 0.03 grid_w grid_h]; |
|
395 | 410 |
|
396 | 411 |
pButtonPane = uipanel(parent,'Units','normalized','Position',[0 0.5 1 0.5]); |
397 | 412 |
% set(pButtonPane,'Title','Plot'); |
398 | 413 |
set(pButtonPane,'BackgroundColor','w'); |
399 | 414 |
|
415 |
+ btnPlot03 = uicontrol(pButtonPane,'String','plot PSTH',... |
|
416 |
+ 'Units','normalized',... |
|
417 |
+ 'Position',cell2mat(plot_grid(2,1))); |
|
418 |
+ set(btnPlot03,'Callback',{@cbPlot,model,'psth'}); |
|
419 |
+ set(btnPlot03,'Enable','on'); |
|
420 |
+ |
|
400 | 421 |
btnPlot01 = uicontrol(pButtonPane,'String','plot performance and SE',... |
401 | 422 |
'Units','normalized',... |
402 |
- 'Position',cell2mat(plot_grid(1,3))); |
|
423 |
+ 'Position',cell2mat(plot_grid(2,2))); |
|
403 | 424 |
set(btnPlot01,'Callback',{@cbPlot,model,'simple'}); |
404 | 425 |
set(btnPlot01,'Enable','on'); |
405 | 426 |
|
... | ... |
@@ -409,11 +430,6 @@ function model = createVisualStepPanel(model,parent,DEFAULT) |
409 | 430 |
set(btnPlot02,'Callback',{@cbPlot,model,'x-subject-val'}); |
410 | 431 |
set(btnPlot02,'Enable','on'); |
411 | 432 |
|
412 |
- btnPlot03 = uicontrol(pButtonPane,'String','plot PSTH',... |
|
413 |
- 'Units','normalized',... |
|
414 |
- 'Position',cell2mat(plot_grid(1,2))); |
|
415 |
- set(btnPlot03,'Callback',{@cbPlot,model,'psth'}); |
|
416 |
- set(btnPlot03,'Enable','on'); |
|
417 | 433 |
|
418 | 434 |
end |
419 | 435 |
|
420 | 436 |