Christoph Budziszewski commited on 2009-07-29 15:51:21
Zeige 16 geänderte Dateien mit 322 Einfügungen und 142 Löschungen.
git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@198 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... | ... |
@@ -0,0 +1,45 @@ |
1 |
+function ret = bootstrap(studyID) |
|
2 |
+ |
|
3 |
+StudyArgs.baseDir = 'D:\'; |
|
4 |
+StudyArgs.subjectSelectString = 'noSubject'; |
|
5 |
+StudyArgs.subjectSelectValue = 1; |
|
6 |
+StudyArgs.classdefString = ''; |
|
7 |
+ |
|
8 |
+StudyArgs.pststart = '0'; |
|
9 |
+StudyArgs.pstend = '0'; |
|
10 |
+StudyArgs.baselinestart = '0'; |
|
11 |
+StudyArgs.baselineend = '0'; |
|
12 |
+StudyArgs.trfactor = '0'; |
|
13 |
+StudyArgs.trlabel = '2'; |
|
14 |
+ |
|
15 |
+StudyArgs.imageTypeSelectionString = 'noImages'; |
|
16 |
+StudyArgs.imageTypeSelectionValue = 1; |
|
17 |
+ |
|
18 |
+StudyArgs.voxelString = ''; |
|
19 |
+ |
|
20 |
+StudyArgs.selNormPSTValue = 1; |
|
21 |
+StudyArgs.chkColBiasValue = 1; |
|
22 |
+ |
|
23 |
+%%%%%%%%%%%%%%% |
|
24 |
+ |
|
25 |
+StudyArgs.frameshiftstart = '0'; |
|
26 |
+StudyArgs.frameshiftend = '0'; |
|
27 |
+StudyArgs.frameshiftdur = '0'; |
|
28 |
+ |
|
29 |
+StudyArgs.svmoptstring = ''; |
|
30 |
+StudyArgs.svmnfold = '0'; |
|
31 |
+StudyArgs.svmrnd = 1; |
|
32 |
+ |
|
33 |
+StudyArgs.somM = '0'; |
|
34 |
+StudyArgs.somN = '0'; |
|
35 |
+StudyArgs.latticeModelValue = 1; |
|
36 |
+StudyArgs.somnfold = '0'; |
|
37 |
+ |
|
38 |
+StudyArgs.searchlightradius = '0'; |
|
39 |
+StudyArgs.searchlightTimeline = ''; |
|
40 |
+ |
|
41 |
+ |
|
42 |
+% file = strcat(studyID,'.mat'); |
|
43 |
+% save(fullfile('D:\SPM\spm2\toolbox\SVMCrossVal\study',file),'-Struct','StudyArgs') ; |
|
44 |
+ret=StudyArgs; |
|
45 |
+end |
|
0 | 46 |
\ No newline at end of file |
... | ... |
@@ -1,4 +1,11 @@ |
1 | 1 |
function defineGlobals() |
2 |
+global SVMCROSSVAL_SPMDIR; |
|
3 |
+global SVMCROSSVAL_TOOLBOXPATH; |
|
4 |
+SVMCROSSVAL_TOOLBOXPATH = fullfile(SVMCROSSVAL_SPMDIR,'toolbox','SVMCrossVal'); |
|
5 |
+ |
|
6 |
+global SVMCROSSVAL_STUDYDIR; |
|
7 |
+SVMCROSSVAL_STUDYDIR = fullfile(SVMCROSSVAL_TOOLBOXPATH,'study'); |
|
8 |
+ |
|
2 | 9 |
%define global constants |
3 | 10 |
global SVMCROSSVAL_USE_DRIVE_CHECK_HACK; |
4 | 11 |
%enables subroutine to check if image path starts with 'D' |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+function fillStudyMenu(studymenu,uimodel) |
|
2 |
+studydir = fullfile(getTbxPath,'study'); |
|
3 |
+ files = dir(studydir); |
|
4 |
+ for fileidx = 1: numel(files) |
|
5 |
+ if ~files(fileidx).isdir |
|
6 |
+% && ~strcmp(files(fileidx).name,'default.mat') |
|
7 |
+% uimenu(studymenu,... |
|
8 |
+% 'Label',files(fileidx).name,... |
|
9 |
+% 'Callback',{@mcb_load_study,files(fileidx).name,uimodel}); |
|
10 |
+ addStudyToMenu(studymenu,files(fileidx).name,uimodel); |
|
11 |
+ end |
|
12 |
+ end |
|
13 |
+end |
|
14 |
+ |
|
15 |
+ |
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+function StudyArgs = load_study(studyFile,model) |
|
2 |
+ studyID = strrep(studyFile,'.mat',''); |
|
3 |
+ display(['LOAD STUDY ' studyID]); |
|
4 |
+ |
|
5 |
+ global SVMCROSSVAL_STUDYDIR; |
|
6 |
+ StudyArgs = load(fullfile(SVMCROSSVAL_STUDYDIR,studyFile)); |
|
7 |
+ |
|
8 |
+ set(model.txtBaseDir,'String',StudyArgs.baseDir); |
|
9 |
+ set(model.txtStudyID,'String',studyID); |
|
10 |
+ |
|
11 |
+ set(model.subjectSelector,'String',StudyArgs.subjectSelectString); |
|
12 |
+ set(model.subjectSelector,'UserData',StudyArgs.subjectSelectString); |
|
13 |
+ set(model.subjectSelector,'Value',StudyArgs.subjectSelectValue); |
|
14 |
+ |
|
15 |
+ set(model.txtClassDef,'String',sprintf(StudyArgs.classdefString)); |
|
16 |
+ |
|
17 |
+ set(model.txtPSTHStart, 'String',sprintf(StudyArgs.pststart)); |
|
18 |
+ set(model.txtPSTHEnd, 'String',sprintf(StudyArgs.pstend)); |
|
19 |
+ set(model.txtBaselineStart, 'String',sprintf(StudyArgs.baselinestart)); |
|
20 |
+ set(model.txtBaselineEnd, 'String',sprintf(StudyArgs.baselineend)); |
|
21 |
+ set(model.txtTrFactor, 'String',sprintf(StudyArgs.trfactor)); |
|
22 |
+ set(model.labelTR, 'String',sprintf(StudyArgs.trlabel)); |
|
23 |
+ |
|
24 |
+ set(model.imageTypeSelection, 'String' ,StudyArgs.imageTypeSelectionString); |
|
25 |
+ set(model.imageTypeSelection, 'UserData',StudyArgs.imageTypeSelectionString); |
|
26 |
+ set(model.imageTypeSelection, 'Value' ,StudyArgs.imageTypeSelectionValue); |
|
27 |
+ |
|
28 |
+ set(model.txtVoxelDef,'String',sprintf(StudyArgs.voxelString)); |
|
29 |
+ |
|
30 |
+ set(model.selNormPST, 'Value',StudyArgs.selNormPSTValue); |
|
31 |
+ set(model.chkColBias, 'Value',StudyArgs.chkColBiasValue); |
|
32 |
+end |
|
33 |
+ |
|
34 |
+ |
|
35 |
+ |
... | ... |
@@ -0,0 +1,46 @@ |
1 |
+function ret = saveStudy(studyID,model) |
|
2 |
+display(['SAVE ' studyID]); |
|
3 |
+ |
|
4 |
+StudyArgs.baseDir = getBaseDir(model); |
|
5 |
+StudyArgs.subjectSelectString = get(model.subjectSelector,'String'); |
|
6 |
+StudyArgs.subjectSelectValue = get(model.subjectSelector,'Value'); |
|
7 |
+StudyArgs.classdefString = get(model.txtClassDef,'String'); |
|
8 |
+ |
|
9 |
+StudyArgs.pststart = get(model.txtPSTHStart,'String'); |
|
10 |
+StudyArgs.pstend = get(model.txtPSTHEnd,'String'); |
|
11 |
+StudyArgs.baselinestart = get(model.txtBaselineStart,'String'); |
|
12 |
+StudyArgs.baselineend = get(model.txtBaselineEnd,'String'); |
|
13 |
+StudyArgs.trfactor = get(model.txtTrFactor,'String'); |
|
14 |
+StudyArgs.trlabel = get(model.labelTR,'String'); |
|
15 |
+ |
|
16 |
+StudyArgs.imageTypeSelectionString = get(model.imageTypeSelection,'String'); |
|
17 |
+StudyArgs.imageTypeSelectionValue = get(model.imageTypeSelection,'Value'); |
|
18 |
+ |
|
19 |
+StudyArgs.voxelString = get(model.txtVoxelDef,'String'); |
|
20 |
+ |
|
21 |
+StudyArgs.selNormPSTValue = get(model.selNormPST, 'Value'); |
|
22 |
+StudyArgs.chkColBiasValue = get(model.chkColBias, 'Value'); |
|
23 |
+ |
|
24 |
+% %%%%%%%%%%%%%%% |
|
25 |
+ |
|
26 |
+StudyArgs.frameshiftstart = get(model.txtFrameShiftStart,'String'); |
|
27 |
+StudyArgs.frameshiftend = get(model.txtFrameShiftEnd,'String'); |
|
28 |
+StudyArgs.frameshiftdur = get(model.txtFrameShiftDur,'String'); |
|
29 |
+ |
|
30 |
+StudyArgs.svmoptstring = get(model.txtSVMopts,'String'); |
|
31 |
+StudyArgs.svmnfold = get(model.txtSVMnfold,'String'); |
|
32 |
+StudyArgs.svmrnd = get(model.chkSVMrnd,'Value'); |
|
33 |
+ |
|
34 |
+StudyArgs.somM = get(model.txtSomM,'String'); |
|
35 |
+StudyArgs.somN = get(model.txtSomN,'String'); |
|
36 |
+StudyArgs.latticeModelValue = get(model.selSomLattice,'Value'); |
|
37 |
+StudyArgs.somnfold = get(model.txtSOMnfold,'String'); |
|
38 |
+ |
|
39 |
+StudyArgs.searchlightradius = get(model.txtSearchlightRadius,'String'); |
|
40 |
+StudyArgs.searchlightTimeline = get(model.txtSearchlightTimeline,'String'); |
|
41 |
+ |
|
42 |
+ |
|
43 |
+file = strcat(studyID,'.mat'); |
|
44 |
+save(fullfile(getStudyPath,file),'-Struct','StudyArgs') ; |
|
45 |
+ret=1; |
|
46 |
+end |
|
0 | 47 |
\ No newline at end of file |
... | ... |
@@ -1,18 +1,19 @@ |
1 | 1 |
function model = scanDirs(model) |
2 |
-disp('scan dir'); |
|
3 |
-subjectNames = listDirNames(model.baseDir); |
|
2 |
+% disp('scan dir'); |
|
3 |
+baseDir = getBaseDir(model); |
|
4 |
+subjectNames = listDirNames(baseDir); |
|
4 | 5 |
|
5 | 6 |
set(model.subjectSelector,'String',subjectNames); |
6 | 7 |
set(model.subjectSelector,'UserData',subjectNames); |
7 | 8 |
set(model.subjectSelector,'Value',model.selectedSubject); |
8 | 9 |
|
9 | 10 |
%subjectNames(model.selectedSubject) |
10 |
-imageMask = imageMaskNames(fullfile(model.baseDir,cell2mat(subjectNames(model.selectedSubject)))); |
|
11 |
+imageMask = imageMaskNames(fullfile(baseDir,cell2mat(subjectNames(model.selectedSubject)))); |
|
11 | 12 |
|
12 | 13 |
set(model.imageTypeSelection,'String',imageMask); |
13 | 14 |
set(model.imageTypeSelection,'UserData',imageMask); |
14 | 15 |
|
15 |
-set(model.txtBaseDir,'String',model.baseDir); |
|
16 |
+% set(model.txtBaseDir,'String',baseDir); |
|
16 | 17 |
|
17 | 18 |
% des = |
18 | 19 |
% tr = des.xsDes.Interscan_interval(1:end-3); |
... | ... |
@@ -1,9 +1,9 @@ |
1 |
-function ui_createStudy() |
|
2 |
- frameWidth=450; |
|
3 |
- frameHeight=450; |
|
1 |
+function ui_createStudy(menu,uimodel) |
|
2 |
+ frameWidth=300; |
|
3 |
+ frameHeight=200; |
|
4 | 4 |
|
5 |
- frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]); |
|
6 |
- movegui(frame,'west'); % get this thing visible on smaller displays. |
|
5 |
+ frame = figure('Visible','on','Position',[0,0,frameWidth,frameHeight]); |
|
6 |
+ movegui(frame,'center'); % get this thing visible on smaller displays. |
|
7 | 7 |
set(frame,'Name','Create Study'); |
8 | 8 |
set(frame,'NumberTitle','off'); |
9 | 9 |
set(frame,'MenuBar','none'); |
... | ... |
@@ -13,4 +13,54 @@ function ui_createStudy() |
13 | 13 |
set(frame,'Color','y'); |
14 | 14 |
|
15 | 15 |
|
16 |
+ study= struct(); |
|
17 |
+ % name |
|
18 |
+ namelabel = createLabel(frame,[0 0.6 1 0.1],'Identifier for new study (the name):'); |
|
19 |
+ study.name = createTextField(frame,[0 0.5 1 .1],''); |
|
20 |
+ % base-dir |
|
21 |
+ dirlabel = createLabel(frame,[0 0.4 1 0.1],'Full path to the directory containing the data:'); |
|
22 |
+ study.basedir = createTextField(frame,[0 0.3 1 .1],''); |
|
23 |
+ |
|
24 |
+ %fertig-button |
|
25 |
+ btnSwitchPreprocessing = uicontrol(frame,'Style','pushbutton',... |
|
26 |
+ 'String','create',... |
|
27 |
+ 'Units','normalized','Position',[0.0 0.0 1 0.1]); |
|
28 |
+ set(btnSwitchPreprocessing,'Callback',{@cbCreateStudy,study,frame,uimodel,menu}); |
|
29 |
+ set(btnSwitchPreprocessing,'Enable','on'); |
|
30 |
+ |
|
31 |
+end |
|
32 |
+ |
|
33 |
+function uimodel = cbCreateStudy(src,evnt,study,window,uimodel,menu) |
|
34 |
+% global SVMCROSSVAL_STUDYDIR; |
|
35 |
+disp('Creating new Study'); |
|
36 |
+if strcmp(get(study.name,'String'),'') || strcmp(get(study.basedir,'String'),'') |
|
37 |
+ error('spm_SVMCrossVal:createStudy','please provide Name and Path'); |
|
38 |
+end |
|
39 |
+studyID = get(study.name,'String'); |
|
40 |
+baseDir = get(study.basedir,'String'); |
|
41 |
+ |
|
42 |
+set(uimodel.txtBaseDir,'String',baseDir); |
|
43 |
+set(uimodel.txtStudyID,'String',studyID); |
|
44 |
+ |
|
45 |
+StudyArgs.subjectSelectString = listDirNames(baseDir); |
|
46 |
+StudyArgs.subjectSelectValue = 1; |
|
47 |
+set(uimodel.subjectSelector,'String',StudyArgs.subjectSelectString); |
|
48 |
+set(uimodel.subjectSelector,'UserData',StudyArgs.subjectSelectString); |
|
49 |
+set(uimodel.subjectSelector,'Value',StudyArgs.subjectSelectValue); |
|
50 |
+ |
|
51 |
+StudyArgs.imageTypeSelectionString = imageMaskNames(fullfile(baseDir,cell2mat(StudyArgs.subjectSelectString(StudyArgs.subjectSelectValue)))); |
|
52 |
+StudyArgs.imageTypeSelectionValue = 1; |
|
53 |
+set(uimodel.imageTypeSelection, 'String' ,StudyArgs.imageTypeSelectionString); |
|
54 |
+set(uimodel.imageTypeSelection, 'UserData',StudyArgs.imageTypeSelectionString); |
|
55 |
+set(uimodel.imageTypeSelection, 'Value' ,StudyArgs.imageTypeSelectionValue); |
|
56 |
+ |
|
57 |
+% des = |
|
58 |
+% tr = des.xsDes.Interscan_interval(1:end-3); |
|
59 |
+StudyArgs.trlabel = '2'; |
|
60 |
+set(uimodel.labelTR, 'String',sprintf(StudyArgs.trlabel)); |
|
61 |
+ |
|
62 |
+studyfile = [studyID '.mat']; |
|
63 |
+saveStudy(studyID,uimodel); |
|
64 |
+addStudyToMenu(menu,studyfile,uimodel); |
|
65 |
+close(window); |
|
16 | 66 |
end |
17 | 67 |
\ No newline at end of file |
... | ... |
@@ -9,21 +9,25 @@ function ui_main(varargin) |
9 | 9 |
set(frame,'Name','SVMCrossVal Decode Performance 4 SPM'); |
10 | 10 |
set(frame,'NumberTitle','off'); |
11 | 11 |
set(frame,'MenuBar','none'); |
12 |
-% set(frame,'Color',get(0,'defaultUicontrolBackgroundColor')); |
|
13 | 12 |
set(frame,'Resize','on'); |
14 | 13 |
set(frame,'Units','normalized'); |
15 | 14 |
set(frame,'Color','y'); |
16 | 15 |
|
17 | 16 |
task = struct; |
18 | 17 |
|
19 |
- DEFAULT = mcb_load_study(0,0,fullfile(getTbxPath,'study/stimolos.mat')); |
|
18 |
+% studyID = getPreviousStudyID(); |
|
20 | 19 |
|
21 |
- model1 = struct; |
|
22 |
- model1.baseDir = DEFAULT.wd; |
|
20 |
+% StudyArgs = load_study(studyID); |
|
23 | 21 |
|
24 |
- model1.txtBaseDir = createLabel(frame,[0 0.97 1 0.03],model1.baseDir); |
|
25 |
- set(model1.txtBaseDir,'BackgroundColor','w'); |
|
26 |
- set(model1.txtBaseDir,'ForegroundColor','b'); |
|
22 |
+ model = struct; |
|
23 |
+ |
|
24 |
+ model.txtBaseDir = createLabel(frame,[0 0.97 0.8 0.03],''); |
|
25 |
+ set(model.txtBaseDir,'BackgroundColor','w'); |
|
26 |
+ set(model.txtBaseDir,'ForegroundColor','b'); |
|
27 |
+ |
|
28 |
+ model.txtStudyID = createLabel(frame,[0.8 0.97 0.2 0.03],''); |
|
29 |
+ set(model.txtStudyID,'BackgroundColor','w'); |
|
30 |
+ set(model.txtStudyID,'ForegroundColor','r'); |
|
27 | 31 |
|
28 | 32 |
TASK_HEIGHT = 1-0.13; |
29 | 33 |
|
... | ... |
@@ -32,80 +36,68 @@ function ui_main(varargin) |
32 | 36 |
set(task.preprocessing,'BackgroundColor','w'); |
33 | 37 |
set(task.preprocessing,'Units','normalized'); |
34 | 38 |
|
35 |
- model1.selectedSubject = DEFAULT.selectedSubject; |
|
36 |
- model1 = createFirstStepPanel(model1,task.preprocessing,DEFAULT); |
|
39 |
+ model = createFirstStepPanel(model,task.preprocessing); |
|
37 | 40 |
|
38 | 41 |
% fill with data |
39 |
- model1 = scanDirs(model1); |
|
42 |
+% model = scanDirs(model); |
|
40 | 43 |
|
41 | 44 |
% CLASSIFICATION |
42 |
- model2 = struct; |
|
43 |
- |
|
44 | 45 |
task.classification = uipanel(frame,'Title','Classification','Position',[0 0.0 1 TASK_HEIGHT]); |
45 | 46 |
set(task.classification,'BackgroundColor','w'); |
46 |
- model2 = createSecondStepPanel(model2,task.classification,DEFAULT); |
|
47 |
+ model = createSecondStepPanel(model,task.classification); |
|
47 | 48 |
|
48 | 49 |
% PLOT |
49 |
- model3 = struct; |
|
50 | 50 |
task.plot = uipanel(frame,'Title','Plot','Position',[0 0.0 1 TASK_HEIGHT]); |
51 | 51 |
set(task.plot,'BackgroundColor','w'); |
52 |
- model3 = createVisualStepPanel(model3,task.plot,DEFAULT); |
|
52 |
+ model = createVisualStepPanel(model,task.plot); |
|
53 | 53 |
|
54 | 54 |
% TASK |
55 | 55 |
task.taskSwitch = uibuttongroup(frame,'Position',[0 1-0.13 1 0.10]); |
56 | 56 |
% controlls togglebuttons |
57 |
-% set(task.taskSwitch,'Title','TASK'); |
|
58 | 57 |
set(task.taskSwitch,'BackgroundColor','w'); |
59 | 58 |
set(task.taskSwitch,'Units','normalized'); |
60 | 59 |
|
61 | 60 |
btnSwitchPreprocessing = uicontrol(task.taskSwitch,'Style','pushbutton',... |
62 | 61 |
'String','ImageProcessing',... |
63 | 62 |
'Units','normalized','Position',[0.0 0.0 0.33 1]); |
64 |
- set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task,model1}); |
|
63 |
+ set(btnSwitchPreprocessing,'Callback',{@cbSwitchTask,'PRE',task}); |
|
65 | 64 |
set(btnSwitchPreprocessing,'Enable','on'); |
66 | 65 |
|
67 | 66 |
btnSwitchClassify = uicontrol(task.taskSwitch,'Style','pushbutton',... |
68 | 67 |
'String','Decode',... |
69 | 68 |
'Units','normalized','Position',[0.33 0.0 0.33 1]); |
70 |
- set(btnSwitchClassify,'Callback',{@cbSwitchTask,'CLASSIFY',task,model2}); |
|
69 |
+ set(btnSwitchClassify,'Callback',{@cbSwitchTask,'CLASSIFY',task}); |
|
71 | 70 |
set(btnSwitchClassify,'Enable','on'); |
72 | 71 |
|
73 | 72 |
btnSwitchPlot = uicontrol(task.taskSwitch,'Style','pushbutton',... |
74 | 73 |
'String','Plot',... |
75 | 74 |
'Units','normalized','Position',[0.66 0.0 0.33 1]); |
76 |
- set(btnSwitchPlot,'Callback',{@cbSwitchTask,'PLOT',task,model3}); |
|
75 |
+ set(btnSwitchPlot,'Callback',{@cbSwitchTask,'PLOT',task}); |
|
77 | 76 |
set(btnSwitchPlot,'Enable','on'); |
78 | 77 |
|
79 |
- % menu |
|
80 | 78 |
|
81 |
- savemenu = uimenu(frame,'Label','Save/Load','Enable','off'); |
|
82 |
- uimenu(savemenu,'Label','Save Preprocessing Parameter','Callback',{@mcb_save,model1},'Enable','off'); |
|
83 |
- uimenu(savemenu,'Label','Load Preprocessing Parameter','Callback',{@mcb_load,model1},'Enable','off'); |
|
84 |
- uimenu(savemenu,'Label','Save Decode Parameter','Callback',{@mcb_save,model2},'Enable','off'); |
|
85 |
- uimenu(savemenu,'Label','Load Decode Parameter','Callback',{@mcb_load,model2},'Enable','off'); |
|
86 |
- uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model1},'Enable','off'); |
|
87 |
- uimenu(savemenu,'Label','Load All','Callback',{@mcb_load,model1},'Enable','off'); |
|
79 |
+ % menus |
|
88 | 80 |
|
89 |
- studymenu = uimenu(frame,'Label','change Study','Enable','on'); |
|
90 |
- fillStudyMenu(studymenu); |
|
81 |
+ savemenu = uimenu(frame,'Label','Save ...','Enable','on'); |
|
82 |
+ uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model},'Enable','on'); |
|
91 | 83 |
|
92 |
- cbSwitchTask(0,0,'PRE',task,model1); |
|
84 |
+ studySelectMenu = uimenu(frame,'Label','Study ...','Enable','on'); |
|
85 |
+ uimenu(studySelectMenu,'Label','*new Study*','Callback',{@mcb_new_study,studySelectMenu,model}); |
|
86 |
+ fillStudyMenu(studySelectMenu,model); |
|
93 | 87 |
|
94 |
- set(frame,'Visible','on'); |
|
88 |
+ updateMenu = uimenu(frame,'Label','update ...','Enable','off'); |
|
89 |
+ uimenu(updateMenu,'Label','scan dirs','Callback',{@ssss,studySelectMenu}); |
|
95 | 90 |
|
96 |
-end |
|
91 |
+% newStudyMenu = uimenu(frame,'Label','new Study','Enable','on'); |
|
92 |
+ |
|
93 |
+ load_study([getPreviousStudyID '.mat'],model); |
|
94 |
+ cbSwitchTask(0,0,'PRE',task); |
|
95 |
+ set(frame,'Visible','on'); |
|
97 | 96 |
|
98 |
-function fillStudyMenu(studymenu) |
|
99 |
- studydir = fullfile(getTbxPath,'study'); |
|
100 |
- files = dir(studydir); |
|
101 |
- for fileidx = 1: numel(files) |
|
102 |
- if ~files(fileidx).isdir |
|
103 |
- uimenu(studymenu,'Label',files(fileidx).name,'Callback',{@mcb_load_study,fullfile(studydir,files(fileidx).name)}); |
|
104 |
- end |
|
105 |
- end |
|
106 | 97 |
end |
107 | 98 |
|
108 |
-function model = createFirstStepPanel(model,parent,DEFAULT) |
|
99 |
+%%%%% ui elements |
|
100 |
+function model = createFirstStepPanel(model,parent) |
|
109 | 101 |
|
110 | 102 |
main_grid = cell(2,4); |
111 | 103 |
main_grid{1,1} = [0 0.7 0.4 0.3]; |
... | ... |
@@ -122,11 +114,9 @@ function model = createFirstStepPanel(model,parent,DEFAULT) |
122 | 114 |
set(pSubject,'Title','Subjects'); |
123 | 115 |
set(pSubject,'BackgroundColor','w'); |
124 | 116 |
|
125 |
- subjectList = {'DUMMY Subj1','DUMMY Subj2','DUMMY Subj3','DUMMY Subj4'}; |
|
117 |
+% subjectNames = listDirNames(getBaseDir(model)); |
|
126 | 118 |
model.subjectSelector = uicontrol(pSubject,'Style','listbox',... |
127 | 119 |
'Min',1, 'Max',3,... |
128 |
- 'String',subjectList,... |
|
129 |
- 'UserData',subjectList,... |
|
130 | 120 |
'Units','normalized',... |
131 | 121 |
'Position',[0 0 1 1]); |
132 | 122 |
set(model.subjectSelector, 'FontName', 'FixedWidth'); |
... | ... |
@@ -144,8 +135,8 @@ function model = createFirstStepPanel(model,parent,DEFAULT) |
144 | 135 |
set(lClassDef,'BackgroundColor','w'); |
145 | 136 |
set(lClassDef,'HorizontalAlignment','left'); |
146 | 137 |
|
138 |
+ |
|
147 | 139 |
model.txtClassDef = uicontrol(pClasses,'Style','edit',... |
148 |
- 'String',sprintf(DEFAULT.classdefstring),... |
|
149 | 140 |
'Units','normalized',... |
150 | 141 |
'Position',[0 0 1 0.8]); |
151 | 142 |
set(model.txtClassDef,'HorizontalAlignment','left'); |
... | ... |
@@ -193,11 +184,11 @@ function model = createFirstStepPanel(model,parent,DEFAULT) |
193 | 184 |
lBaseline = createLabel(pPSTH, cell2mat(tl_grid(1,3)) ,'Baseline'); |
194 | 185 |
lTRF = createLabel(pPSTH, cell2mat(tl_grid(1,5)) ,'TR Factor'); |
195 | 186 |
|
196 |
- model.txtPSTHStart = createTextField(pPSTH,cell2mat(tl_grid(2,2)),DEFAULT.pststart); |
|
197 |
- model.txtPSTHEnd = createTextField(pPSTH,cell2mat(tl_grid(3,2)),DEFAULT.pstend); |
|
198 |
- model.txtBaselineStart = createTextField(pPSTH,cell2mat(tl_grid(2,3)),DEFAULT.baselinestart); |
|
199 |
- model.txtBaselineEnd = createTextField(pPSTH,cell2mat(tl_grid(3,3)),DEFAULT.baselineend); |
|
200 |
- model.txtTrFactor = createTextField(pPSTH,cell2mat(tl_grid(2,5)),DEFAULT.trfactor); |
|
187 |
+ model.txtPSTHStart = createTextField(pPSTH,cell2mat(tl_grid(2,2)),''); |
|
188 |
+ model.txtPSTHEnd = createTextField(pPSTH,cell2mat(tl_grid(3,2)),''); |
|
189 |
+ model.txtBaselineStart = createTextField(pPSTH,cell2mat(tl_grid(2,3)),''); |
|
190 |
+ model.txtBaselineEnd = createTextField(pPSTH,cell2mat(tl_grid(3,3)),''); |
|
191 |
+ model.txtTrFactor = createTextField(pPSTH,cell2mat(tl_grid(2,5)),''); |
|
201 | 192 |
model.labelTR = createTextField(pPSTH,cell2mat(tl_grid(3,5)),''); |
202 | 193 |
|
203 | 194 |
% images |
... | ... |
@@ -206,22 +197,16 @@ function model = createFirstStepPanel(model,parent,DEFAULT) |
206 | 197 |
|
207 | 198 |
createLabel(pImage,[0.0 0.5 1 0.5],'Select Image Base'); |
208 | 199 |
|
209 |
- imageRegExList = {'DUMMY f*.IMG','DUMMY swrf*.IMG','DUMMY wrf*.IMG'}; |
|
210 | 200 |
model.imageTypeSelection = uicontrol(pImage,'Style','popupmenu',... |
211 | 201 |
'Units','normalized',... |
212 |
- 'Position',[0.0 0.0 1 0.5],... |
|
213 |
- 'String',imageRegExList,... |
|
214 |
- 'UserData',imageRegExList,... |
|
215 |
- 'Value',1); |
|
202 |
+ 'Position',[0.0 0.0 1 0.5]); |
|
216 | 203 |
set(model.imageTypeSelection,'BackgroundColor','w'); |
217 | 204 |
|
218 |
- |
|
219 | 205 |
% coordinate Table |
220 | 206 |
pVoxel = uipanel(parent,'Title','ROI','Position',cell2mat(main_grid(1,3))); |
221 | 207 |
set(pVoxel,'BackgroundColor','w'); |
222 | 208 |
lVoxelDef = createLabel(pVoxel, [0 0.9 1 0.1],'<ROI Name> [+ radius (mm)];'); |
223 |
- model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],... |
|
224 |
- sprintf(DEFAULT.voxelstring)); |
|
209 |
+ model.txtVoxelDef = createTextField(pVoxel,[0 0 1 0.9],''); |
|
225 | 210 |
set(model.txtVoxelDef,'HorizontalAlignment','left'); |
226 | 211 |
set(model.txtVoxelDef,'Max',20); |
227 | 212 |
set(model.txtVoxelDef,'Min',0); |
... | ... |
@@ -237,18 +226,14 @@ function model = createFirstStepPanel(model,parent,DEFAULT) |
237 | 226 |
'Units','normalized',... |
238 | 227 |
'Position',[0.0 0.5 1 0.25],... |
239 | 228 |
'String',norm1Model,... |
240 |
- 'UserData',norm1Model,... |
|
241 |
- 'Value',2); |
|
229 |
+ 'UserData',norm1Model); |
|
242 | 230 |
set(model.selNormPST,'BackgroundColor','w'); |
243 | 231 |
|
244 |
-% createLabel(pNorm,[0 0.25 1 0.25],'Col Bias removal'); |
|
245 |
-% norm2Model = {'on','off'}; |
|
246 | 232 |
model.chkColBias = uicontrol(pNorm,'Style','checkbox',... |
247 | 233 |
'Units','normalized',... |
248 | 234 |
'Position',[0.0 0.1 1 0.25],... |
249 | 235 |
'String','column Bias removal',... |
250 |
- 'Enable','on',... |
|
251 |
- 'Value',1); |
|
236 |
+ 'Enable','on'); |
|
252 | 237 |
set(model.chkColBias,'BackgroundColor','w'); |
253 | 238 |
|
254 | 239 |
%buttons |
... | ... |
@@ -271,7 +256,7 @@ function model = createFirstStepPanel(model,parent,DEFAULT) |
271 | 256 |
set(btnRunButton3,'Enable','on'); |
272 | 257 |
end |
273 | 258 |
|
274 |
-function model = createSecondStepPanel(model,parent,DEFAULT) |
|
259 |
+function model = createSecondStepPanel(model,parent) |
|
275 | 260 |
basecolor = 'w'; |
276 | 261 |
|
277 | 262 |
pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.8 1 0.2]); |
... | ... |
@@ -295,25 +280,25 @@ pTime = uipanel(parent,'Units','normalized','Position',[0.0 0.8 1 0.2]); |
295 | 280 |
lFrameShift = createLabel(pTime, cell2mat(time_grid(1,2)),'Frame Shift'); |
296 | 281 |
lFramsSize = createLabel(pTime, cell2mat(time_grid(1,3)),'Frame Size'); |
297 | 282 |
|
298 |
- model.txtFrameShiftStart = createTextField(pTime,cell2mat(time_grid(2,2)),DEFAULT.frameshiftstart); |
|
299 |
- model.txtFrameShiftEnd = createTextField(pTime,cell2mat(time_grid(3,2)),DEFAULT.frameshiftend); |
|
300 |
- model.txtFrameShiftDur = createTextField(pTime,cell2mat(time_grid(2,3)),DEFAULT.frameshiftdur); |
|
283 |
+ model.txtFrameShiftStart = createTextField(pTime,cell2mat(time_grid(2,2)),''); |
|
284 |
+ model.txtFrameShiftEnd = createTextField(pTime,cell2mat(time_grid(3,2)),''); |
|
285 |
+ model.txtFrameShiftDur = createTextField(pTime,cell2mat(time_grid(2,3)),''); |
|
301 | 286 |
|
302 | 287 |
|
303 | 288 |
pSVM = uipanel(parent,'Units','normalized','Position',[0 0.4 0.5 0.4]); |
304 | 289 |
set(pSVM,'Title','SVM Classification'); |
305 | 290 |
set(pSVM,'BackgroundColor',basecolor); |
306 | 291 |
|
307 |
- model.txtSVMopts = createTextField(pSVM,[0 0.83 1 0.16],DEFAULT.svmoptstring); |
|
292 |
+ model.txtSVMopts = createTextField(pSVM,[0 0.83 1 0.16],''); |
|
308 | 293 |
set(model.txtSVMopts,'HorizontalAlignment','left'); |
309 | 294 |
|
310 |
- model.txtSVMnfold = createTextField(pSVM,[0.0 0.66 0.5 0.16],DEFAULT.svmnfold); |
|
295 |
+ model.txtSVMnfold = createTextField(pSVM,[0.0 0.66 0.5 0.16],''); |
|
311 | 296 |
createLabel(pSVM,[0.5 0.50 0.5 0.25 ],'-Fold CrossVal'); |
312 | 297 |
|
313 | 298 |
model.chkSVMrnd = uicontrol(pSVM,'Style','checkbox','Units','normalized','Position',[0.1 0.50 0.9 0.16]); |
314 | 299 |
set(model.chkSVMrnd,'String','Randomize Datapoints'); |
315 | 300 |
set(model.chkSVMrnd,'BackgroundColor','w'); |
316 |
- set(model.chkSVMrnd,'Value',DEFAULT.svmrnd); |
|
301 |
+% set(model.chkSVMrnd,'Value',StudyArgs.svmrnd); |
|
317 | 302 |
|
318 | 303 |
btnRunSVM = uicontrol(pSVM,'String','run batchmode SVM Crossvalidation',... |
319 | 304 |
'Units','normalized',... |
... | ... |
@@ -330,21 +315,19 @@ pSOM = uipanel(parent,'Units','normalized','Position',[0.5 0.4 0.5 0.4]); |
330 | 315 |
set(pSOM,'BackgroundColor',basecolor); |
331 | 316 |
|
332 | 317 |
createLabel(pSOM,[0 0.75 0.3 0.20],'Size:'); |
333 |
- model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.2],DEFAULT.somM); |
|
318 |
+ model.txtSomM = createTextField(pSOM,[0.3 0.75 0.25 0.2],''); |
|
334 | 319 |
somsizemal = createLabel(pSOM,[0.55 0.75 0.2 0.20],'x'); |
335 | 320 |
set(somsizemal,'HorizontalAlignment','center'); |
336 |
- model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.20],DEFAULT.somN); |
|
337 |
- |
|
321 |
+ model.txtSomN = createTextField(pSOM,[0.75 0.75 0.25 0.20],''); |
|
338 | 322 |
latticeModel = {'rect','hexa'}; |
339 | 323 |
model.selSomLattice = uicontrol(pSOM,'Style','popupmenu',... |
340 | 324 |
'Units','normalized',... |
341 | 325 |
'Position',[0.0 0.5 0.3 0.20],... |
342 | 326 |
'String',latticeModel,... |
343 |
- 'UserData',latticeModel,... |
|
344 |
- 'Value',1); |
|
327 |
+ 'UserData',latticeModel); |
|
345 | 328 |
set(model.selSomLattice,'BackgroundColor','w'); |
346 | 329 |
|
347 |
- model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.20],DEFAULT.svmnfold); |
|
330 |
+ model.txtSOMnfold = createTextField(pSOM,[0.5 0.50 0.25 0.20],''); |
|
348 | 331 |
% set(model.txtSOMnfold,'Enable','off'); |
349 | 332 |
createLabel(pSOM,[0.75 0.5 0.25 0.20 ],'-Fold CrossVal'); |
350 | 333 |
|
... | ... |
@@ -364,10 +347,10 @@ pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3]) |
364 | 347 |
set(pSearchlight,'BackgroundColor',basecolor); |
365 | 348 |
|
366 | 349 |
lSearchligh = createLabel(pSearchlight, [0 0.6 0.5 0.3],'Searchlight Radius'); |
367 |
- model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],DEFAULT.searchlightradius); |
|
350 |
+ model.txtSearchlightRadius = createTextField(pSearchlight,[0.5 0.6 0.5 0.3],''); |
|
368 | 351 |
|
369 | 352 |
lFBSTiming = createLabel(pSearchlight, [0 0.3 0.5 0.3],'Optional Timeline ( e.g. ''-5 0 5 10 15'')'); |
370 |
- model.txtSearchlightTimeline = createTextField(pSearchlight,[0.5 0.3 0.5 0.3],DEFAULT.searchlightTimeline); |
|
353 |
+ model.txtSearchlightTimeline = createTextField(pSearchlight,[0.5 0.3 0.5 0.3],''); |
|
371 | 354 |
|
372 | 355 |
btnRunFBS = uicontrol(pSearchlight,'String','run Spatiotemporal FB classification',... |
373 | 356 |
'Units','normalized',... |
... | ... |
@@ -383,7 +366,7 @@ pSearchlight = uipanel(parent,'Units','normalized','Position',[0.0 0.1 0.5 0.3]) |
383 | 366 |
set(btnRunFBS, 'Callback',{@cbRunDecode,model,'FBS'}); |
384 | 367 |
end |
385 | 368 |
|
386 |
-function model = createVisualStepPanel(model,parent,DEFAULT) |
|
369 |
+function model = createVisualStepPanel(model,parent) |
|
387 | 370 |
|
388 | 371 |
grid_h = 0.25; |
389 | 372 |
grid_w = 0.5; |
... | ... |
@@ -420,8 +403,9 @@ function model = createVisualStepPanel(model,parent,DEFAULT) |
420 | 403 |
|
421 | 404 |
end |
422 | 405 |
|
406 |
+%%%%% ui callbacks |
|
423 | 407 |
|
424 |
-function cbSwitchTask(src,evnt,task,taskpanel,model) |
|
408 |
+function cbSwitchTask(src,evnt,task,taskpanel) |
|
425 | 409 |
set(taskpanel.preprocessing,'Visible','off'); |
426 | 410 |
set(taskpanel.classification,'Visible','off'); |
427 | 411 |
set(taskpanel.plot,'Visible','off'); |
... | ... |
@@ -436,14 +418,10 @@ switch task |
436 | 418 |
|
437 | 419 |
case 'PLOT' |
438 | 420 |
set(taskpanel.plot,'Visible','on'); |
439 |
- |
|
440 | 421 |
end |
441 |
- |
|
442 |
-assignin('base','model',model); |
|
443 |
- |
|
422 |
+% assignin('base','model',model); |
|
444 | 423 |
end |
445 | 424 |
|
446 |
- |
|
447 | 425 |
function cbRunPreprocessing(src,evnt,model,task) |
448 | 426 |
main(model,'pre',task); |
449 | 427 |
end |
... | ... |
@@ -456,51 +434,23 @@ function cbPlot(src,evnt,model,type) |
456 | 434 |
main(model,'plot',type); |
457 | 435 |
end |
458 | 436 |
|
459 |
-function default = mcb_load_study(src,evnt,studyfile) |
|
460 |
- default = load(studyfile); |
|
461 |
-end |
|
437 |
+%%%%%%%%%% menu callbacks |
|
462 | 438 |
|
463 |
-function model = mcb_cd(src,evnt,model) |
|
464 |
-disp('CD'); |
|
465 |
-directory_name = uigetdir(model.baseDir,'Select Study Base Directory ...'); |
|
466 |
-model.baseDir = directory_name; |
|
467 |
-model = scanDirs(model); |
|
439 |
+function mcb_save(src,evnt,model) |
|
440 |
+studyID = get(model.txtStudyID,'String'); |
|
441 |
+saveStudy(studyID,model); |
|
468 | 442 |
end |
469 | 443 |
|
470 |
-function mcb_save(src,evnt,model) |
|
471 |
-disp('SAVE'); |
|
472 |
-baseDir = model.baseDir; |
|
473 |
-timeLine = getTimeLineParams(model); |
|
474 |
-classDefString = getClassDefString(model); |
|
475 |
-coordDefString = getCoordDefString(model); |
|
476 |
- |
|
477 |
-[file path] = uiputfile('*.mat','Save current Params ...',model.baseDir); |
|
478 |
-save( fullfile(path,file),'baseDir','timeLine','classDefString','coordDefString') ; |
|
444 |
+function mcb_new_study(src,evnt,studymenu,uimodel) |
|
445 |
+display('CREATE STUDY'); |
|
446 |
+ ui_createStudy(studymenu,uimodel); |
|
479 | 447 |
end |
480 | 448 |
|
481 |
-function model = mcb_load(src,evnt,model) |
|
482 |
-disp('LOAD'); |
|
483 |
-[file path] = uigetfile('*.mat','Load Params ...',model.baseDir); |
|
484 |
-l = load(fullfile(path,file)); |
|
485 |
-% assignin('base','l',l); |
|
486 |
-model = setTimeLineParams(model,l.timeLine); |
|
487 |
-model = setClassDefString(model,l.classDefString); |
|
488 |
-model = setCoordDefString(model,l.coordDefString); |
|
489 |
-model.baseDir = l.baseDir; |
|
490 |
-model = scanDirs(model); |
|
491 | 449 |
|
492 |
-end |
|
493 | 450 |
|
494 |
-function label = createLabel(parent, pos, labelText) |
|
495 |
- label = uicontrol(parent,'Style','text','Units','normalized','String',labelText,'Position',pos); |
|
496 |
- set(label,'HorizontalAlignment','left'); |
|
497 |
- set(label,'BackgroundColor','w'); |
|
498 |
-end |
|
499 | 451 |
|
500 |
-function txt = createTextField(parent,pos,model) |
|
501 |
-% textfieldcolor = [0.9 0.9 0.0]; |
|
502 |
- textfieldcolor = 'w'; |
|
503 |
- txt = uicontrol(parent,'Style','edit','Units','normalized','String',model,'Position',pos); |
|
504 |
- set(txt,'BackgroundColor',textfieldcolor); |
|
505 |
-end |
|
452 |
+ |
|
453 |
+ |
|
454 |
+ |
|
455 |
+ |
|
506 | 456 |
|
... | ... |
@@ -1,16 +1,20 @@ |
1 | 1 |
function spm_SVMCrossVal(varargin) |
2 | 2 |
|
3 |
-defineGlobals(); |
|
4 |
- |
|
3 |
+%Enter the base directory of your SPM installation |
|
5 | 4 |
global SVMCROSSVAL_SPMDIR; |
6 |
-global SVMCROSSVAL_SPMVERSION; |
|
7 |
-global SVMCROSSVAL_TOOLBOXPATH; |
|
8 |
-global SVMCROSSVAL_DEBUG; |
|
9 |
-% SPMDIR = 'D:\SPM\spm5human' |
|
10 | 5 |
SVMCROSSVAL_SPMDIR = 'D:\SPM\spm2'; |
6 |
+%Enter the SPM version string. Like 'SPM2', 'SPM5', 'SPM8' |
|
7 |
+global SVMCROSSVAL_SPMVERSION; |
|
11 | 8 |
SVMCROSSVAL_SPMVERSION = 'SPM2'; |
12 |
-% SVMCROSSVAL_TOOLBOXPATH = fullfile('C:\Dokumente und Einstellungen\Christoph\Eigene Dateien\MATLAB\spmtoolbox\SVMCrossVal\',''); |
|
13 |
-SVMCROSSVAL_TOOLBOXPATH = fullfile(SVMCROSSVAL_SPMDIR,'toolbox','SVMCrossVal'); |
|
9 |
+ |
|
10 |
+% No Config from here |
|
11 |
+if strcmp(SVMCROSSVAL_SPMDIR,'') || strcmp(SVMCROSSVAL_SPMVERSION,'') |
|
12 |
+ error('spm_SVMCrossVal:main:noinstall','installation not complete!'); |
|
13 |
+end |
|
14 |
+ |
|
15 |
+global SVMCROSSVAL_DEBUG; |
|
16 |
+ |
|
17 |
+defineGlobals(); |
|
14 | 18 |
|
15 | 19 |
switch nargin |
16 | 20 |
case 0 |