new parseVoxelTxtField getImageFileList reads files according to gui-settings voxel to subject coordinate mapping missing.
Christoph Budziszewski

Christoph Budziszewski commited on 2009-02-16 17:32:42
Zeige 8 geänderte Dateien mit 50 Einfügungen und 44 Löschungen.


git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@131 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... ...
@@ -23,7 +23,6 @@ sessionList     = inputStruct.sessionList;
23 23
 
24 24
 % classList       = inputStruct.classList;
25 25
 % labelMap        = inputStruct.labelMap;
26
-smoothed        = inputStruct.smoothed;
27 26
 eventList       = inputStruct.eventList;
28 27
 
29 28
 timeLineStart   = timeline.frameShiftStart;
... ...
@@ -38,9 +37,15 @@ timeLineEnd     = timeline.frameShiftEnd;
38 37
 minPerformance = inf;
39 38
 maxPerformance = -inf;
40 39
 
41
-imageFiles = getImageFileList(des,~smoothed);
40
+subjectDir = '';
41
+sessionDirList = sessionList2DirList(sessionList) ;
42
+mask = '^fandersen.*img$';
43
+imageFiles = getImageFileList(subjectDir,sessionDirList,mask);
42 44
 
43 45
 
46
+disp('press key');
47
+pause
48
+
44 49
 extr = calculateImageData(imageFiles,voxelList);
45 50
 
46 51
 nVoxel = size(voxelList,1);
... ...
@@ -1,24 +1,9 @@
1
-function fileList = getImageFileList(des,use_smoothed_image_hack)
1
+function fileList = getImageFileList(subjectdir,sessionlist,mask)
2
+fileList = [];
2 3
 
3
-global USE_DRIVE_CHECK_HACK;
4
-
5
-fileList  = des.xY.VY;
6
-nFiles = length(fileList);
7
-
8
-if USE_DRIVE_CHECK_HACK
9
-    if fileList(1).fname(1)~='D'
10
-        for z=1:nFiles % Change Drive Letter - HACK!
11
-            fileList(z).fname(1) = 'D';
12
-        end;
13
-    end
14
-end
15
-if ~use_smoothed_image_hack
16
-    for z=1:nFiles % Change smoothed Filename - HACK!
17
-        % D:....SUBJECTID\session\swfanders...
18
-        % D:....SUBJECTID\session\wfanders...
19
-        tmp = findstr(filesep,fileList(z).fname);
20
-        fileList(z).fname = strcat(fileList(z).fname(1:tmp(end)),fileList(z).fname(tmp(end)+2:end));
21
-    end;
4
+for session = 1:numel(sessionlist)    
5
+    [sessionFileList dd] = spm_select('FPList',fullfile(subjectdir,sessionlist{session}),mask);
6
+    fileList = [fileList; sessionFileList];
22 7
 end
23 8
 
24 9
 end
25 10
\ No newline at end of file
... ...
@@ -10,12 +10,14 @@ outstruct.eventMatrix = [];
10 10
 
11 11
 for i = 1:nClasses
12 12
     line = txt(i,:);
13
-    delim = strfind(line,','); %first and last are real delimiter
14 13
     
15
-    outstruct.labelCells{i} = strtrunc(line(1:delim(1)-1));
16
-    outstruct.conditionCells{i} = eval(strtrunc(line(delim(1)+1:delim(length(delim))-1)));
17
-    outstruct.eventMatrix   = [outstruct.eventMatrix ; outstruct.conditionCells{i}];
18
-    outstruct.valueCells{i} = strtrunc(line(delim(length(delim))+1:length(line)));
14
+    [label rem] = strtok(line,',');
15
+    
16
+    outstruct.labelCells{i} = strtrim(label);
17
+    
18
+    conds = eval(strtrim(rem(2:end)));
19
+    outstruct.conditionCells{i} = conds;
20
+    outstruct.eventMatrix   = [outstruct.eventMatrix ; conds];
19 21
 end
20 22
 
21 23
 end
... ...
@@ -0,0 +1,17 @@
1
+function voxelList = parseCoordinateTextField(txtFieldHandel)
2
+s = get(txtFieldHandel,'String');
3
+rows = size(s,1);
4
+voxelList = [];
5
+    for i = 1:rows 
6
+        if all(isspace(s(i,:)))
7
+            continue;
8
+        end
9
+        line = s(i,:);
10
+        [roi rem] = strtok(line,'+');
11
+        roimod = eval(str2mat(rem(2:end)));
12
+        coord.name = roi;
13
+        coord.mod = roimod;
14
+        voxelList = [voxelList; coord];
15
+
16
+    end
17
+end
0 18
\ No newline at end of file
... ...
@@ -32,20 +32,20 @@ global SVMCROSSVAL_VOXEL_SELECTION_MODE_DEF;
32 32
         
33 33
         calculateParams.RANDOMIZE       = 0;
34 34
         
35
-        calculateParams.smoothed        = getChkValue(paramModel.chkSmoothed);
35
+%         calculateParams.smoothed        = getChkValue(paramModel.chkSmoothed);
36 36
 
37
-        calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
37
+%         calculateParams.svmargs         = get(paramModel.txtSVMopts,'String');
38 38
         calculateParams.sessionList     = 1:3;
39 39
 
40 40
         classStruct = parseClassDef(paramModel);
41 41
         
42 42
         
43
-        calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
44
-        calculateParams.classList       = getClasses(calculateParams.labelMap);
43
+%         calculateParams.labelMap        = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel
44
+%         calculateParams.classList       = getClasses(calculateParams.labelMap);
45 45
         calculateParams.eventList       = classStruct.eventMatrix; %[9,11,13; 10,12,14];
46 46
 %         calculateParams.eventList       = getPSTEventMatrix(calculateParams.labelMap);
47 47
         
48
-        subjectSelection = getSubjectIDString(paramModel);
48
+        subjectSelection = {'JZ006'}; %getSubjectIDString(paramModel);
49 49
         calculateParams.subjectSelection = subjectSelection;
50 50
         
51 51
         decode = claculateMultiSubjectDecodePerformance(timelineParams,calculateParams,paramModel);
... ...
@@ -94,7 +94,7 @@ for subjectCell = calculateParams.subjectSelection
94 94
     subjectParams.des             = spm.SPM;
95 95
 
96 96
 
97
-    subjectParams.voxelList       = parseVoxelList(paramModel,SubjectID);
97
+    subjectParams.voxelList       = mapVoxelList(voxelList,SubjectID);
98 98
 
99 99
     
100 100
     subjectParams.SubjectID       = SubjectID;
... ...
@@ -0,0 +1,5 @@
1
+function sessionDirList = sessionList2DirList(sessionList)
2
+for i = 1:numel(sessionList)
3
+    sessionDirList{i} = char(96+sessionList(i));
4
+end
5
+end
... ...
@@ -240,6 +240,8 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
240 240
         set(model.txtVoxelDef,'Min',0);
241 241
         set(model.txtVoxelDef, 'FontName', 'FixedWidth');
242 242
         
243
+        assignin('base','txtVoxelDef',model.txtVoxelDef);
244
+        
243 245
         %normalizations
244 246
         pNorm = uipanel(parent,'Title','Normalization','Position',cell2mat(main_grid(2,3)));
245 247
         set(pNorm,'BackgroundColor','w');
... ...
@@ -1,25 +1,15 @@
1 1
 function spm_SVMCrossVal(varargin)
2 2
 
3
-SVMCROSSVAL_BASEDIR = fullfile('D:','Analyse','Choice');
4
-
5 3
 defineGlobals();
6 4
 
7 5
 switch nargin
8 6
 case 0
9
-% 	project_UI;
10
-	main_UI(varargin);
11
-case 1
12
-	main_UI(varargin);
7
+	ui_main(varargin);
13 8
 otherwise
14 9
 error('spm_SVMCrossVal:main','wrong nargin');
15 10
 end
16 11
 end
17 12
 
18
-function loadStudies(basedir)
19
-
20
-end
21
-
22
-
23 13
 
24 14
 
25 15
 
26 16