idamnjanovic@1: function SMALLboxSetup(varargin) idamnjanovic@1: % idamnjanovic@1: % SMALLboxSetup idamnjanovic@1: % idamnjanovic@1: % Will automatically download and install existing toolboxes idamnjanovic@1: % on sparse representations and dictionary learning idamnjanovic@1: % idamnjanovic@1: % For this function an internet connection is required. idamnjanovic@1: % idamnjanovic@1: % SMALLbox initialisation idamnjanovic@1: % Ivan Damnjanovic, Matthew Davies 2009 idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: clc; idamnjanovic@1: idamnjanovic@1: FS=filesep; idamnjanovic@1: idamnjanovic@1: fprintf('\n ********************************************************************'); idamnjanovic@1: fprintf('\n\n This script will install the SMALLbox Evaluation Framework v.0.4'); idamnjanovic@1: fprintf('\n\n It contains the following toolboxes:'); idamnjanovic@1: fprintf('\n Sparco version 1.2, incorporating Rice Wavelet Toolbox version 2.4'); idamnjanovic@1: fprintf('\n SPGL1 Toolbox version 1.7 '); idamnjanovic@1: fprintf('\n SparseLab Toolbox version 2.1'); idamnjanovic@1: fprintf('\n Sparsify Toolbox version 0.4'); idamnjanovic@1: fprintf('\n GPSR Toolbox version 5.0'); idamnjanovic@1: fprintf('\n OMPbox version 9'); idamnjanovic@1: fprintf('\n KSVDbox version 10'); idamnjanovic@1: fprintf('\n\n ********************************************************************'); idamnjanovic@1: idamnjanovic@1: fprintf('\n\n The toolbox will be installed in: '); idamnjanovic@1: fprintf('\n %s%s\n',pwd,FS); idamnjanovic@1: fprintf('\n ********************************************************************'); idamnjanovic@1: fprintf('\n\n IMPORTANT: To successfully install all toolboxes'); idamnjanovic@1: fprintf('\n you will need to have MEX setup to compile C files.'); idamnjanovic@1: fprintf('\n\n If this is not already setup, please type "n" to exit and then '); idamnjanovic@1: fprintf('\n run "mex -setup" or type "help mex" in the MATLAB command prompt.'); idamnjanovic@1: fprintf('\n\n ********************************************************************'); idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n ********************************************************************'); idamnjanovic@1: fprintf('\n\n IMPORTANT: YOU MUST HAVE AN INTERNET CONNECTION'); idamnjanovic@1: fprintf('\n YOU CANNOT INSTALL SMALLBOX WITHOUT ONE!'); idamnjanovic@1: fprintf('\n\n ********************************************************************'); idamnjanovic@1: install_ack = input('\n\n Do you wish to continue: ([y]/n)? ','s'); idamnjanovic@1: idamnjanovic@1: if strcmp(install_ack,'"n"'), idamnjanovic@1: install_ack = 'n'; idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: if install_ack == 'n', idamnjanovic@1: return; idamnjanovic@1: else idamnjanovic@1: fprintf('\n\n Installation now beginning...'); idamnjanovic@1: % fprintf('\n\nFor further information on the toolboxes see SMALLbox documentation\n\n'); idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: SMALL_path=pwd; idamnjanovic@1: SMALL_p=genpath(SMALL_path); idamnjanovic@1: addpath(SMALL_p); idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n Initialising SPARCO and Rice Wavelet Toolbox Setup'); idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: Sparco_path = [SMALL_path,FS,'toolboxes',FS,'SPARCO']; idamnjanovic@1: if exist([Sparco_path, FS, 'sparco-1.2.zip'],'file'), idamnjanovic@1: Sparco_zip=[Sparco_path, FS, 'sparco-1.2.zip']; idamnjanovic@1: else idamnjanovic@1: Sparco_zip='http://www.cs.ubc.ca/labs/scl/sparco/downloads.php?filename=sparco-1.2.zip'; idamnjanovic@1: fprintf('\n\n Downloading toolbox, please be patient\n\n'); idamnjanovic@1: end idamnjanovic@1: unzip(Sparco_zip,Sparco_path); idamnjanovic@1: Sparco_p=genpath(Sparco_path); idamnjanovic@1: addpath(Sparco_p); idamnjanovic@1: cd(SMALL_path) idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: if exist('curvelab.pdf','file') idamnjanovic@1: crvroot = fileparts(which('curvelab.pdf')); idamnjanovic@1: addtopath(crvroot,'fdct_usfft_matlab'); idamnjanovic@1: addtopath(crvroot,'fdct_wrapping_matlab'); idamnjanovic@1: addtopath(crvroot,'fdct_wrapping_cpp/mex'); idamnjanovic@1: addtopath(crvroot,'fdct3d/mex'); idamnjanovic@1: else idamnjanovic@1: fprintf(['\nWarning: CurveLab is not in the path. Sparco Problems 50-51 ' ... idamnjanovic@1: 'will not work.\n\n']); idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: cd([Sparco_path, FS, 'sparco-1.2', FS, 'tools' ,FS, 'rwt']) idamnjanovic@1: fprintf('Compiling the Rice Wavelet Toolbox MEX interfaces...'); idamnjanovic@1: try idamnjanovic@1: if exist('mdwt' ,'file')~=3, mex mdwt.c mdwt_r.c; end idamnjanovic@1: if exist('midwt' ,'file')~=3, mex midwt.c midwt_r.c; end idamnjanovic@1: if exist('mrdwt' ,'file')~=3, mex mrdwt.c mrdwt_r.c; end idamnjanovic@1: if exist('mirdwt','file')~=3, mex mirdwt.c mirdwt_r.c; end idamnjanovic@1: fprintf('SPARCO Installation Successful!\n'); idamnjanovic@1: catch idamnjanovic@1: warning('Could not compile Rice Wavelet Toolbox MEX interfaces.'); idamnjanovic@1: end idamnjanovic@1: cd(SMALL_path) idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n Initialising SPGL1 Setup'); idamnjanovic@1: idamnjanovic@1: try idamnjanovic@1: SPGL1_path = [SMALL_path,FS,'toolboxes',FS,'SPGL1']; idamnjanovic@1: if exist([SPGL1_path, FS, 'spgl1-1.7.zip'],'file'), idamnjanovic@1: SPGL1_zip=[SPGL1_path, FS, 'spgl1-1.7.zip']; idamnjanovic@1: else idamnjanovic@1: SPGL1_zip='http://www.cs.ubc.ca/labs/scl/spgl1/downloads.php?filename=spgl1-1.7.zip'; idamnjanovic@1: fprintf('\n\n Downloading toolbox, please be patient\n\n'); idamnjanovic@1: end idamnjanovic@1: unzip(SPGL1_zip,SPGL1_path); idamnjanovic@1: SPGL1_p=genpath(SPGL1_path); idamnjanovic@1: addpath(SPGL1_p); idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: cd([SPGL1_path,FS,'spgl1-1.7']); idamnjanovic@1: fprintf('Compiling SPGL1 MEX interfaces ...'); idamnjanovic@1: try idamnjanovic@1: spgsetup; idamnjanovic@1: fprintf('\n SPGL1 Installation Successful!\n'); idamnjanovic@1: catch idamnjanovic@1: warning('Could not compile SPGL1 MEX interfaces.'); idamnjanovic@1: end idamnjanovic@1: catch idamnjanovic@1: fprintf('\n SPGL1 Installation Failed\n'); idamnjanovic@1: end idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n Initialising SparseLab Setup'); idamnjanovic@1: idamnjanovic@1: try idamnjanovic@1: SL_path = [pwd,FS,'toolboxes',FS,'SparseLab']; idamnjanovic@1: if exist([SL_path, FS, 'SparseLab21-Core.zip'],'file'), idamnjanovic@1: SL_zip=[SL_path, FS, 'SparseLab21-Core.zip']; idamnjanovic@1: else idamnjanovic@1: SL_zip='http://sparselab.stanford.edu/SparseLab_files/Download_files/SparseLab21-Core.zip'; idamnjanovic@1: fprintf('\n\n Downloading toolbox, please be patient\n\n'); idamnjanovic@1: end idamnjanovic@1: unzip(SL_zip,SL_path); idamnjanovic@1: SL_p=genpath(SL_path); idamnjanovic@1: addpath(SL_p); idamnjanovic@1: fprintf('\n SparseLab Installation Successful!\n'); idamnjanovic@1: catch idamnjanovic@1: fprintf('\n SparseLab Installation Failed\n'); idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n Initialising Sparsify Setup'); idamnjanovic@1: idamnjanovic@1: try idamnjanovic@1: Sparsify_path = [pwd,FS,'toolboxes',FS,'Sparsify']; idamnjanovic@1: if exist([Sparsify_path, FS, 'sparsify_0_4.zip'],'file'), idamnjanovic@1: Sparsify_zip=[Sparsify_path, FS, 'sparsify_0_4.zip']; idamnjanovic@1: else idamnjanovic@1: Sparsify_zip='http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify_0_4.zip'; idamnjanovic@1: fprintf('\n\n Downloading toolbox, please be patient\n\n'); idamnjanovic@1: end idamnjanovic@1: unzip(Sparsify_zip,Sparsify_path); idamnjanovic@1: Sparsify_p=genpath(Sparsify_path); idamnjanovic@1: addpath(Sparsify_p); idamnjanovic@1: fprintf('\n Sparsify Installation Successful\n'); idamnjanovic@1: catch idamnjanovic@1: fprintf('\n Sparsify Installation Failed\n'); idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n Initialising GPSR Setup'); idamnjanovic@1: idamnjanovic@1: try idamnjanovic@1: GPSR_path = [pwd,FS,'toolboxes',FS,'GPSR']; idamnjanovic@1: if exist([GPSR_path, FS, 'GPSR_6.0.zip'],'file'), idamnjanovic@1: GPSR_zip=[GPSR_path, FS,'GPSR_6.0.zip']; idamnjanovic@1: else idamnjanovic@1: GPSR_zip='http://www.lx.it.pt/~mtf/GPSR/GPSR_6.0.zip'; idamnjanovic@1: fprintf('\n\n Downloading toolbox, please be patient\n\n'); idamnjanovic@1: end idamnjanovic@1: unzip(GPSR_zip,GPSR_path); idamnjanovic@1: GPSR_p=genpath(GPSR_path); idamnjanovic@1: addpath(GPSR_p); idamnjanovic@1: fprintf('\n GPSR Installation Successful\n'); idamnjanovic@1: catch idamnjanovic@1: fprintf('\n GPSR Installation Failed'); idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n Initialising OMPbox and KSVDBox Setup'); idamnjanovic@1: idamnjanovic@1: try idamnjanovic@1: KSVD_path = [pwd,FS,'toolboxes',FS,'KSVD']; idamnjanovic@1: if exist([KSVD_path, FS, 'ompbox9.zip'],'file'), idamnjanovic@1: omp_zip=[KSVD_path, FS, 'ompbox9.zip']; idamnjanovic@1: else idamnjanovic@1: omp_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ompbox9.zip'; idamnjanovic@1: fprintf('\n\n Downloading toolbox, please be patient\n\n'); idamnjanovic@1: end idamnjanovic@1: unzip(omp_zip,[KSVD_path, FS, 'ompbox']); idamnjanovic@1: idamnjanovic@1: cd([KSVD_path, FS, 'ompbox', FS, 'private']); idamnjanovic@1: make; idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: idamnjanovic@1: if exist([KSVD_path, FS, 'ksvdbox10.zip'],'file'), idamnjanovic@1: KSVD_zip=[KSVD_path, FS, 'ksvdbox10.zip']; idamnjanovic@1: else idamnjanovic@1: KSVD_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ksvdbox10.zip'; idamnjanovic@1: fprintf('\n\n Downloading toolbox, please be patient\n\n'); idamnjanovic@1: end idamnjanovic@1: unzip(KSVD_zip,[KSVD_path, FS, 'ksvdbox']); idamnjanovic@1: cd([KSVD_path, FS, 'ksvdbox', FS, 'private']); idamnjanovic@1: make; idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: KSVD_p=genpath(KSVD_path); idamnjanovic@1: addpath(KSVD_p); idamnjanovic@1: fprintf('\n KSVDBox and OMPBox Installation Successful\n'); idamnjanovic@1: catch idamnjanovic@1: fprintf('\n KSVDBox and OMPBox Installation Failed'); idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n Initialising SMALLbox Examples Setup'); idamnjanovic@1: idamnjanovic@1: % Need to do a bit of temporary housekeeping first. idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: try idamnjanovic@1: cd(['examples',FS,'private']); idamnjanovic@1: if exist('addtocols' ,'file')~=3, idamnjanovic@1: fprintf('\n Compiling MEX interfaces for SMALL examples \n'); idamnjanovic@1: make; idamnjanovic@1: end idamnjanovic@1: fprintf('\n SMALLbox Examples Installation Successful! \n'); idamnjanovic@1: catch idamnjanovic@1: fprintf('\n SMALLbox Examples Installation Failed \n'); idamnjanovic@1: end idamnjanovic@1: cd(SMALL_path); idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n ******************************************************************'); idamnjanovic@1: fprintf('\n\n SMALLbox Installation Complete!'); idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: fprintf('\n\n For more information on the installed toolboxes see'); idamnjanovic@1: fprintf('\n\n Sparco: http://www.cs.ubc.ca/labs/scl/sparco/'); idamnjanovic@1: fprintf('\n\n SPGL1: http://www.cs.ubc.ca/labs/spgl1/?n=HomePage'); idamnjanovic@1: fprintf('\n\n SparseLab: http://sparselab.stanford.edu/ (PLEASE REGISTER SPARSELAB!)'); idamnjanovic@1: fprintf('\n\n Sparsify: http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify.html'); idamnjanovic@1: fprintf('\n\n GPSR: http://www.lx.it.pt/~mtf/GPSR/'); idamnjanovic@1: fprintf('\n\n OMPbox and KSVDBox: http://www.cs.technion.ac.il/~ronrubin/\n'); idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: % LIST DEMOS FROM EXAMPLE DIRECTORY... idamnjanovic@1: idamnjanovic@1: demo_ack = input('\n\n Would you like to run a demo: ([y]/n)? ','s'); idamnjanovic@1: idamnjanovic@1: if demo_ack == 'n', idamnjanovic@1: fprintf('\n Thank you for installing SMALLbox.'); idamnjanovic@1: fprintf('\n For information on the SMALLbox example scripts'); idamnjanovic@1: fprintf('\n Please see the examples directory. \n'); idamnjanovic@1: return; idamnjanovic@1: else idamnjanovic@1: idamnjanovic@1: 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: switch(demo_choice) idamnjanovic@1: case{'1'} idamnjanovic@1: fprintf('\n Running SMALL_solver_test problem'); idamnjanovic@1: SMALL_solver_test; idamnjanovic@1: case{'2'} idamnjanovic@1: fprintf('\n Running SMALL_solver_test_Audio problem'); idamnjanovic@1: SMALL_solver_test_Audio; idamnjanovic@1: otherwise idamnjanovic@1: return; idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: end idamnjanovic@1: idamnjanovic@1: idamnjanovic@1: