-
Notifications
You must be signed in to change notification settings - Fork 28
/
palm_checkprogs.m
99 lines (90 loc) · 3.46 KB
/
palm_checkprogs.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
function ext = palm_checkprogs
% Test whether some external programs or toolboxes
% are available, namely, FSL, FreeSurfer, SPM and
% Jimmy Shen's NIFTI toolbox.
%
% ext = checkprogs
%
% 'ext' is a struct containing one field for each
% of these applications, each being containing
% a 0 (false) or 1 (true) depending on whether
% these programs are available or not.
%
% _____________________________________
% Anderson M. Winkler
% FMRIB / University of Oxford
% Aug/2013
% http://brainder.org
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% PALM -- Permutation Analysis of Linear Models
% Copyright (C) 2015 Anderson M. Winkler
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
persistent palm_extern;
if isempty(palm_extern)
% Check the path of PALM and add the path for the NIFTI and GIFTI I/O.
palm_extern.palmpath = fileparts(mfilename('fullpath'));
addpath(fullfile(palm_extern.palmpath,'fileio'));
addpath(fullfile(palm_extern.palmpath,'fileio','extras'));
addpath(fullfile(palm_extern.palmpath,'fileio','freesurfer'));
addpath(fullfile(palm_extern.palmpath,'fileio','cifti-matlab'));
fprintf('PALM is located at %s\n',palm_extern.palmpath);
addpath(fullfile(palm_extern.palmpath,'colourmaps'));
% Check for FSL
palm_extern.fsl = false;
fsldir = getenv('FSLDIR');
if ~isempty(fsldir)
palm_extern.fsl = true;
addpath(fullfile(fsldir,'etc','matlab'));
fprintf('Found FSL in %s\n',fsldir);
end
% Check for FreeSurfer
palm_extern.fs = false;
fshome = getenv('FREESURFER_HOME');
if ~isempty(fshome)
palm_extern.fs = true;
addpath(fullfile(fshome,'matlab'));
fprintf('Found FreeSurfer in %s\n',fshome);
end
% Check for the NIFTI toolbox
palm_extern.nii = false;
if exist('load_nii') == 2 && exist('save_nii') == 2, %#ok
palm_extern.nii = true;
end
% Check for SPM
palm_extern.spm = false;
try %#ok
spm_check_installation('basic');
palm_extern.spm = true;
spmpath = fileparts(which('spm'));
fprintf('Found SPM in %s\n',spmpath);
end
% Check for the HCP Workbench
palm_extern.wb_command = false;
[status,wb_command] = system('which wb_command');
if status == 0
palm_extern.wb_command = true;
fprintf('Found HCP Workbench executable in %s',wb_command);
end
% Check if the Image Processing Toolbox is installed
palm_extern.ipt = license('test','Image_Toolbox');
if ~ palm_extern.ipt && ...
(exist('niftiread', 'builtin') == 5 || exist('niftiread', 'file') == 2) && ...
(exist('niftiwrite','builtin') == 5 || exist('niftiwrite','file') == 2) && ...
(exist('niftiinfo', 'builtin') == 5 || exist('niftiinfo', 'file') == 2)
palm_extern.ipt = true;
end
end
ext = palm_extern;