Browse code

almost all "change study" features implemented. needs testing.

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@199 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on30/07/2009 18:46:52
Showing11 changed files
1 1
similarity index 100%
2 2
rename from study/choice24.mat
3 3
rename to choice24.mat
... ...
@@ -5,5 +5,9 @@ uimenu(menu,...
5 5
 end
6 6
 
7 7
 function mcb_load_study(src,blah,filename,uimodel)
8
+    %save current study
9
+    studyID = get(uimodel.txtStudyID,'String');
10
+    saveStudy(studyID,uimodel);
11
+    %load selected study
8 12
     load_study(filename,uimodel);
9 13
 end
... ...
@@ -26,7 +26,7 @@ StudyArgs.frameshiftstart = '0';
26 26
 StudyArgs.frameshiftend = '0';
27 27
 StudyArgs.frameshiftdur = '0';
28 28
 
29
-StudyArgs.svmoptstring = '';
29
+StudyArgs.svmoptstring = '-s 0 -t 0 -c 1';
30 30
 StudyArgs.svmnfold = '0';
31 31
 StudyArgs.svmrnd = 1;
32 32
 
... ...
@@ -35,11 +35,11 @@ StudyArgs.somN = '0';
35 35
 StudyArgs.latticeModelValue = 1;
36 36
 StudyArgs.somnfold = '0';
37 37
 
38
-StudyArgs.searchlightradius = '0';
38
+StudyArgs.searchlightradius = '3';
39 39
 StudyArgs.searchlightTimeline = '';
40 40
 
41 41
 
42
-% file = strcat(studyID,'.mat');
43
-% save(fullfile('D:\SPM\spm2\toolbox\SVMCrossVal\study',file),'-Struct','StudyArgs') ;
42
+file = strcat(studyID,'.mat');
43
+save(fullfile('D:\SPM\spm2\toolbox\SVMCrossVal\study',file),'-Struct','StudyArgs') ;
44 44
 ret=StudyArgs;
45 45
 end
46 46
\ No newline at end of file
... ...
@@ -4,8 +4,8 @@ switch getSPMVersion
4 4
     case 'SPM5'
5 5
         filter = '^.*\.hdr$';
6 6
         [files, dirs] = spm_select('List', fullfile(subjectDir,'a'), filter);
7
-%     case 'SPM2'
8
-%         files = 'swrfandersen-0003-00001-000001.hdr';
7
+    case 'SPM2x'
8
+        files = 'swrfandersen-0003-00001-000001.hdr';
9 9
     otherwise
10 10
         filter = '^.*\.hdr$';
11 11
         files = getFilteredFileList(fullfile(subjectDir,'a'),filter,0);
... ...
@@ -19,4 +19,4 @@ end
19 19
 
20 20
 imageMask = unique(token);
21 21
 
22
-end
23 22
\ No newline at end of file
23
+end
... ...
@@ -29,6 +29,25 @@ function StudyArgs = load_study(studyFile,model)
29 29
     
30 30
     set(model.selNormPST, 'Value',StudyArgs.selNormPSTValue);
31 31
     set(model.chkColBias, 'Value',StudyArgs.chkColBiasValue);
32
+    
33
+    %%%% 
34
+    
35
+    set(model.txtFrameShiftStart,'String', StudyArgs.frameshiftstart );
36
+    set(model.txtFrameShiftEnd,'String',StudyArgs.frameshiftend);
37
+    set(model.txtFrameShiftDur,'String',StudyArgs.frameshiftdur);
38
+
39
+    set(model.txtSVMopts,'String',StudyArgs.svmoptstring );
40
+    set(model.txtSVMnfold,'String',StudyArgs.svmnfold );
41
+    set(model.chkSVMrnd,'Value',StudyArgs.svmrnd );
42
+
43
+    set(model.txtSomM,'String',StudyArgs.somM);
44
+    set(model.txtSomN,'String',StudyArgs.somN);
45
+    set(model.selSomLattice,'Value',StudyArgs.latticeModelValue);
46
+    set(model.txtSOMnfold,'String',StudyArgs.somnfold );
47
+
48
+    set(model.txtSearchlightRadius,'String',StudyArgs.searchlightradius );
49
+    set(model.txtSearchlightTimeline,'String',StudyArgs.searchlightTimeline);
50
+
32 51
 end
33 52
 
34 53
 
... ...
@@ -42,7 +42,7 @@ switch task
42 42
         coordargs = struct;
43 43
         coordargs.subjects      = subjects;
44 44
         coordargs.timeline      = timeLine;
45
-        coordargs.basedir       = model.baseDir;
45
+        coordargs.basedir       = getBaseDir(model);
46 46
         coordargs.sessionList   = 1:3;
47 47
         coordargs.eventList     = classDef.eventMatrix;
48 48
         coordargs.coords        = parseCoordinateTextField(model);
... ...
@@ -1,4 +1,8 @@
1 1
 function ret = saveStudy(studyID,model)
2
+if strcmp(studyID,'')
3
+    ret = 0;
4
+    return
5
+end
2 6
 display(['SAVE ' studyID]);
3 7
 
4 8
 StudyArgs.baseDir             = getBaseDir(model);
... ...
@@ -14,10 +14,6 @@ function ui_main(varargin)
14 14
     set(frame,'Color','y');
15 15
 
16 16
     task = struct;
17
-    
18
-%     studyID = getPreviousStudyID();
19
-    
20
-%     StudyArgs = load_study(studyID);
21 17
 
22 18
     model = struct;
23 19
     
... ...
@@ -35,12 +31,8 @@ function ui_main(varargin)
35 31
     task.preprocessing   = uipanel(frame,'Title','Preprocessing','Position',[0 0.0 1 TASK_HEIGHT]);
36 32
     set(task.preprocessing,'BackgroundColor','w');
37 33
     set(task.preprocessing,'Units','normalized');
38
-    
39 34
     model = createFirstStepPanel(model,task.preprocessing);
40 35
     
41
-    % fill with data
42
-%     model = scanDirs(model);
43
-    
44 36
     % CLASSIFICATION
45 37
     task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]);
46 38
     set(task.classification,'BackgroundColor','w');
... ...
@@ -51,7 +43,7 @@ function ui_main(varargin)
51 43
     set(task.plot,'BackgroundColor','w');
52 44
     model = createVisualStepPanel(model,task.plot);
53 45
     
54
-    % TASK
46
+    % TASK SWITCH BUTTONS
55 47
     task.taskSwitch = uibuttongroup(frame,'Position',[0 1-0.13 1 0.10]);
56 48
     % controlls togglebuttons
57 49
         set(task.taskSwitch,'BackgroundColor','w');
... ...
@@ -76,7 +68,7 @@ function ui_main(varargin)
76 68
         set(btnSwitchPlot,'Enable','on');
77 69
 
78 70
 
79
-    % menus
71
+    % MENUS
80 72
 
81 73
     savemenu = uimenu(frame,'Label','Save ...','Enable','on');
82 74
         uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model},'Enable','on');
... ...
@@ -85,8 +77,9 @@ function ui_main(varargin)
85 77
         uimenu(studySelectMenu,'Label','*new Study*','Callback',{@mcb_new_study,studySelectMenu,model});
86 78
         fillStudyMenu(studySelectMenu,model);
87 79
         
88
-    updateMenu = uimenu(frame,'Label','update ...','Enable','off');
89
-        uimenu(updateMenu,'Label','scan dirs','Callback',{@ssss,studySelectMenu});
80
+    updateMenu = uimenu(frame,'Label','update ...','Enable','on');
81
+        uimenu(updateMenu,'Label','rescan subject dir','Callback',{@mcb_update_subjects,model});
82
+        uimenu(updateMenu,'Label','rescan images','Callback',{@mcb_update_imagebase,model});
90 83
         
91 84
 %     newStudyMenu = uimenu(frame,'Label','new Study','Enable','on');
92 85
 
... ...
@@ -346,7 +339,7 @@ pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3])
346 339
     set(pSearchlight,'Title','Spatiotemporal FB classification');
347 340
     set(pSearchlight,'BackgroundColor',basecolor);
348 341
     
349
-    lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius');
342
+    lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius (mm)');
350 343
     model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],'');
351 344
     
352 345
     lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'')');
... ...
@@ -441,7 +434,37 @@ studyID = get(model.txtStudyID,'String');
441 434
 saveStudy(studyID,model);
442 435
 end
443 436
 
437
+function mcb_update_subjects(src,evnt,model)
438
+studyID = get(model.txtStudyID,'String');
439
+baseDir = getBaseDir(model);
440
+subjectNames = listDirNames(baseDir);
441
+
442
+set(model.subjectSelector,'String',subjectNames);
443
+set(model.subjectSelector,'UserData',subjectNames);
444
+set(model.subjectSelector,'Value',1);
445
+
446
+saveStudy(studyID,model);
447
+end
448
+
449
+function mcb_update_imagebase(src,evnt,model)
450
+studyID = get(model.txtStudyID,'String');
451
+
452
+subjectNames = getSubjectCellList(model);
453
+imageDir = fullfile(getBaseDir(model),cell2mat(subjectNames(1)));
454
+imageMask = imageMaskNames(imageDir);
455
+
456
+set(model.imageTypeSelection,'String',imageMask);
457
+set(model.imageTypeSelection,'UserData',imageMask);
458
+set(model.imageTypeSelection,'Value',1);
459
+
460
+saveStudy(studyID,model);
461
+end
462
+
463
+
444 464
 function mcb_new_study(src,evnt,studymenu,uimodel)
465
+studyID = get(uimodel.txtStudyID,'String');
466
+saveStudy(studyID,uimodel);
467
+
445 468
 display('CREATE STUDY');
446 469
     ui_createStudy(studymenu,uimodel);
447 470
 end
... ...
@@ -15,6 +15,8 @@ end
15 15
 global SVMCROSSVAL_DEBUG;
16 16
 
17 17
 defineGlobals();
18
+%reset defaults to _my_ liking ;)
19
+bootstrap('default');
18 20
 
19 21
 switch nargin
20 22
     case 0
21 23
similarity index 81%
22 24
rename from study/stimolos.mat
23 25
rename to stimolos.mat
24 26
Binary files a/study/stimolos.mat and b/stimolos.mat differ
25 27
Binary files a/study/default.mat and b/study/default.mat differ