Christoph Budziszewski commited on 2009-05-22 11:16:41
Zeige 18 geänderte Dateien mit 90 Einfügungen und 42 Löschungen.
git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@195 83ab2cfd-5345-466c-8aeb-2b2739fb922d
| ... | ... |
@@ -1,10 +1,11 @@ |
| 1 | 1 |
function output = runFBSImageMaskMode(header,subjectdata,fbsargs) |
| 2 |
-addpath('NIFTI_20090325');
|
|
| 2 |
+addpath(fullfile(getTbxPath,'NIFTI_20090325')); |
|
| 3 | 3 |
|
| 4 |
-DEBUG = 0; |
|
| 4 |
+SVMCROSSVAL_DEBUG = 0; |
|
| 5 | 5 |
NORM_DECODE = 0; % 1: normalize to [-1:1], 0: normalize to [0:1] |
| 6 | 6 |
|
| 7 |
-savePath = fullfile('output',datestr(now,30));
|
|
| 7 |
+subjectResultDir |
|
| 8 |
+savePath = fullfile(subjectResultDir,'fbs',datestr(now,30)); |
|
| 8 | 9 |
mkdir(savePath); |
| 9 | 10 |
|
| 10 | 11 |
args = header.args; |
| ... | ... |
@@ -99,7 +100,7 @@ for s = 1:nSubjects |
| 99 | 100 |
% sprintf(' %g%%\t complete',p);
|
| 100 | 101 |
% end |
| 101 | 102 |
end |
| 102 |
- if DEBUG == 1 |
|
| 103 |
+ if isDebug |
|
| 103 | 104 |
figure; |
| 104 | 105 |
hold on; |
| 105 | 106 |
for i = 1:size(pst,2) |
| ... | ... |
@@ -3,7 +3,7 @@ function [sD sM] = som_train(svmlabel, svmdata, somOptions) |
| 3 | 3 |
som_size = somOptions.size; |
| 4 | 4 |
som_lattice = somOptions.lattice; |
| 5 | 5 |
|
| 6 |
-addpath 'somtoolbox2'; |
|
| 6 |
+addpath(fullfile(getTbxPath,'somtoolbox2')); |
|
| 7 | 7 |
sD = som_data_struct(svmdata,'labels',num2str(svmlabel)); |
| 8 | 8 |
|
| 9 | 9 |
sM = som_make(sD,'msize', som_size,'lattice', som_lattice, 'tracking', 1, 'init', 'lininit'); |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 1 |
+function ui_createStudy() |
|
| 2 |
+ frameWidth=450; |
|
| 3 |
+ frameHeight=450; |
|
| 4 |
+ |
|
| 5 |
+ frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]);
|
|
| 6 |
+ movegui(frame,'west'); % get this thing visible on smaller displays. |
|
| 7 |
+ set(frame,'Name','Create Study'); |
|
| 8 |
+ set(frame,'NumberTitle','off'); |
|
| 9 |
+ set(frame,'MenuBar','none'); |
|
| 10 |
+% set(frame,'Color',get(0,'defaultUicontrolBackgroundColor')); |
|
| 11 |
+ set(frame,'Resize','on'); |
|
| 12 |
+ set(frame,'Units','normalized'); |
|
| 13 |
+ set(frame,'Color','y'); |
|
| 14 |
+ |
|
| 15 |
+ |
|
| 16 |
+end |
|
| 0 | 17 |
\ No newline at end of file |
| ... | ... |
@@ -1,31 +1,5 @@ |
| 1 | 1 |
function ui_main(varargin) |
| 2 | 2 |
|
| 3 |
-DEFAULT.selectedSubject = [1]; |
|
| 4 |
- |
|
| 5 |
-DEFAULT.pststart = -5; |
|
| 6 |
-DEFAULT.pstend = 40; |
|
| 7 |
-DEFAULT.baselinestart = 0; |
|
| 8 |
-DEFAULT.baselineend = 0; |
|
| 9 |
-DEFAULT.trfactor = 0.5; |
|
| 10 |
-DEFAULT.frameshiftstart = -5; |
|
| 11 |
-DEFAULT.frameshiftend = 15; |
|
| 12 |
-DEFAULT.frameshiftdur = 0; |
|
| 13 |
-DEFAULT.classdefstring = 'A,\t[9,11]\nB,\t[13,14]'; |
|
| 14 |
-DEFAULT.voxelstring = 'SPL l + 3 \nSPL r + 3\n'; |
|
| 15 |
-DEFAULT.svmoptstring = '-s 0 -t 0 -c 1'; |
|
| 16 |
-DEFAULT.svmnfold = '6'; |
|
| 17 |
-DEFAULT.svmrnd = 1; |
|
| 18 |
-DEFAULT.searchlightradius = 3; |
|
| 19 |
-DEFAULT.searchlightTimeline = ''; |
|
| 20 |
-DEFAULT.somM = 3; |
|
| 21 |
-DEFAULT.somN = 3; |
|
| 22 |
-DEFAULT.somLattice = 1; |
|
| 23 |
- |
|
| 24 |
- |
|
| 25 |
-DEFAULT.wd = fullfile('d:','Analyze','Stimolos');
|
|
| 26 |
-% DEFAULT.wd = fullfile('d:','Analyze','Choice','24pilot');
|
|
| 27 |
-% DEFAULT.wd = fullfile('/','media','fMRI');
|
|
| 28 |
- |
|
| 29 | 3 |
% Initialize and hide the GUI as it is being constructed. |
| 30 | 4 |
frameWidth=450; |
| 31 | 5 |
frameHeight=450; |
| ... | ... |
@@ -42,6 +16,8 @@ DEFAULT.wd = fullfile('d:','Analyze','Stimolos');
|
| 42 | 16 |
|
| 43 | 17 |
task = struct; |
| 44 | 18 |
|
| 19 |
+ DEFAULT = mcb_load_study(0,0,'study/stimolos.mat'); |
|
| 20 |
+ |
|
| 45 | 21 |
model1 = struct; |
| 46 | 22 |
model1.baseDir = DEFAULT.wd; |
| 47 | 23 |
|
| ... | ... |
@@ -110,7 +86,8 @@ DEFAULT.wd = fullfile('d:','Analyze','Stimolos');
|
| 110 | 86 |
uimenu(savemenu,'Label','Save All','Callback',{@mcb_save,model1},'Enable','off');
|
| 111 | 87 |
uimenu(savemenu,'Label','Load All','Callback',{@mcb_load,model1},'Enable','off');
|
| 112 | 88 |
|
| 113 |
- uimenu(frame,'Label','change Study','Callback',{@mcb_cd,model1},'Enable','off');
|
|
| 89 |
+ studymenu = uimenu(frame,'Label','change Study','Enable','on'); |
|
| 90 |
+ fillStudyMenu(studymenu); |
|
| 114 | 91 |
|
| 115 | 92 |
cbSwitchTask(0,0,'PRE',task,model1); |
| 116 | 93 |
|
| ... | ... |
@@ -119,6 +95,16 @@ DEFAULT.wd = fullfile('d:','Analyze','Stimolos');
|
| 119 | 95 |
|
| 120 | 96 |
end |
| 121 | 97 |
|
| 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 |
+end |
|
| 107 |
+ |
|
| 122 | 108 |
function model = createFirstStepPanel(model,parent,DEFAULT) |
| 123 | 109 |
|
| 124 | 110 |
main_grid = cell(2,4); |
| ... | ... |
@@ -470,6 +456,9 @@ function cbPlot(src,evnt,model,type) |
| 470 | 456 |
main(model,'plot',type); |
| 471 | 457 |
end |
| 472 | 458 |
|
| 459 |
+function default = mcb_load_study(src,evnt,studyfile) |
|
| 460 |
+ default = load(studyfile); |
|
| 461 |
+end |
|
| 473 | 462 |
|
| 474 | 463 |
function model = mcb_cd(src,evnt,model) |
| 475 | 464 |
disp('CD');
|
| ... | ... |
@@ -1,3 +1,20 @@ |
| 1 | 1 |
function imageList = ui_selectRoiImage(formatstring,wd) |
| 2 |
+ |
|
| 3 |
+switch getSPMVersion |
|
| 4 |
+ case 'SPM5' |
|
| 2 | 5 |
imageList = spm_vol(spm_select([1 Inf],'image',formatstring,[],wd)); |
| 6 |
+ case 'SPM2' |
|
| 7 |
+ imageList = spm_vol(spm_get([1 Inf],'img',formatstring,wd,0)); |
|
| 8 |
+ otherwise |
|
| 9 |
+ [filematrix pathmatrix]= uigetfile(... |
|
| 10 |
+ {'*.nii;*.img;', 'All NIFTI/ANALYZE Files (*.hdr, *.nii, )'; ...
|
|
| 11 |
+ '*.*', 'All Files (*.*)'}, ... |
|
| 12 |
+ formatstring,... |
|
| 13 |
+ wd,... |
|
| 14 |
+ 'MultiSelect', 'off'); |
|
| 15 |
+ |
|
| 16 |
+ imageList = spm_vol([pathmatrix filematrix]); |
|
| 3 | 17 |
end |
| 18 |
+end |
|
| 19 |
+ |
|
| 20 |
+ |
| ... | ... |
@@ -2,9 +2,23 @@ function spm_SVMCrossVal(varargin) |
| 2 | 2 |
|
| 3 | 3 |
defineGlobals(); |
| 4 | 4 |
|
| 5 |
+global SVMCROSSVAL_SPMDIR; |
|
| 6 |
+global SVMCROSSVAL_SPMVERSION; |
|
| 7 |
+global SVMCROSSVAL_TOOLBOXPATH; |
|
| 8 |
+global SVMCROSSVAL_DEBUG; |
|
| 9 |
+% SPMDIR = 'D:\SPM\spm5human' |
|
| 10 |
+SVMCROSSVAL_SPMDIR = 'D:\SPM\spm2'; |
|
| 11 |
+SVMCROSSVAL_SPMVERSION = 'SPM2'; |
|
| 12 |
+SVMCROSSVAL_TOOLBOXPATH = fullfile('C:\Dokumente und Einstellungen\Christoph\Eigene Dateien\MATLAB\spmtoolbox\SVMCrossVal\','');
|
|
| 13 |
+% SVMCROSSVAL_TOOLBOXPATH = fullfile(SVMCROSSVAL_SPMDIR,'toolbox'); |
|
| 14 |
+ |
|
| 5 | 15 |
switch nargin |
| 6 | 16 |
case 0 |
| 7 |
- ui_main(varargin); |
|
| 17 |
+ SVMCROSSVAL_DEBUG = 0; |
|
| 18 |
+ ui_main(); |
|
| 19 |
+ case 1 |
|
| 20 |
+ SVMCROSSVAL_DEBUG = varargin(1); |
|
| 21 |
+ ui_main(); |
|
| 8 | 22 |
otherwise |
| 9 | 23 |
error('spm_SVMCrossVal:main','wrong nargin');
|
| 10 | 24 |
end |