forked from netstim/leaddbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathea_compute_scrf.m
51 lines (44 loc) · 1.8 KB
/
ea_compute_scrf.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function ea_compute_scrf(handles)
options=getappdata(handles.scrf,'options');
directory=getappdata(handles.scrf,'directory');
options.coregmr.method='ANTs';
if ~handles.mask0.Value
if ~exist([directory,'scrf',filesep,'bgmsk.nii'],'file')
ea_addtsmask(options,1);
for msk=1:2
if msk==2
btts='2';
else
btts='';
end
if ~exist([directory,'scrf',filesep],'dir')
mkdir([directory,'scrf',filesep]);
end
movefile([directory,'bgmsk',btts,'.nii'],[directory,'scrf',filesep,'bgmsk',btts,'.nii']);
ea_conformspaceto([directory,'scrf',filesep,options.prefs.prenii_unnormalized],[directory,'scrf',filesep,'bgmsk',btts,'.nii'],0);
end
end
for msk=1:2
if msk==2
btts='2';
else
btts='';
end
msks{msk}=[directory,'scrf',filesep,'bgmsk',btts,'.nii'];
end
end
otherfiles={};
if handles.mask1.Value
msks=msks(1); % only use first mask.
end
if ~exist('msks','var')
msks={};
end
ea_backuprestore([directory,'scrf',filesep,'movim.nii']);
ea_coreg2images(options,[directory,'scrf',filesep,'movim.nii'],[directory,'scrf',filesep,options.prefs.prenii_unnormalized],...
[directory,'scrf',filesep,'scrfmovim.nii'],otherfiles,1,msks);
%movefile([directory,'scrf',filesep,'movim.nii'],[directory,'scrf',filesep,'scrfmovim.nii']);
movefile([directory,'scrf',filesep,'raw_movim.nii'],[directory,'scrf',filesep,'movim.nii']);
movefile([directory,'scrf',filesep,'movim2',ea_stripext(options.prefs.prenii_unnormalized),'_ants1.mat'],[directory,'scrf',filesep,'scrf_instore.mat']);
delete([directory,'scrf',filesep,ea_stripext(options.prefs.prenii_unnormalized),'2movim','_ants1.mat']);
ea_refreshscrf(options,handles,directory);