Browse code

SPM2 compatibilität begonnen

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

Christoph Budziszewski authored on 20/05/2009 16:17:09
Showing 5 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,20 @@
1
+function fileList = getFilteredFileList(directory,filterpattern,fullpath)
2
+if nargin < 3
3
+    fullpath = 1;
4
+end
5
+files = dir(directory);
6
+fileList = [];
7
+
8
+for f = 1:numel(files)
9
+    if files(f).isdir
10
+        continue
11
+    end
12
+    if regexp(files(f).name,filterpattern,'once')
13
+        if fullpath
14
+            fileList = strvcat(fileList, fullfile(directory,files(f).name));
15
+        else
16
+            fileList = strvcat(fileList, files(f).name);
17
+        end
18
+    end
19
+end
20
+end
0 21
\ No newline at end of file
... ...
@@ -1,10 +1,19 @@
1 1
 function fileList = getImageFileList(subjectdir,sessionlist,mask)
2 2
 fileList = [];
3 3
 
4
-for session = sessionlist;    
5
-    [sessionFileList dd] = spm_select('FPList',fullfile(subjectdir,getSessionDirName(session)),mask);
6
-    fileList = [fileList; sessionFileList];
7
-end
4
+switch getSPMVersion
8 5
 
6
+    case 'SPM5'
7
+        for session = sessionlist;
8
+            [sessionFileList dd] = spm_select('FPList',fullfile(subjectdir,getSessionDirName(session)),mask);
9
+            fileList = [fileList; sessionFileList];
10
+        end
11
+    otherwise
12
+        for session = sessionlist;
13
+            sessiondir = fullfile(subjectdir,getSessionDirName(session));
14
+            fileList = strvcat(fileList, getFilteredFileList(sessiondir,mask,1));
15
+        end
16
+end
17
+% fileList
9 18
 end
10 19
 
11 20
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+function spmv = getSPMVersion
2
+
3
+% spmv = 'SPM5';
4
+spmv = 'SPM2';
5
+
6
+end
0 7
\ No newline at end of file
... ...
@@ -1,9 +1,17 @@
1 1
 function imageMask = imageMaskNames(subjectDir)
2 2
 
3
-filter = '^.*\.hdr$';
4
-[files, dirs] = spm_select('List', fullfile(subjectDir,'a'), filter);
3
+switch getSPMVersion
4
+    case 'SPM5'
5
+        filter = '^.*\.hdr$';
6
+        [files, dirs] = spm_select('List', fullfile(subjectDir,'a'), filter);
7
+    case 'SPM2'
8
+        files = 'swrfandersen-0003-00001-000001.hdr';
9
+    otherwise
10
+        filter = '^.*\.hdr$';
11
+        files = getFilteredFileList(fullfile(subjectDir,'a'),filter,0);
12
+end
5 13
 
6
-for i = 1:length(files)
14
+for i = 1:size(files,1)
7 15
 %     rfiles = regexpi(files(i,:),'^.*.-','match')
8 16
     files(i,:);
9 17
     token{i} = strtok(files(i,:),'-');
... ...
@@ -1,6 +1,6 @@
1 1
 function ui_main(varargin)
2 2
 
3
-DEFAULT.selectedSubject = [2];
3
+DEFAULT.selectedSubject = [1];
4 4
 
5 5
 DEFAULT.pststart        = -5;
6 6
 DEFAULT.pstend          = 15;
... ...
@@ -22,7 +22,8 @@ DEFAULT.somN = 3;
22 22
 DEFAULT.somLattice = 1;
23 23
 
24 24
 
25
-DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
25
+DEFAULT.wd  = fullfile('d:','Analyze','Stimolos');
26
+% DEFAULT.wd  = fullfile('d:','Analyze','Choice','24pilot');
26 27
 % DEFAULT.wd  = fullfile('/','media','fMRI');
27 28
 
28 29
 %  Initialize and hide the GUI as it is being constructed.
... ...
@@ -225,7 +226,7 @@ function model = createFirstStepPanel(model,parent,DEFAULT)
225 226
         'Position',[0.0 0.0 1 0.5],...
226 227
         'String',imageRegExList,...
227 228
         'UserData',imageRegExList,...
228
-        'Value',3);
229
+        'Value',1);
229 230
         set(model.imageTypeSelection,'BackgroundColor','w');
230 231
         
231 232