0001 function varargout = prt(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if nargin == 0,
0016 Action = 'StartUp';
0017 else
0018 Action = varargin{1};
0019 end
0020
0021 switch lower(Action)
0022
0023 case 'startup'
0024
0025
0026
0027 ok = check_installation;
0028 if ~ok
0029 beep
0030 fprintf('INSTALLATION PROBLEM!');
0031 return
0032 end
0033
0034
0035 prt('ASCIIwelcome');
0036
0037
0038
0039 if ~exist('prt_batch','file')
0040 addpath(fullfile(prt('Dir'),'batch'));
0041 end
0042
0043 if ~exist('prt_machine','file')
0044 pth_machines = fullfile(prt('Dir'),'machines');
0045 addpath(pth_machines);
0046
0047 ls_machinedir = list_subdir(pth_machines);
0048 for ii=1:numel(ls_machinedir)
0049 addpath(fullfile(pth_machines,ls_machinedir{ii}))
0050 end
0051 end
0052
0053
0054 dumb=which('svmtrain');
0055 if ~isempty(findstr('libsvm',dumb))
0056 disp('SVM path OK')
0057 else
0058 warning(['SVM path not recognized. Please check that: \n', ...
0059 '-PRoNTo was added with all subfolders \n',...
0060 '-PRoNTo is above the biostats Matlab toolbox \n',...
0061 'Otherwise, the routines surely need to be re-compiled for your OS \n',...
0062 'Please look on the web or ask on the mailing list for assistance'])
0063 end
0064
0065 dumb=which('solve_chol');
0066 if ~isempty(dumb) && ~isempty(findstr('.mex',dumb))
0067 disp('GP path: OK')
0068 else
0069 disp('GP not compiled: routines will work but be slower')
0070 end
0071
0072 dumb=which('rtenslearn_c');
0073 if ~isempty(dumb) || ~isempty(findstr('.mex',dumb))
0074 disp('RF path OK')
0075 else
0076 warning(['RF path not recognized. Please check that \n', ...
0077 'PRoNTo was added with all subfolders \n',...
0078 'Otherwise, the routines surely need to be re-compiled for your OS \n',...
0079 'Please look on the web or ask on the mailing list for assistance'])
0080 end
0081
0082
0083 if ~exist('prt_checkAlphaNumUnder','file')
0084 addpath(fullfile(prt('Dir'),'utils'));
0085 end
0086
0087
0088 if ~exist('cfg_util','file')
0089 addpath(fullfile(spm('Dir'),'matlabbatch'));
0090 end
0091
0092
0093 cfg_get_defaults('cfg_util.genscript_run', @genscript_run);
0094 cfg_util('initcfg');
0095 clear prt_batch;
0096
0097
0098 prt_ui_main;
0099
0100
0101 fprintf('PRoNTo present working directory:\n\t%s\n',pwd)
0102
0103
0104
0105 case 'asciiwelcome'
0106
0107 disp( ' ');
0108 disp( ' ____ ____ _ ________ ');
0109 disp( ' / __ \/ __ \____ / | / /_ __/_ ___ ___ ');
0110 disp( ' / /_/ / /_/ / __ \/ |/ / / / __ \ _ _< /< /');
0111 disp( ' / ____/ _, _/ /_/ / /| / / / /_/ / | |/ / / / / ');
0112 disp( ' /_/ /_/ |_|\____/_/ |_/ /_/\____/ |___/_(_)_/ ');
0113 disp( ' ');
0114 disp( ' PRoNTo v1.1 - http://www.mlnl.cs.ucl.ac.uk/pronto ');
0115 fprintf('\n');
0116
0117
0118 case 'dir'
0119
0120
0121
0122 if nargin<2,
0123 Mfile='prt';
0124 else
0125 Mfile=varargin{2};
0126 end
0127 PRTdir = which(Mfile);
0128
0129 if isempty(PRTdir)
0130 if exist(Mfile,'file')==2
0131 PRTdir = Mfile;
0132 else
0133 error(['Can''t find ',Mfile,' on MATLABPATH']);
0134 end
0135 end
0136 PRTdir = fileparts(PRTdir);
0137 varargout = {PRTdir};
0138
0139
0140 otherwise
0141
0142 error('Unknown action string');
0143
0144 end
0145
0146 return
0147
0148
0149
0150
0151
0152
0153 function ok = check_installation
0154
0155
0156
0157 ok=1;
0158
0159 if exist('spm.m','file')
0160 if ~strcmpi(spm('ver'),'spm8')
0161 beep
0162 fprintf('\nERROR:\n')
0163 fprintf('\tSPM8 should be installed on your computer, and\n')
0164 fprintf('\tbe available on MATLABPATH!\n\n')
0165 ok = 0;
0166 end
0167 else
0168 beep
0169 fprintf('\nERROR:\n')
0170 fprintf('\tSPM8 should be installed on your computer, and\n')
0171 fprintf ('\tbe available on MATLABPATH!\n\n')
0172 ok = 0;
0173 end
0174
0175 return
0176
0177
0178 function lsdir = list_subdir(pth_dir,rejd)
0179
0180
0181
0182
0183 if nargin<2
0184 rejd = '.@_';
0185 end
0186 if nargin<1
0187 pth_dir = pwd;
0188 end
0189
0190 tmp = dir(pth_dir);
0191 ld = find([tmp.isdir]); ld([1 2]) = [];
0192 lsdir = {tmp(ld).name};
0193 if ~isempty(rejd)
0194 for ii=1:numel(rejd)
0195 lrej = find(strncmp(rejd(ii),lsdir,1));
0196 if ~isempty(lrej)
0197 lsdir(lrej) = [];
0198 end
0199 end
0200 end
0201
0202 return