-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathselectAtlasDir.m
More file actions
36 lines (33 loc) · 1.1 KB
/
selectAtlasDir.m
File metadata and controls
36 lines (33 loc) · 1.1 KB
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
function dirname = selectAtlasDir(dirname)
if ~exist('dirname','var') | ~exist(dirname,'dir')
dirname=pwd;
end
if exist(dirname,'file') & exist([dirname, '/anatomical'],'dir')
if exist([dirname, '/anatomical/headsurf.mesh'],'file') | exist([dirname, '/anatomical/headvol.vox'],'file')
return;
end
end
while 1
dirname = uigetdir(dirname,'Atlas directory not found. Please choose atlas directory');
if dirname==0
break;
end
if ~exist([dirname, '/anatomical/headvol.vox'],'file') && exist([dirname, '/anatomical/headvol.vox.gz'],'file')
gunzip([dirname, '/anatomical/headvol.vox.gz']);
end
if exist(dirname,'dir') && exist([dirname, '/anatomical'],'dir') && ...
exist([dirname, '/anatomical/headvol.vox'],'file')
break
else
q = MenuBox('Selected directory is not a valid atlas directory. Please select valid atlas directory or cancel to avoid selecting',{'Select','Cancel'});
if q==1
continue;
elseif q==2
dirname = '';
break;
end
end
end
if dirname==0
dirname='';
end