started save/load functionality.
Christoph Budziszewski

Christoph Budziszewski commited on 2009-02-18 15:59:39
Zeige 6 geänderte Dateien mit 78 Einfügungen und 18 Löschungen.


git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@132 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... ...
@@ -0,0 +1,5 @@
1
+function scell = getSubjectCellList(model)
2
+list = get(model.subjectSelector,'UserData');
3
+sel = get(model.subjectSelector,'Value');
4
+scell = list(sel);
5
+end
0 6
\ No newline at end of file
... ...
@@ -0,0 +1,11 @@
1
+% generate parameter structs for subroutines
2
+function timelineParams = getTimeLineParams(paramModel)
3
+timelineParams = struct;
4
+timelineParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
5
+timelineParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
6
+timelineParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
7
+timelineParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
8
+timelineParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
9
+timelineParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
10
+timelineParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;
11
+end
... ...
@@ -15,18 +15,6 @@ end
15 15
 
16 16
 
17 17
 
18
-% generate parameter structs for subroutines
19
-function timelineParams = getTimeLineParams(paramModel)
20
-timelineParams = struct;
21
-timelineParams.frameShiftStart = getDouble(paramModel.txtFrameShiftStart);  % -20;
22
-timelineParams.frameShiftEnd   = getDouble(paramModel.txtFrameShiftEnd); %15;
23
-timelineParams.decodeDuration  = getDouble(paramModel.txtFrameShiftDur);
24
-timelineParams.psthStart       = getDouble(paramModel.txtPSTHStart); % -25;
25
-timelineParams.psthEnd         = getDouble(paramModel.txtPSTHEnd); % 20;
26
-timelineParams.baselineStart   = getDouble(paramModel.txtBaselineStart); % -22;
27
-timelineParams.baselineEnd     = getDouble(paramModel.txtBaselineEnd); % -20;
28
-
29
-end
30 18
 
31 19
 
32 20
 
... ...
@@ -1,7 +1,4 @@
1
-function runROIImageMaskMode(timeline,parameterModel)
2
-        loadParams.StudyID = 'CHOICE24';
3
-        loadParams.use_smoothed_image_hack = 1;
4
-        loadParams.subjectCellArray = getSubjectIDString(parameterModel);
1
+function runROIImageMaskMode(subjects,timeline)
5 2
 
6 3
         imageStruct = loadImageFileNamesData(loadParams);
7 4
         assignin('base','imageStruct',imageStruct);
... ...
@@ -0,0 +1,12 @@
1
+% generate parameter structs for subroutines
2
+function model = setTimeLineParams(model,paramStruct)
3
+
4
+set(model.txtFrameShiftStart,'String',num2str(paramStruct.frameShiftStart)) ;  
5
+set(model.txtFrameShiftEnd,'String',num2str(paramStruct.frameShiftEnd)) ; 
6
+set(model.txtFrameShiftDur,'String',num2str(paramStruct.decodeDuration)) ; 
7
+set(model.txtPSTHStart,'String',num2str(paramStruct.psthStart)) ;  
8
+set(model.txtPSTHEnd,'String',num2str(paramStruct.psthEnd)) ;
9
+set(model.txtBaselineStart,'String',num2str(paramStruct.baselineStart)) ; 
10
+set(model.txtBaselineEnd,'String',num2str(paramStruct.baselineEnd)) ; 
11
+
12
+end
... ...
@@ -49,15 +49,38 @@ DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
49 49
     
50 50
     model = createSecondStepPanel(model,pSecondStep,DEFAULT,secondStepBaseColor);
51 51
 
52
+    savemenu = uimenu(frame,'Label','Save/Load');
53
+    uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model});
54
+    uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model});
55
+    
52 56
     set(frame,'Visible','on');
53 57
 
54 58
     % fill with data
55 59
     model = scanDirs(model);
56 60
     assignin('base','model',model);
61
+end
57 62
 
63
+function mcb_save(src,evnt,model)
64
+disp('SAVE');
65
+baseDir  = model.baseDir;
66
+timeLine = getTimeLineParams(model);
67
+subjects = getSubjectCellList(model);
68
+% classDef
69
+% images
70
+% normalization
58 71
 
72
+[file path] = uiputfile('*.mat','Save current Params ...',model.baseDir);
73
+save( fullfile(path,file),'baseDir','timeLine','subjects') ;
59 74
 end
60 75
 
76
+function model = mcb_load(src,evnt,model)
77
+disp('LOAD');
78
+[file path] = uigetfile('*.mat','Save current Params ...',model.baseDir);
79
+l = load(fullfile(path,file));
80
+model = setTimeLineParams(model,l.timeLine);
81
+end
82
+
83
+
61 84
 function model = cbSetBaseDir(model,newDir)
62 85
 model.baseDir = newDir;
63 86
 end
... ...
@@ -273,6 +296,7 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
273 296
         btnRunButton1 = uicontrol(pButtons,'String','run coord-Table',...
274 297
             'Units','normalized','Position',[0 0 0.33 1]);
275 298
         set(btnRunButton1,'Callback',{@cbRunCoordTable,model}); % set here, because of model.    
299
+        set(btnRunButton1,'Enable','off');
276 300
         
277 301
         btnRunButton2 = uicontrol(pButtons,'String','run full Brain Searchlight',...
278 302
             'Units','normalized','Position',[0.33 0 0.33 1]);
... ...
@@ -281,10 +305,33 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
281 305
         
282 306
         btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing',...
283 307
             'Units','normalized','Position',[0.66 0 0.33 1]);
284
-        set(btnRunButton2,'Callback',{@cbRunROIImage,model}); % set here, because of model.    
285
-        set(btnRunButton3,'Enable','off');
308
+        set(btnRunButton3,'Callback',{@cbRunPreprocessing,model,'ROI'}); % set here, because of model.    
309
+        set(btnRunButton3,'Enable','on');
310
+        
311
+        assignin('base','model',model);
286 312
 end
287 313
 
314
+function cbRunPreprocessing(src,evnt,model,task)
315
+
316
+% parse the GUI and pass parameters as structure
317
+disp('RUN');
318
+timeLine = getTimeLineParams(model);
319
+subjects = getSubjectCellList(model);
320
+% classDef
321
+% images
322
+% normalization
323
+
324
+switch task
325
+    case 'COORD'
326
+        coordinates=3
327
+    case 'ROI'
328
+        disp('ROI');
329
+        runROIImageMaskMode(subjects,timeLine)
330
+    case 'FBS'
331
+end
332
+end
333
+
334
+
288 335
 function cbRunCoordTable(src,evnt,model)
289 336
     display('RUN Coord-Table Mode');
290 337
     main('COORD-LOOKUP-TABLE',model);
291 338