Christoph Budziszewski commited on 2009-02-25 13:40:40
Zeige 13 geänderte Dateien mit 85 Einfügungen und 336 Löschungen.
git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@137 83ab2cfd-5345-466c-8aeb-2b2739fb922d
... | ... |
@@ -1,20 +0,0 @@ |
1 |
-function vValue = VoxelValueAtTimepoint (coordinate, timepoint) |
|
2 |
-% single Voxel for single coordinate |
|
3 |
- |
|
4 |
-if(size(coordinate,2)>1) |
|
5 |
- error('VoxelValueAtTimepoint:CoordinateError','only single Coordinate permitted.'); |
|
6 |
-end |
|
7 |
- |
|
8 |
-imageNumber = timePointToImageNumber(timepoint, 's'); |
|
9 |
-V = evalin('base','SPM.xY.VY'); % Memory Mapped Images |
|
10 |
-center = round(inv(V(imageNumber).mat)*[coordinate; 1]); |
|
11 |
- |
|
12 |
-x = center(1,1); |
|
13 |
-y = center(2,1); |
|
14 |
-z = center(3,1); |
|
15 |
- |
|
16 |
-vValue = spm_sample_vol(V(imageNumber), x, y, z, 0); |
|
17 |
- |
|
18 |
-end |
|
19 |
- |
|
20 |
- |
... | ... |
@@ -0,0 +1,30 @@ |
1 |
+function extr = calculateRoiImageData(filenameList,roiImageList) |
|
2 |
+ |
|
3 |
+V = filenameList; |
|
4 |
+nImage = numel(V); |
|
5 |
+Vm = roiImageList; |
|
6 |
+nRoi = numel(Vm); |
|
7 |
+ |
|
8 |
+for kImage=1:nImage |
|
9 |
+ x = []; y = []; z = []; |
|
10 |
+ dat = []; |
|
11 |
+ for iRoiFile = 1:nRoi |
|
12 |
+ [x1 y1] = ndgrid(1:V(kImage).dim(1),1:V(kImage).dim(2)); |
|
13 |
+ for p = 1:V(kImage).dim(3) % resample mask Vm(i) in space of V(k) |
|
14 |
+ B = spm_matrix([0 0 -p 0 0 0 1 1 1]); |
|
15 |
+ M = inv(B*inv(V(kImage).mat)*Vm(iRoiFile).mat); |
|
16 |
+ msk = find(spm_slice_vol(Vm(iRoiFile),M,V(kImage).dim(1:2),0)); |
|
17 |
+ if ~isempty(msk) |
|
18 |
+ z1 = p*ones(size(msk(:))); |
|
19 |
+ x = [x; x1(msk(:))]; |
|
20 |
+ y = [y; y1(msk(:))]; |
|
21 |
+ z = [z; z1]; |
|
22 |
+ end |
|
23 |
+ end |
|
24 |
+ dat = [dat spm_sample_vol(V(kImage), x, y, z,0)]; |
|
25 |
+ |
|
26 |
+ end |
|
27 |
+ extr(kImage).dat = dat; |
|
28 |
+end |
|
29 |
+ |
|
30 |
+end |
|
0 | 31 |
\ No newline at end of file |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
function fileList = getImageFileList(subjectdir,sessionlist,mask) |
2 | 2 |
fileList = []; |
3 | 3 |
|
4 |
-for session = 1:numel(sessionlist) |
|
5 |
- [sessionFileList dd] = spm_select('FPList',fullfile(subjectdir,sessionlist{session}),mask); |
|
4 |
+for session = sessionlist; |
|
5 |
+ [sessionFileList dd] = spm_select('FPList',fullfile(subjectdir,getSessionDirName(session)),mask); |
|
6 | 6 |
fileList = [fileList; sessionFileList]; |
7 | 7 |
end |
8 | 8 |
|
... | ... |
@@ -15,51 +13,27 @@ switch task |
15 | 13 |
disp('COORD'); |
16 | 14 |
coordinates= 'parse me'; |
17 | 15 |
runCoordTable() |
16 |
+ |
|
18 | 17 |
case 'ROI' |
19 | 18 |
disp('ROI'); |
20 |
- runROIImageMaskMode(subjects,timeLine) |
|
21 |
- case 'FBS' |
|
22 |
- disp('FBS') |
|
23 |
-end |
|
24 |
- |
|
25 |
-return |
|
26 |
- |
|
27 |
-timeline = getTimeLineParams(parameterModel); |
|
28 |
-switch action |
|
29 |
- case 'COORD-LOOKUP-TABLE' |
|
30 |
- runCoordTable(timeline,parameterModel); |
|
31 |
- case 'ROI-IMAGE-MASK' |
|
32 |
- runROIImageMaskMode(timeline,parameterModel); |
|
33 |
- disp('DONE'); |
|
34 |
- case 'FULL-BRAIN' |
|
35 |
- error('SVMCrossVal:main:notImplemented','Feature not yet implemented'); |
|
36 |
- otherwise |
|
37 |
- error('SVMCrossVal:main:actionError','Wrong ''action''. Use the GUI.'); |
|
38 |
-end |
|
39 |
-end |
|
19 |
+ roiargs = struct; |
|
20 |
+ roiargs.subjects = subjects; |
|
21 |
+ roiargs.timeline = timeLine; |
|
22 |
+ roiargs.classes = classDef; |
|
23 |
+ roiargs.mask = getImageFileMask(model); |
|
24 |
+ roiargs.basedir = model.baseDir; |
|
40 | 25 |
|
41 | 26 |
|
27 |
+ assignin('base','roiargs',roiargs); |
|
42 | 28 |
|
29 |
+ runROIImageMaskMode(roiargs); |
|
43 | 30 |
|
31 |
+ case 'FBS' |
|
32 |
+ disp('FBS') |
|
33 |
+end |
|
44 | 34 |
|
35 |
+end |
|
45 | 36 |
|
46 |
-function calculateParams = parseCalculateParams(paramModel) |
|
47 |
-calculateParams = struct; |
|
48 |
-calculateParams.smoothed = getChkValue(paramModel.chkSmoothed); |
|
49 |
-calculateParams.svmargs = get(paramModel.txtSVMopts,'String'); |
|
50 |
-calculateParams.sessionList = 1:3; |
|
51 | 37 |
|
52 |
-calculateParams.CROSSVAL_METHOD = CROSSVAL_METHOD_DEF.svmcrossval; |
|
53 |
-calculateParams.VOXEL_SELECTION_MODE = VOXEL_SELECTION_MODE_DEF.roiImage; |
|
54 |
-calculateParams.PROJECT_BASE_PATH = PROJECT_BASE_PATH; |
|
55 |
-calculateParams.PROJECT_RESULT_PATH = PROJECT_RESULT_PATH; |
|
56 |
-calculateParams.RANDOMIZE = 0; |
|
57 | 38 |
|
58 |
-classStruct = parseClassDef(paramModel); |
|
59 |
-calculateParams.labelMap = LabelMap(classStruct.labelCells , classStruct.conditionCells, 'auto'); % LabelMap({'<','>','<+<','>+>','<+>','>+<'},{-2,-1,1,2,3,4}); 0 is autolabel |
|
60 |
-calculateParams.classList = getClasses(calculateParams.labelMap); |
|
61 |
-calculateParams.eventList = classStruct.eventMatrix; %[9,11,13; 10,12,14]; |
|
62 |
-calculateParams.subjectSelection = subjectSelection; |
|
63 | 39 |
|
64 |
-% assignin('base','calculateParams',calculateParams); |
|
65 |
-end |
... | ... |
@@ -1,179 +0,0 @@ |
1 |
-function main_UI(args) |
|
2 |
- |
|
3 |
-global CROSSVAL_METHOD_DEF; |
|
4 |
- |
|
5 |
-DEFAULT.selectedSubject = 1; |
|
6 |
-DEFAULT.smoothed = 1; |
|
7 |
-DEFAULT.multisubject = 'single'; |
|
8 |
-DEFAULT.pststart = -15; |
|
9 |
-DEFAULT.pstend = 40; |
|
10 |
-DEFAULT.baselinestart = -3; |
|
11 |
-DEFAULT.baselineend = -1; |
|
12 |
-DEFAULT.frameshiftstart = -5; |
|
13 |
-DEFAULT.frameshiftend = 35; |
|
14 |
-DEFAULT.frameshiftdur = 0; |
|
15 |
-DEFAULT.classdefstring = 'left,\t[9,11,13],\t -2 ;\nright,\t[10,12,14],\t -1;'; |
|
16 |
-DEFAULT.voxelstring = 'SPL l,\t[ 0, 0, 0];\nSPL r,\t[ 0, 0, 0];\n'; |
|
17 |
-DEFAULT.svmoptstring = '-s 0 -t 0 -v 6 -c 1'; |
|
18 |
- |
|
19 |
-% Initialize and hide the GUI as it is being constructed. |
|
20 |
- frameWidth=450; |
|
21 |
- frameHeight=600; |
|
22 |
- frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]); |
|
23 |
- movegui(frame,'west'); % get this thing visible on smaller displays. |
|
24 |
- |
|
25 |
- set(frame,'Name','SVMCrossVal Decode Performance 4 SPM'); |
|
26 |
- set(frame,'NumberTitle','off'); |
|
27 |
- set(frame,'MenuBar','none'); |
|
28 |
- set(frame,'Color',get(0,'defaultUicontrolBackgroundColor')); |
|
29 |
- set(frame,'Resize','off'); |
|
30 |
- set(frame,'Units','normalize'); |
|
31 |
- |
|
32 |
- |
|
33 |
- savemenu = uimenu(frame,'Label','Save/Load'); |
|
34 |
- |
|
35 |
-% model.subjectMap = SubjectRoiMapping(project); |
|
36 |
- model.subjectMap = SubjectRoiMapping; |
|
37 |
- |
|
38 |
- nElementRows = 24; |
|
39 |
- optionLineHeight = 1.0/nElementRows; |
|
40 |
- controlElementHeight=optionLineHeight*(1.0/1.5)*frameHeight; |
|
41 |
- pSubject = uipanel(frame,'Title','Subject', 'Position',[0 optionLineHeight*19 frameWidth optionLineHeight*5]); |
|
42 |
- pPSTH = uipanel(frame,'Title','PSTH Options', 'Position',[0 optionLineHeight*14 frameWidth optionLineHeight*5]); |
|
43 |
- pCLASS = uipanel(frame,'Title','Class Definitions','Position',[0 optionLineHeight*9 frameWidth optionLineHeight*5]); |
|
44 |
- pVOXEL = uipanel(frame,'Title','Voxel Selector', 'Position',[0 optionLineHeight*3 frameWidth optionLineHeight*6]); |
|
45 |
- pSVM = uipanel(frame,'Title','SVM Options', 'Position',[0 optionLineHeight*1 frameWidth optionLineHeight*2]); |
|
46 |
- btnRunButton1 = uicontrol(frame,'Tag','Coord-Table','String','run coord-Table','Position',[2 optionLineHeight*0 (frameWidth/2) controlElementHeight*1.6]); |
|
47 |
- btnRunButton2 = uicontrol(frame,'Tag','ROI-Image','String','run ROI-Image processing','Position',[2+(frameWidth/2) optionLineHeight*0 (frameWidth/2) controlElementHeight*1.6]); |
|
48 |
- |
|
49 |
- |
|
50 |
- % Subject |
|
51 |
- firstColumn = 5.00; |
|
52 |
- firstRow = 1.00 * controlElementHeight; |
|
53 |
- |
|
54 |
- model.subjectSelector = uicontrol(pSubject,'Style','listbox',... |
|
55 |
- 'Min',1, 'Max',3,... |
|
56 |
- 'String',getSubjectCellList(model.subjectMap),... |
|
57 |
- 'Value',DEFAULT.selectedSubject,... % default selected item |
|
58 |
- 'Position',[firstColumn firstRow 0.66*frameWidth controlElementHeight*6]); |
|
59 |
- set(model.subjectSelector,'BackgroundColor','w'); |
|
60 |
- |
|
61 |
- model.chkSmoothed = uicontrol(pSubject,'Style','checkbox','Position',[0.68*frameWidth firstRow 0.25*frameWidth controlElementHeight],'Value',DEFAULT.smoothed); |
|
62 |
- createLabel(pSubject,[0.75*frameWidth firstRow 0.25*frameWidth controlElementHeight],'Smooth Data?'); |
|
63 |
- |
|
64 |
- createLabel(pSubject,[0.68*frameWidth firstRow*4 0.25*frameWidth controlElementHeight],'Analysis Method'); |
|
65 |
- |
|
66 |
- model.analysisMethodSelector = uicontrol(pSubject,'Style','popupmenu',... |
|
67 |
- 'Position',[0.68*frameWidth firstRow*3 0.25*frameWidth controlElementHeight],... |
|
68 |
- 'String',{CROSSVAL_METHOD_DEF.svmcrossval, CROSSVAL_METHOD_DEF.classPerformance},... |
|
69 |
- 'Value',1); |
|
70 |
- set(model.analysisMethodSelector,'BackgroundColor','w'); |
|
71 |
-% set(model.analysisMethodSelector,'enable','off'); |
|
72 |
- |
|
73 |
- % PSTH |
|
74 |
- firstColumn = 5.00; |
|
75 |
- secondColumn = 0.33*frameWidth; |
|
76 |
- thirdColumn = 0.66*frameWidth; |
|
77 |
-% fourthColumn = 0.84*frameWidth; |
|
78 |
- |
|
79 |
- firstRow = 5.5*controlElementHeight; |
|
80 |
- secondRow = 4.5*controlElementHeight; |
|
81 |
- thirdRow = 3.5*controlElementHeight; |
|
82 |
- fourthRow = 2.5*controlElementHeight; |
|
83 |
- fifthRow = 1.0*controlElementHeight; |
|
84 |
- |
|
85 |
- lStart = createLabel(pPSTH, [secondColumn firstRow 0.33*frameWidth controlElementHeight],'Start [sec]'); |
|
86 |
- lEnd = createLabel(pPSTH, [thirdColumn firstRow 0.33*frameWidth controlElementHeight],'End [sec]'); |
|
87 |
- lPSTH = createLabel(pPSTH, [firstColumn secondRow 0.33*frameWidth controlElementHeight],'PSTH Range'); |
|
88 |
- lBaseline = createLabel(pPSTH, [firstColumn thirdRow 0.33*frameWidth controlElementHeight],'Baseline'); |
|
89 |
- lFrameShift = createLabel(pPSTH, [firstColumn fourthRow 0.33*frameWidth controlElementHeight],'SVM Frame Shift'); |
|
90 |
- lFramsSize = createLabel(pPSTH, [firstColumn fifthRow 0.33*frameWidth controlElementHeight],'SVM Frame Size'); |
|
91 |
- |
|
92 |
- |
|
93 |
- model.txtPSTHStart = createTextField(pPSTH,[secondColumn secondRow 0.25*frameWidth controlElementHeight],DEFAULT.pststart); |
|
94 |
- model.txtPSTHEnd = createTextField(pPSTH,[thirdColumn secondRow 0.25*frameWidth controlElementHeight],DEFAULT.pstend); |
|
95 |
- model.txtBaselineStart = createTextField(pPSTH,[secondColumn thirdRow 0.25*frameWidth controlElementHeight],DEFAULT.baselinestart); |
|
96 |
- model.txtBaselineEnd = createTextField(pPSTH,[thirdColumn thirdRow 0.25*frameWidth controlElementHeight],DEFAULT.baselineend); |
|
97 |
- model.txtFrameShiftStart = createTextField(pPSTH,[secondColumn fourthRow 0.25*frameWidth controlElementHeight],DEFAULT.frameshiftstart); |
|
98 |
- model.txtFrameShiftEnd = createTextField(pPSTH,[thirdColumn fourthRow 0.25*frameWidth controlElementHeight],DEFAULT.frameshiftend); |
|
99 |
- model.txtFrameShiftDur = createTextField(pPSTH,[secondColumn fifthRow 0.25*frameWidth controlElementHeight],DEFAULT.frameshiftdur); |
|
100 |
- |
|
101 |
- |
|
102 |
- %Classes |
|
103 |
- nClassRows = 6; |
|
104 |
- firstColumn = 5.00; |
|
105 |
- |
|
106 |
- firstRow = (nClassRows-0.5)*controlElementHeight; |
|
107 |
- secondRow = (nClassRows-4.5)*controlElementHeight; |
|
108 |
- |
|
109 |
- lClassDef = createLabel(pCLASS, [firstColumn firstRow 0.66*frameWidth controlElementHeight],'<Label>,<[Event,Event,..]>,<SVM-Value>;'); |
|
110 |
- model.txtClassDef = createTextField(pCLASS,[firstColumn secondRow 0.98*frameWidth 4*controlElementHeight],sprintf(DEFAULT.classdefstring)); |
|
111 |
- set(model.txtClassDef,'HorizontalAlignment','left'); |
|
112 |
- set(model.txtClassDef,'Max',20); |
|
113 |
- set(model.txtClassDef,'Min',0); |
|
114 |
- set(model.txtClassDef, 'FontName', 'FixedWidth') |
|
115 |
- |
|
116 |
- %Voxel |
|
117 |
- nVoxelRows = 8; |
|
118 |
- firstColumn = 5.00; |
|
119 |
- |
|
120 |
- firstRow = (nVoxelRows-0.5)*controlElementHeight; |
|
121 |
- secondRow = (nVoxelRows-7.5)*controlElementHeight; |
|
122 |
- |
|
123 |
- lVoxelDef = createLabel(pVOXEL, [firstColumn firstRow 0.66*frameWidth controlElementHeight],'<ROI Name>,<ROI Modifier>;'); |
|
124 |
- model.txtVoxelDef = createTextField(pVOXEL,[firstColumn secondRow 0.98*frameWidth 6*controlElementHeight],... |
|
125 |
- sprintf(DEFAULT.voxelstring)); |
|
126 |
- set(model.txtVoxelDef,'HorizontalAlignment','left'); |
|
127 |
- set(model.txtVoxelDef,'Max',20); |
|
128 |
- set(model.txtVoxelDef,'Min',0); |
|
129 |
- set(model.txtVoxelDef, 'FontName', 'FixedWidth') |
|
130 |
- |
|
131 |
- % SVM |
|
132 |
- firstColumn = 5.00; |
|
133 |
- firstRow = 1.00 * controlElementHeight; |
|
134 |
- |
|
135 |
- model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow 0.66*frameWidth controlElementHeight],DEFAULT.svmoptstring); |
|
136 |
- %model.txtSVMopts = createTextField(pSVM,[firstColumn firstRow 0.66*frameWidth controlElementHeight],'-s 0 -t 2 -v 6 -c 10 -g .1'); |
|
137 |
- set(model.txtSVMopts,'Enable','on'); %inactive |
|
138 |
- set(model.txtSVMopts,'HorizontalAlignment','left'); |
|
139 |
- |
|
140 |
- set(btnRunButton1,'Callback',{@cbRunCoordTable,model}); % set here, because of model. |
|
141 |
- set(btnRunButton2,'Callback',{@cbRunROIImage,model}); % set here, because of model. |
|
142 |
-% set(btnRunButton2,'Enable','off'); |
|
143 |
- uimenu(savemenu,'Label','Save','Callback',{@mcb_save,model}); |
|
144 |
- uimenu(savemenu,'Label','Load','Callback',{@mcb_load,model}); |
|
145 |
- |
|
146 |
- set(frame,'Visible','on'); |
|
147 |
-end |
|
148 |
- |
|
149 |
-function mcb_save(src,event,model) |
|
150 |
-display('SAVE'); |
|
151 |
- |
|
152 |
-end |
|
153 |
- |
|
154 |
-function mcb_load(src,event,model) |
|
155 |
-display('LOAD'); |
|
156 |
-end |
|
157 |
- |
|
158 |
-function cbRunCoordTable(src,evnt,model) |
|
159 |
- display('RUN Coord-Table Mode'); |
|
160 |
- main('COORD-LOOKUP-TABLE',model); |
|
161 |
-end |
|
162 |
-function cbRunROIImage(src,evnt,model) |
|
163 |
- display('RUN Image-Mask Mode'); |
|
164 |
- main('ROI-IMAGE-MASK', model); |
|
165 |
-end |
|
166 |
- |
|
167 |
-function label = createLabel(parent, pos, labelText) |
|
168 |
- label = uicontrol(parent,'Style','text','String',labelText,'Position',pos); |
|
169 |
- set(label,'HorizontalAlignment','left'); |
|
170 |
- set(label,'Units','characters'); |
|
171 |
-% set(label,'BackgroundColor','r'); |
|
172 |
-end |
|
173 |
- |
|
174 |
- |
|
175 |
-function txt = createTextField(parent,pos,model) |
|
176 |
- txt = uicontrol(parent,'Style','edit','String',model,'Position',pos); |
|
177 |
- set(txt,'BackgroundColor','w'); |
|
178 |
-end |
|
179 |
- |
... | ... |
@@ -1,43 +0,0 @@ |
1 |
-function project_UI(args) |
|
2 |
- PROJECTPATH = 'projects'; |
|
3 |
- |
|
4 |
- frameWidth=450; |
|
5 |
- frameHeight=50; |
|
6 |
- model.frame = figure('Visible','off','Position',[0,0,frameWidth,frameHeight]); |
|
7 |
- movegui(model.frame,'west'); % get this thing visible on smaller displays. |
|
8 |
- |
|
9 |
- set(model.frame,'Name','SVM CrossVal Decode Performance 4 SPM, Projectchooser'); |
|
10 |
- set(model.frame,'NumberTitle','off'); |
|
11 |
- set(model.frame,'MenuBar','none'); |
|
12 |
- set(model.frame,'Color',get(0,'defaultUicontrolBackgroundColor')); |
|
13 |
- set(model.frame,'Resize','off'); |
|
14 |
- set(model.frame,'Units','normalize'); |
|
15 |
- |
|
16 |
- newProjectMenu = uimenu(model.frame,'Label','Define New Project'); |
|
17 |
- set(newProjectMenu,'Enable','off'); |
|
18 |
- |
|
19 |
- d = dir(fullfile(PROJECTPATH,'*.m')); |
|
20 |
- |
|
21 |
- model.projectSelection = uicontrol(model.frame,'Style','popupmenu',... |
|
22 |
- 'String',{d.name},... |
|
23 |
- 'Value',1,... % default selected item |
|
24 |
- 'Position',[0.33*frameWidth 40 0.66*frameWidth 20]); |
|
25 |
- set(model.projectSelection,'BackgroundColor','w'); |
|
26 |
- |
|
27 |
- |
|
28 |
- btnSelectButton = uicontrol(model.frame,'Tag','select','String','continue','Position',[2 0 frameWidth 20]); |
|
29 |
- |
|
30 |
-% model.projectSelector = |
|
31 |
- |
|
32 |
- model.val = 1; |
|
33 |
- |
|
34 |
- set(btnSelectButton,'Callback',{@cbChooseProject,model}); % set here, because of model. |
|
35 |
- set(model.frame,'Visible','on'); |
|
36 |
-end |
|
37 |
- |
|
38 |
-function cbChooseProject(src,evnts,args) |
|
39 |
- |
|
40 |
- spm_SVMCrossVal(args); |
|
41 |
- display(args); |
|
42 |
- close(args.frame) |
|
43 |
-end |
... | ... |
@@ -1,37 +1,35 @@ |
1 |
-function runROIImageMaskMode(subjects,timeline) |
|
1 |
+function runROIImageMaskMode(args) |
|
2 | 2 |
|
3 |
-% imageStruct = loadImageFileNamesData(loadParams); |
|
4 |
-% assignin('base','imageStruct',imageStruct); |
|
3 |
+subjects = args.subjects; |
|
4 |
+mask = ['^' cell2mat(args.mask) '.*\.img$']; |
|
5 | 5 |
|
6 |
-% coordinateStruct = computeCoordinates(imageStruct); |
|
7 |
-% assignin('base','coordinateStruct',coordinateStruct); |
|
8 |
-end |
|
6 |
+nSubjects = size(subjects); |
|
7 |
+sessionlist = 1:3; |
|
9 | 8 |
|
10 |
-function extr = claculateRoiImageData(filenameList,roiImageList) |
|
11 |
- |
|
12 |
-V = filenameList; |
|
13 |
-nImage = numel(V); |
|
14 |
-Vm = roiImageList; |
|
15 |
-nRoi = numel(Vm); |
|
16 |
-for kImage=1:nImage |
|
17 |
- x = []; y = []; z = []; |
|
18 |
- for iRoiFile = 1:nRoi |
|
19 |
- [x1 y1] = ndgrid(1:V(k).dim(1),1:V(k).dim(2)); |
|
20 |
- for p = 1:V(k).dim(3) % resample mask Vm(i) in space of V(k) |
|
21 |
- B = spm_matrix([0 0 -p 0 0 0 1 1 1]); |
|
22 |
- M = inv(B*inv(V(k).mat)*Vm(iRoiFile).mat); |
|
23 |
- msk = find(spm_slice_vol(Vm(iRoiFile),M,V(k).dim(1:2),0)); |
|
24 |
- if ~isempty(msk) |
|
25 |
- z1 = p*ones(size(msk(:))); |
|
26 |
- x = [x; x1(msk(:))]; |
|
27 |
- y = [y; y1(msk(:))]; |
|
28 |
- z = [z; z1]; |
|
29 |
- end |
|
30 |
- end |
|
31 |
- dat = spm_sample_vol(V(k), x, y, z,0); |
|
32 | 9 |
|
33 |
- extr(kImage).dat(iRoiFile) = dat; |
|
10 |
+for s = 1:nSubjects |
|
11 |
+ subjectStruct{s}.dir = fullfile(args.basedir,cell2mat(subjects(s))); |
|
12 |
+ subjectStruct{s}.name = cell2mat(subjects(s)); |
|
13 |
+ subjectStruct{s}.roiFile = ui_selectRoiImage(... |
|
14 |
+ sprintf('Select ROI Files for %s',subjectStruct{s}.name),... |
|
15 |
+ fullfile(subjectStruct{s}.dir,'results','roi')); |
|
34 | 16 |
end |
17 |
+ |
|
18 |
+ |
|
19 |
+ |
|
20 |
+for s = 1:nSubjects |
|
21 |
+ % load image data |
|
22 |
+ |
|
23 |
+ disp('fetching volume definitions, please wait'); |
|
24 |
+ subjectStruct{s}.volumes = spm_vol(getImageFileList(subjectStruct{s}.dir,sessionlist,mask)); |
|
25 |
+ |
|
26 |
+ disp('computing volume values, please wait'); |
|
27 |
+ subjectStruct{s}.rawData = calculateRoiImageData(subjectStruct{s}.volumes,subjectStruct{s}.roiFile); |
|
28 |
+ % calculate psth |
|
29 |
+ |
|
35 | 30 |
end |
36 | 31 |
|
32 |
+assignin('base','subjectStruct',subjectStruct); |
|
33 |
+ |
|
37 | 34 |
end |
35 |
+ |
... | ... |
@@ -1,18 +0,0 @@ |
1 |
-%timePointToImageNumber type is optional |
|
2 |
-function imgNumber = timePointToImageNumber(timepoint, type)% timepoint in ms |
|
3 |
- switch type |
|
4 |
- case 's' |
|
5 |
- imgNumber = timePointToImageNumber(timepoint*1000,'ms'); |
|
6 |
- return; |
|
7 |
- case 'ms' |
|
8 |
- imageTimeResolution = 2000; %ms |
|
9 |
- imgNumber = round(timepoint/imageTimeResolution); |
|
10 |
- return; |
|
11 |
- case 'image' |
|
12 |
- imgNumber = timepoint; |
|
13 |
- return; |
|
14 |
- otherwise |
|
15 |
- imgNumber = timePointToImageNumber(timepoint,'ms'); |
|
16 |
- return; |
|
17 |
- end |
|
18 |
-end |
|
19 | 0 |
\ No newline at end of file |
... | ... |
@@ -1,8 +1,7 @@ |
1 | 1 |
function ui_main(varargin) |
2 | 2 |
|
3 | 3 |
DEFAULT.selectedSubject = 2; |
4 |
-DEFAULT.smoothed = 1; |
|
5 |
-DEFAULT.multisubject = 'single'; |
|
4 |
+ |
|
6 | 5 |
DEFAULT.pststart = -15; |
7 | 6 |
DEFAULT.pstend = 40; |
8 | 7 |
DEFAULT.baselinestart = -3; |
... | ... |
@@ -97,7 +96,7 @@ model = setTimeLineParams(model,l.timeLine); |
97 | 96 |
model = setClassDefString(model,l.classDefString); |
98 | 97 |
model = setCoordDefString(model,l.coordDefString); |
99 | 98 |
model.baseDir = l.baseDir; |
100 |
-model = scanDirs(model) |
|
99 |
+model = scanDirs(model); |
|
101 | 100 |
|
102 | 101 |
end |
103 | 102 |
|
... | ... |
@@ -278,8 +277,6 @@ function model = createFirstStepPanel(model,parent,DEFAULT) |
278 | 277 |
set(model.txtVoxelDef,'Min',0); |
279 | 278 |
set(model.txtVoxelDef, 'FontName', 'FixedWidth'); |
280 | 279 |
|
281 |
- assignin('base','txtVoxelDef',model.txtVoxelDef); |
|
282 |
- |
|
283 | 280 |
%normalizations |
284 | 281 |
pNorm = uipanel(parent,'Title','Normalization','Position',cell2mat(main_grid(2,3))); |
285 | 282 |
set(pNorm,'BackgroundColor','w'); |