save load working for most parameters.
Christoph Budziszewski

Christoph Budziszewski commited on 2009-02-18 17:48:16
Zeige 8 geänderte Dateien mit 60 Einfügungen und 28 Löschungen.


git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@133 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... ...
@@ -0,0 +1,3 @@
1
+function s = getClassDefString(model)
2
+s =get(model.txtClassDef,'String');
3
+end
0 4
\ No newline at end of file
... ...
@@ -0,0 +1,3 @@
1
+function classes = getClasses(model)
2
+classes = parseClassDef(model);
3
+end
... ...
@@ -0,0 +1,3 @@
1
+function s = getCoordDefString(model)
2
+s = get(model.txtVoxelDef,'String');
3
+end
0 4
\ No newline at end of file
... ...
@@ -1,7 +1,7 @@
1 1
 function runROIImageMaskMode(subjects,timeline)
2 2
 
3
-        imageStruct = loadImageFileNamesData(loadParams);
4
-        assignin('base','imageStruct',imageStruct);
3
+%         imageStruct = loadImageFileNamesData(loadParams);
4
+%         assignin('base','imageStruct',imageStruct);
5 5
         
6 6
 %         coordinateStruct = computeCoordinates(imageStruct);
7 7
 %         assignin('base','coordinateStruct',coordinateStruct);
... ...
@@ -6,7 +6,7 @@ set(model.subjectSelector,'String',subjectNames);
6 6
 set(model.subjectSelector,'UserData',subjectNames);
7 7
 set(model.subjectSelector,'Value',model.selectedSubject);
8 8
 
9
-subjectNames(model.selectedSubject)
9
+%subjectNames(model.selectedSubject)
10 10
 imageMask = imageMaskNames(fullfile(model.baseDir,cell2mat(subjectNames(model.selectedSubject))));
11 11
 
12 12
 set(model.imageTypeSelection,'String',imageMask);
... ...
@@ -0,0 +1,3 @@
1
+function model = setClassDefString(model,s)
2
+set(model.txtClassDef,'String',s);
3
+end
0 4
\ No newline at end of file
... ...
@@ -0,0 +1,3 @@
1
+function model = setCoordDefString(model,s)
2
+set(model.txtVoxelDef,'String',s);
3
+end
0 4
\ No newline at end of file
... ...
@@ -27,23 +27,31 @@ DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
27 27
     set(frame,'Name','SVMCrossVal Decode Performance 4 SPM');
28 28
     set(frame,'NumberTitle','off');
29 29
     set(frame,'MenuBar','none');
30
-    set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
30
+%     set(frame,'Color',get(0,'defaultUicontrolBackgroundColor'));
31 31
     set(frame,'Resize','on');
32 32
     set(frame,'Units','normalized');
33
+    set(frame,'Color','w');
33 34
 
34
-    pFirstStep   = uipanel(frame,'Title','Preprocessing','Position',[0 0.3 1 0.7]);
35
+    model = struct;
36
+    model.baseDir = DEFAULT.wd;
37
+
38
+    model.txtBaseDir = createLabel(frame,[0 0.97 1 0.03],model.baseDir);
39
+    set(model.txtBaseDir,'BackgroundColor','w');
40
+    
41
+    pFirstStep   = uipanel(frame,'Title','Preprocessing','Position',[0 0.25 1 0.720]);
35 42
     set(pFirstStep,'BackgroundColor','w');
36 43
     set(pFirstStep,'Units','normalized');
37 44
     
38
-    model = struct;
39
-    model.baseDir = DEFAULT.wd;
45
+    
46
+
47
+    
40 48
     model.selectedSubject = DEFAULT.selectedSubject;
41 49
     model = createFirstStepPanel(model,pFirstStep,DEFAULT);
42 50
     
43 51
     
44 52
     %Classification Step
45 53
     secondStepBaseColor = 'w';
46
-    pSecondStep = uipanel(frame,'Title','Classification','Position',[0 0 1 0.3]);
54
+    pSecondStep = uipanel(frame,'Title','Classification','Position',[0 0 1 0.25]);
47 55
     set(pSecondStep,'BackgroundColor',secondStepBaseColor);
48 56
 
49 57
     
... ...
@@ -53,6 +61,8 @@ DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
53 61
     uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model});
54 62
     uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model});
55 63
 
64
+    cdmenu = uimenu(frame,'Label','change Study');
65
+    
56 66
     set(frame,'Visible','on');
57 67
 
58 68
     % fill with data
... ...
@@ -65,19 +75,23 @@ disp('SAVE');
65 75
 baseDir  = model.baseDir;
66 76
 timeLine = getTimeLineParams(model);
67 77
 subjects = getSubjectCellList(model);
68
-% classDef
78
+classDefString = getClassDefString(model);
79
+coordDefString = getCoordDefString(model);
69 80
 % images
70 81
 % normalization
71 82
 
72 83
 [file path] = uiputfile('*.mat','Save current Params ...',model.baseDir);
73
-save( fullfile(path,file),'baseDir','timeLine','subjects') ;
84
+save( fullfile(path,file),'baseDir','timeLine','subjects','classDefString','coordDefString') ;
74 85
 end
75 86
 
76 87
 function model = mcb_load(src,evnt,model)
77 88
 disp('LOAD');
78 89
 [file path] = uigetfile('*.mat','Save current Params ...',model.baseDir);
79 90
 l = load(fullfile(path,file));
91
+assignin('base','l',l);
80 92
 model = setTimeLineParams(model,l.timeLine);
93
+model = setClassDefString(model,l.classDefString);
94
+model = setCoordDefString(model,l.coordDefString);
81 95
 end
82 96
 
83 97
 
... ...
@@ -117,6 +131,7 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.0 0.5 1]);
117 131
         'Units','normalized',...
118 132
         'Position',[0 0.25 1 0.25]);
119 133
     set(btnRunSVM,'Callback',{@cbRunSVM,model}); % set here, because of model.
134
+    set(btnRunSVM,'Enable','off');
120 135
     
121 136
     btnRunXSVM = uicontrol(pSVM,'String','run SVM X-Subject validation',...
122 137
         'Units','normalized',...
... ...
@@ -295,13 +310,13 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
295 310
         
296 311
         btnRunButton1 = uicontrol(pButtons,'String','run coord-Table',...
297 312
             'Units','normalized','Position',[0 0 0.33 1]);
298
-        set(btnRunButton1,'Callback',{@cbRunCoordTable,model}); % set here, because of model.    
299
-        set(btnRunButton1,'Enable','off');
313
+        set(btnRunButton1,'Callback',{@cbRunPreprocessing,model,'COORD'}); % set here, because of model.    
314
+        set(btnRunButton1,'Enable','on');
300 315
         
301 316
         btnRunButton2 = uicontrol(pButtons,'String','run full Brain Searchlight',...
302 317
             'Units','normalized','Position',[0.33 0 0.33 1]);
303
-        set(btnRunButton2,'Callback',{@cbRunFBS,model}); % set here, because of model.  
304
-        set(btnRunButton2,'Enable','off');
318
+        set(btnRunButton2,'Callback',{@cbRunPreprocessing,model,'FBS'}); % set here, because of model.  
319
+        set(btnRunButton2,'Enable','on');
305 320
         
306 321
         btnRunButton3 = uicontrol(pButtons,'String','run ROI-Image processing',...
307 322
             'Units','normalized','Position',[0.66 0 0.33 1]);
... ...
@@ -317,33 +332,35 @@ function cbRunPreprocessing(src,evnt,model,task)
317 332
 disp('RUN');
318 333
 timeLine = getTimeLineParams(model);
319 334
 subjects = getSubjectCellList(model);
320
-% classDef
335
+classDef = parseClassDef(model);
321 336
 % images
322 337
 % normalization
323 338
 
324 339
 switch task
325 340
     case 'COORD'
326
-        coordinates=3
341
+        disp('COORD');
342
+        coordinates= 'parse me'
327 343
     case 'ROI'
328 344
         disp('ROI');
329 345
         runROIImageMaskMode(subjects,timeLine)
330 346
     case 'FBS'
347
+        disp('FBS')
331 348
 end
332 349
 end
333 350
 
334 351
 
335
-function cbRunCoordTable(src,evnt,model)
336
-    display('RUN Coord-Table Mode');
337
-    main('COORD-LOOKUP-TABLE',model);
338
-end
339
-function cbRunROIImage(src,evnt,model)
340
-    display('RUN Image-Mask Mode');
341
-    main('ROI-IMAGE-MASK', model);
342
-end
343
-function cbRunFBS(src,evnt,model)
344
-    display('RUN Full Brain Searchlight Mode');
345
-    display('not implemented.');
346
-end
352
+% function cbRunCoordTable(src,evnt,model)
353
+%     display('RUN Coord-Table Mode');
354
+%     main('COORD-LOOKUP-TABLE',model);
355
+% end
356
+% function cbRunROIImage(src,evnt,model)
357
+%     display('RUN Image-Mask Mode');
358
+%     main('ROI-IMAGE-MASK', model);
359
+% end
360
+% function cbRunFBS(src,evnt,model)
361
+%     display('RUN Full Brain Searchlight Mode');
362
+%     display('not implemented.');
363
+% end
347 364
 
348 365
 
349 366
 function label = createLabel(parent,  pos, labelText)
350 367