annotate SMALLboxSetup.m @ 3:01cad25206d6

(none)
author idamnjanovic
date Fri, 05 Mar 2010 12:31:22 +0000
parents 7750624e0c73
children b6d8f2c4f5fa
rev   line source
idamnjanovic@1 1 function SMALLboxSetup(varargin)
idamnjanovic@1 2 %
idamnjanovic@1 3 % SMALLboxSetup
idamnjanovic@1 4 %
idamnjanovic@1 5 % Will automatically download and install existing toolboxes
idamnjanovic@1 6 % on sparse representations and dictionary learning
idamnjanovic@1 7 %
idamnjanovic@1 8 % For this function an internet connection is required.
idamnjanovic@1 9 %
idamnjanovic@1 10 % SMALLbox initialisation
idamnjanovic@1 11 % Ivan Damnjanovic, Matthew Davies 2009
idamnjanovic@1 12
idamnjanovic@1 13
idamnjanovic@1 14 clc;
idamnjanovic@1 15
idamnjanovic@1 16 FS=filesep;
idamnjanovic@1 17
idamnjanovic@1 18 fprintf('\n ********************************************************************');
idamnjanovic@1 19 fprintf('\n\n This script will install the SMALLbox Evaluation Framework v.0.4');
idamnjanovic@1 20 fprintf('\n\n It contains the following toolboxes:');
idamnjanovic@1 21 fprintf('\n Sparco version 1.2, incorporating Rice Wavelet Toolbox version 2.4');
idamnjanovic@1 22 fprintf('\n SPGL1 Toolbox version 1.7 ');
idamnjanovic@1 23 fprintf('\n SparseLab Toolbox version 2.1');
idamnjanovic@1 24 fprintf('\n Sparsify Toolbox version 0.4');
idamnjanovic@1 25 fprintf('\n GPSR Toolbox version 5.0');
idamnjanovic@1 26 fprintf('\n OMPbox version 9');
idamnjanovic@1 27 fprintf('\n KSVDbox version 10');
idamnjanovic@1 28 fprintf('\n\n ********************************************************************');
idamnjanovic@1 29
idamnjanovic@1 30 fprintf('\n\n The toolbox will be installed in: ');
idamnjanovic@1 31 fprintf('\n %s%s\n',pwd,FS);
idamnjanovic@1 32 fprintf('\n ********************************************************************');
idamnjanovic@1 33 fprintf('\n\n IMPORTANT: To successfully install all toolboxes');
idamnjanovic@1 34 fprintf('\n you will need to have MEX setup to compile C files.');
idamnjanovic@1 35 fprintf('\n\n If this is not already setup, please type "n" to exit and then ');
idamnjanovic@1 36 fprintf('\n run "mex -setup" or type "help mex" in the MATLAB command prompt.');
idamnjanovic@1 37 fprintf('\n\n ********************************************************************');
idamnjanovic@1 38
idamnjanovic@1 39
idamnjanovic@1 40 fprintf('\n ********************************************************************');
idamnjanovic@1 41 fprintf('\n\n IMPORTANT: YOU MUST HAVE AN INTERNET CONNECTION');
idamnjanovic@1 42 fprintf('\n YOU CANNOT INSTALL SMALLBOX WITHOUT ONE!');
idamnjanovic@1 43 fprintf('\n\n ********************************************************************');
idamnjanovic@1 44 install_ack = input('\n\n Do you wish to continue: ([y]/n)? ','s');
idamnjanovic@1 45
idamnjanovic@1 46 if strcmp(install_ack,'"n"'),
idamnjanovic@1 47 install_ack = 'n';
idamnjanovic@1 48 end
idamnjanovic@1 49
idamnjanovic@1 50 if install_ack == 'n',
idamnjanovic@1 51 return;
idamnjanovic@1 52 else
idamnjanovic@1 53 fprintf('\n\n Installation now beginning...');
idamnjanovic@1 54 % fprintf('\n\nFor further information on the toolboxes see SMALLbox documentation\n\n');
idamnjanovic@1 55 end
idamnjanovic@1 56
idamnjanovic@1 57
idamnjanovic@1 58
idamnjanovic@1 59
idamnjanovic@1 60 SMALL_path=pwd;
idamnjanovic@1 61 SMALL_p=genpath(SMALL_path);
idamnjanovic@1 62 addpath(SMALL_p);
idamnjanovic@1 63
idamnjanovic@1 64
idamnjanovic@1 65 fprintf('\n ******************************************************************');
idamnjanovic@1 66 fprintf('\n\n Initialising SPARCO and Rice Wavelet Toolbox Setup');
idamnjanovic@1 67
idamnjanovic@1 68
idamnjanovic@1 69 Sparco_path = [SMALL_path,FS,'toolboxes',FS,'SPARCO'];
idamnjanovic@1 70 if exist([Sparco_path, FS, 'sparco-1.2.zip'],'file'),
idamnjanovic@1 71 Sparco_zip=[Sparco_path, FS, 'sparco-1.2.zip'];
idamnjanovic@1 72 else
idamnjanovic@1 73 Sparco_zip='http://www.cs.ubc.ca/labs/scl/sparco/downloads.php?filename=sparco-1.2.zip';
idamnjanovic@1 74 fprintf('\n\n Downloading toolbox, please be patient\n\n');
idamnjanovic@1 75 end
idamnjanovic@1 76 unzip(Sparco_zip,Sparco_path);
idamnjanovic@1 77 Sparco_p=genpath(Sparco_path);
idamnjanovic@1 78 addpath(Sparco_p);
idamnjanovic@1 79 cd(SMALL_path)
idamnjanovic@1 80
idamnjanovic@1 81
idamnjanovic@1 82
idamnjanovic@1 83 if exist('curvelab.pdf','file')
idamnjanovic@1 84 crvroot = fileparts(which('curvelab.pdf'));
idamnjanovic@1 85 addtopath(crvroot,'fdct_usfft_matlab');
idamnjanovic@1 86 addtopath(crvroot,'fdct_wrapping_matlab');
idamnjanovic@1 87 addtopath(crvroot,'fdct_wrapping_cpp/mex');
idamnjanovic@1 88 addtopath(crvroot,'fdct3d/mex');
idamnjanovic@1 89 else
idamnjanovic@1 90 fprintf(['\nWarning: CurveLab is not in the path. Sparco Problems 50-51 ' ...
idamnjanovic@1 91 'will not work.\n\n']);
idamnjanovic@1 92 end
idamnjanovic@1 93
idamnjanovic@1 94 cd([Sparco_path, FS, 'sparco-1.2', FS, 'tools' ,FS, 'rwt'])
idamnjanovic@1 95 fprintf('Compiling the Rice Wavelet Toolbox MEX interfaces...');
idamnjanovic@1 96 try
idamnjanovic@1 97 if exist('mdwt' ,'file')~=3, mex mdwt.c mdwt_r.c; end
idamnjanovic@1 98 if exist('midwt' ,'file')~=3, mex midwt.c midwt_r.c; end
idamnjanovic@1 99 if exist('mrdwt' ,'file')~=3, mex mrdwt.c mrdwt_r.c; end
idamnjanovic@1 100 if exist('mirdwt','file')~=3, mex mirdwt.c mirdwt_r.c; end
idamnjanovic@1 101 fprintf('SPARCO Installation Successful!\n');
idamnjanovic@1 102 catch
idamnjanovic@1 103 warning('Could not compile Rice Wavelet Toolbox MEX interfaces.');
idamnjanovic@1 104 end
idamnjanovic@1 105 cd(SMALL_path)
idamnjanovic@1 106
idamnjanovic@1 107
idamnjanovic@1 108
idamnjanovic@1 109 fprintf('\n ******************************************************************');
idamnjanovic@1 110 fprintf('\n\n Initialising SPGL1 Setup');
idamnjanovic@1 111
idamnjanovic@1 112 try
idamnjanovic@1 113 SPGL1_path = [SMALL_path,FS,'toolboxes',FS,'SPGL1'];
idamnjanovic@1 114 if exist([SPGL1_path, FS, 'spgl1-1.7.zip'],'file'),
idamnjanovic@1 115 SPGL1_zip=[SPGL1_path, FS, 'spgl1-1.7.zip'];
idamnjanovic@1 116 else
idamnjanovic@1 117 SPGL1_zip='http://www.cs.ubc.ca/labs/scl/spgl1/downloads.php?filename=spgl1-1.7.zip';
idamnjanovic@1 118 fprintf('\n\n Downloading toolbox, please be patient\n\n');
idamnjanovic@1 119 end
idamnjanovic@1 120 unzip(SPGL1_zip,SPGL1_path);
idamnjanovic@1 121 SPGL1_p=genpath(SPGL1_path);
idamnjanovic@1 122 addpath(SPGL1_p);
idamnjanovic@1 123
idamnjanovic@1 124
idamnjanovic@1 125 cd([SPGL1_path,FS,'spgl1-1.7']);
idamnjanovic@1 126 fprintf('Compiling SPGL1 MEX interfaces ...');
idamnjanovic@1 127 try
idamnjanovic@1 128 spgsetup;
idamnjanovic@1 129 fprintf('\n SPGL1 Installation Successful!\n');
idamnjanovic@1 130 catch
idamnjanovic@1 131 warning('Could not compile SPGL1 MEX interfaces.');
idamnjanovic@1 132 end
idamnjanovic@1 133 catch
idamnjanovic@1 134 fprintf('\n SPGL1 Installation Failed\n');
idamnjanovic@1 135 end
idamnjanovic@1 136 cd(SMALL_path);
idamnjanovic@1 137
idamnjanovic@1 138 fprintf('\n ******************************************************************');
idamnjanovic@1 139 fprintf('\n\n Initialising SparseLab Setup');
idamnjanovic@1 140
idamnjanovic@1 141 try
idamnjanovic@1 142 SL_path = [pwd,FS,'toolboxes',FS,'SparseLab'];
idamnjanovic@1 143 if exist([SL_path, FS, 'SparseLab21-Core.zip'],'file'),
idamnjanovic@1 144 SL_zip=[SL_path, FS, 'SparseLab21-Core.zip'];
idamnjanovic@1 145 else
idamnjanovic@1 146 SL_zip='http://sparselab.stanford.edu/SparseLab_files/Download_files/SparseLab21-Core.zip';
idamnjanovic@1 147 fprintf('\n\n Downloading toolbox, please be patient\n\n');
idamnjanovic@1 148 end
idamnjanovic@1 149 unzip(SL_zip,SL_path);
idamnjanovic@1 150 SL_p=genpath(SL_path);
idamnjanovic@1 151 addpath(SL_p);
idamnjanovic@1 152 fprintf('\n SparseLab Installation Successful!\n');
idamnjanovic@1 153 catch
idamnjanovic@1 154 fprintf('\n SparseLab Installation Failed\n');
idamnjanovic@1 155 cd(SMALL_path);
idamnjanovic@1 156 end
idamnjanovic@1 157
idamnjanovic@1 158
idamnjanovic@1 159 fprintf('\n ******************************************************************');
idamnjanovic@1 160 fprintf('\n\n Initialising Sparsify Setup');
idamnjanovic@1 161
idamnjanovic@1 162 try
idamnjanovic@1 163 Sparsify_path = [pwd,FS,'toolboxes',FS,'Sparsify'];
idamnjanovic@1 164 if exist([Sparsify_path, FS, 'sparsify_0_4.zip'],'file'),
idamnjanovic@1 165 Sparsify_zip=[Sparsify_path, FS, 'sparsify_0_4.zip'];
idamnjanovic@1 166 else
idamnjanovic@1 167 Sparsify_zip='http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify_0_4.zip';
idamnjanovic@1 168 fprintf('\n\n Downloading toolbox, please be patient\n\n');
idamnjanovic@1 169 end
idamnjanovic@1 170 unzip(Sparsify_zip,Sparsify_path);
idamnjanovic@1 171 Sparsify_p=genpath(Sparsify_path);
idamnjanovic@1 172 addpath(Sparsify_p);
idamnjanovic@1 173 fprintf('\n Sparsify Installation Successful\n');
idamnjanovic@1 174 catch
idamnjanovic@1 175 fprintf('\n Sparsify Installation Failed\n');
idamnjanovic@1 176 cd(SMALL_path);
idamnjanovic@1 177 end
idamnjanovic@1 178
idamnjanovic@1 179 fprintf('\n ******************************************************************');
idamnjanovic@1 180 fprintf('\n\n Initialising GPSR Setup');
idamnjanovic@1 181
idamnjanovic@1 182 try
idamnjanovic@1 183 GPSR_path = [pwd,FS,'toolboxes',FS,'GPSR'];
idamnjanovic@1 184 if exist([GPSR_path, FS, 'GPSR_6.0.zip'],'file'),
idamnjanovic@1 185 GPSR_zip=[GPSR_path, FS,'GPSR_6.0.zip'];
idamnjanovic@1 186 else
idamnjanovic@1 187 GPSR_zip='http://www.lx.it.pt/~mtf/GPSR/GPSR_6.0.zip';
idamnjanovic@1 188 fprintf('\n\n Downloading toolbox, please be patient\n\n');
idamnjanovic@1 189 end
idamnjanovic@1 190 unzip(GPSR_zip,GPSR_path);
idamnjanovic@1 191 GPSR_p=genpath(GPSR_path);
idamnjanovic@1 192 addpath(GPSR_p);
idamnjanovic@1 193 fprintf('\n GPSR Installation Successful\n');
idamnjanovic@1 194 catch
idamnjanovic@1 195 fprintf('\n GPSR Installation Failed');
idamnjanovic@1 196 cd(SMALL_path);
idamnjanovic@1 197 end
idamnjanovic@1 198
idamnjanovic@1 199
idamnjanovic@1 200 fprintf('\n ******************************************************************');
idamnjanovic@1 201 fprintf('\n\n Initialising OMPbox and KSVDBox Setup');
idamnjanovic@1 202
idamnjanovic@1 203 try
idamnjanovic@1 204 KSVD_path = [pwd,FS,'toolboxes',FS,'KSVD'];
idamnjanovic@1 205 if exist([KSVD_path, FS, 'ompbox9.zip'],'file'),
idamnjanovic@1 206 omp_zip=[KSVD_path, FS, 'ompbox9.zip'];
idamnjanovic@1 207 else
idamnjanovic@1 208 omp_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ompbox9.zip';
idamnjanovic@1 209 fprintf('\n\n Downloading toolbox, please be patient\n\n');
idamnjanovic@1 210 end
idamnjanovic@1 211 unzip(omp_zip,[KSVD_path, FS, 'ompbox']);
idamnjanovic@1 212
idamnjanovic@1 213 cd([KSVD_path, FS, 'ompbox', FS, 'private']);
idamnjanovic@1 214 make;
idamnjanovic@1 215 cd(SMALL_path);
idamnjanovic@1 216
idamnjanovic@1 217 if exist([KSVD_path, FS, 'ksvdbox10.zip'],'file'),
idamnjanovic@1 218 KSVD_zip=[KSVD_path, FS, 'ksvdbox10.zip'];
idamnjanovic@1 219 else
idamnjanovic@1 220 KSVD_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ksvdbox10.zip';
idamnjanovic@1 221 fprintf('\n\n Downloading toolbox, please be patient\n\n');
idamnjanovic@1 222 end
idamnjanovic@1 223 unzip(KSVD_zip,[KSVD_path, FS, 'ksvdbox']);
idamnjanovic@1 224 cd([KSVD_path, FS, 'ksvdbox', FS, 'private']);
idamnjanovic@1 225 make;
idamnjanovic@1 226 cd(SMALL_path);
idamnjanovic@1 227 KSVD_p=genpath(KSVD_path);
idamnjanovic@1 228 addpath(KSVD_p);
idamnjanovic@1 229 fprintf('\n KSVDBox and OMPBox Installation Successful\n');
idamnjanovic@1 230 catch
idamnjanovic@1 231 fprintf('\n KSVDBox and OMPBox Installation Failed');
idamnjanovic@1 232 cd(SMALL_path);
idamnjanovic@1 233 end
idamnjanovic@1 234
idamnjanovic@1 235
idamnjanovic@1 236
idamnjanovic@1 237
idamnjanovic@1 238 fprintf('\n ******************************************************************');
idamnjanovic@1 239 fprintf('\n\n Initialising SMALLbox Examples Setup');
idamnjanovic@1 240
idamnjanovic@1 241 % Need to do a bit of temporary housekeeping first.
idamnjanovic@1 242 cd(SMALL_path);
idamnjanovic@1 243 try
idamnjanovic@1 244 cd(['examples',FS,'private']);
idamnjanovic@1 245 if exist('addtocols' ,'file')~=3,
idamnjanovic@1 246 fprintf('\n Compiling MEX interfaces for SMALL examples \n');
idamnjanovic@1 247 make;
idamnjanovic@1 248 end
idamnjanovic@1 249 fprintf('\n SMALLbox Examples Installation Successful! \n');
idamnjanovic@1 250 catch
idamnjanovic@1 251 fprintf('\n SMALLbox Examples Installation Failed \n');
idamnjanovic@1 252 end
idamnjanovic@1 253 cd(SMALL_path);
idamnjanovic@1 254
idamnjanovic@1 255
idamnjanovic@1 256
idamnjanovic@1 257 fprintf('\n ******************************************************************');
idamnjanovic@1 258 fprintf('\n\n SMALLbox Installation Complete!');
idamnjanovic@1 259
idamnjanovic@1 260
idamnjanovic@1 261 fprintf('\n\n For more information on the installed toolboxes see');
idamnjanovic@1 262 fprintf('\n\n Sparco: http://www.cs.ubc.ca/labs/scl/sparco/');
idamnjanovic@1 263 fprintf('\n\n SPGL1: http://www.cs.ubc.ca/labs/spgl1/?n=HomePage');
idamnjanovic@1 264 fprintf('\n\n SparseLab: http://sparselab.stanford.edu/ (PLEASE REGISTER SPARSELAB!)');
idamnjanovic@1 265 fprintf('\n\n Sparsify: http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify.html');
idamnjanovic@1 266 fprintf('\n\n GPSR: http://www.lx.it.pt/~mtf/GPSR/');
idamnjanovic@1 267 fprintf('\n\n OMPbox and KSVDBox: http://www.cs.technion.ac.il/~ronrubin/\n');
idamnjanovic@1 268
idamnjanovic@1 269
idamnjanovic@1 270 % LIST DEMOS FROM EXAMPLE DIRECTORY...
idamnjanovic@1 271
idamnjanovic@1 272 demo_ack = input('\n\n Would you like to run a demo: ([y]/n)? ','s');
idamnjanovic@1 273
idamnjanovic@1 274 if demo_ack == 'n',
idamnjanovic@1 275 fprintf('\n Thank you for installing SMALLbox.');
idamnjanovic@1 276 fprintf('\n For information on the SMALLbox example scripts');
idamnjanovic@1 277 fprintf('\n Please see the examples directory. \n');
idamnjanovic@1 278 return;
idamnjanovic@1 279 else
idamnjanovic@1 280
idamnjanovic@1 281 demo_choice = input('\n Enter 1 to run SMALL_solver_test, 2 to run SMALL_solver_test_Audio or q to quit: ','s');
idamnjanovic@1 282 switch(demo_choice)
idamnjanovic@1 283 case{'1'}
idamnjanovic@1 284 fprintf('\n Running SMALL_solver_test problem');
idamnjanovic@1 285 SMALL_solver_test;
idamnjanovic@1 286 case{'2'}
idamnjanovic@1 287 fprintf('\n Running SMALL_solver_test_Audio problem');
idamnjanovic@1 288 SMALL_solver_test_Audio;
idamnjanovic@1 289 otherwise
idamnjanovic@1 290 return;
idamnjanovic@1 291 end
idamnjanovic@1 292
idamnjanovic@1 293 end
idamnjanovic@1 294
idamnjanovic@1 295
idamnjanovic@1 296