view SMALLboxSetup.m @ 1:7750624e0c73 version0.5

(none)
author idamnjanovic
date Thu, 05 Nov 2009 16:36:01 +0000
parents
children b6d8f2c4f5fa
line wrap: on
line source
function SMALLboxSetup(varargin)
% 
% SMALLboxSetup 
% 
% Will automatically download and install existing toolboxes
% on sparse representations and dictionary learning
% 
% For this function an internet connection is required.  
%
% SMALLbox initialisation
% Ivan Damnjanovic, Matthew Davies 2009


clc;

FS=filesep;

fprintf('\n ********************************************************************');
fprintf('\n\n This script will install the SMALLbox Evaluation Framework v.0.4');
fprintf('\n\n It contains the following toolboxes:');
fprintf('\n Sparco version 1.2, incorporating Rice Wavelet Toolbox version 2.4');
fprintf('\n SPGL1 Toolbox version 1.7 ');
fprintf('\n SparseLab Toolbox version 2.1');
fprintf('\n Sparsify Toolbox version 0.4');
fprintf('\n GPSR Toolbox version 5.0');
fprintf('\n OMPbox version 9');
fprintf('\n KSVDbox version 10');
fprintf('\n\n ********************************************************************');

fprintf('\n\n The toolbox will be installed in: ');
fprintf('\n %s%s\n',pwd,FS);
fprintf('\n ********************************************************************');
fprintf('\n\n IMPORTANT: To successfully install all toolboxes');
fprintf('\n you will need to have MEX setup to compile C files.');
fprintf('\n\n If this is not already setup, please type "n" to exit and then ');
fprintf('\n run "mex -setup" or type "help mex" in the MATLAB command prompt.');
fprintf('\n\n ********************************************************************');


fprintf('\n ********************************************************************');
fprintf('\n\n IMPORTANT: YOU MUST HAVE AN INTERNET CONNECTION');
fprintf('\n YOU CANNOT INSTALL SMALLBOX WITHOUT ONE!');
fprintf('\n\n ********************************************************************');
install_ack = input('\n\n Do you wish to continue: ([y]/n)? ','s');

if strcmp(install_ack,'"n"'),
  install_ack = 'n';
end

if install_ack == 'n',
  return;
else
  fprintf('\n\n Installation now beginning...');
%  fprintf('\n\nFor further information on the toolboxes see SMALLbox documentation\n\n');
end




SMALL_path=pwd;
SMALL_p=genpath(SMALL_path);
addpath(SMALL_p);


fprintf('\n ******************************************************************');
fprintf('\n\n Initialising SPARCO and Rice Wavelet Toolbox Setup');


    Sparco_path = [SMALL_path,FS,'toolboxes',FS,'SPARCO'];
    if exist([Sparco_path, FS, 'sparco-1.2.zip'],'file'),
        Sparco_zip=[Sparco_path, FS, 'sparco-1.2.zip'];
    else
        Sparco_zip='http://www.cs.ubc.ca/labs/scl/sparco/downloads.php?filename=sparco-1.2.zip';
        fprintf('\n\n Downloading toolbox, please be patient\n\n');
    end
    unzip(Sparco_zip,Sparco_path);
    Sparco_p=genpath(Sparco_path);
    addpath(Sparco_p);
    cd(SMALL_path)
   


   if exist('curvelab.pdf','file')
    crvroot = fileparts(which('curvelab.pdf'));
    addtopath(crvroot,'fdct_usfft_matlab');
    addtopath(crvroot,'fdct_wrapping_matlab');
    addtopath(crvroot,'fdct_wrapping_cpp/mex');
    addtopath(crvroot,'fdct3d/mex');
   else
    fprintf(['\nWarning: CurveLab is not in the path. Sparco Problems 50-51 ' ...
            'will not work.\n\n']);
   end
   
    cd([Sparco_path, FS, 'sparco-1.2', FS, 'tools' ,FS, 'rwt'])
    fprintf('Compiling the Rice Wavelet Toolbox MEX interfaces...');
    try
        if exist('mdwt'  ,'file')~=3, mex mdwt.c   mdwt_r.c;   end
        if exist('midwt' ,'file')~=3, mex midwt.c  midwt_r.c;  end
        if exist('mrdwt' ,'file')~=3, mex mrdwt.c  mrdwt_r.c;  end
        if exist('mirdwt','file')~=3, mex mirdwt.c mirdwt_r.c; end
        fprintf('SPARCO Installation Successful!\n');
    catch
        warning('Could not compile Rice Wavelet Toolbox MEX interfaces.');
    end
    cd(SMALL_path)



fprintf('\n ******************************************************************');
fprintf('\n\n Initialising SPGL1 Setup');

  try
    SPGL1_path = [SMALL_path,FS,'toolboxes',FS,'SPGL1'];
    if exist([SPGL1_path, FS, 'spgl1-1.7.zip'],'file'),
        SPGL1_zip=[SPGL1_path, FS, 'spgl1-1.7.zip'];
    else
        SPGL1_zip='http://www.cs.ubc.ca/labs/scl/spgl1/downloads.php?filename=spgl1-1.7.zip';
        fprintf('\n\n Downloading toolbox, please be patient\n\n');
    end
    unzip(SPGL1_zip,SPGL1_path);
    SPGL1_p=genpath(SPGL1_path);
    addpath(SPGL1_p);
   

    cd([SPGL1_path,FS,'spgl1-1.7']);
    fprintf('Compiling SPGL1 MEX interfaces ...'); 
    try
      spgsetup;
      fprintf('\n SPGL1 Installation Successful!\n');
    catch
      warning('Could not compile SPGL1 MEX interfaces.');
    end
  catch
    fprintf('\n SPGL1 Installation Failed\n');    
  end
    cd(SMALL_path);   

fprintf('\n ******************************************************************');
fprintf('\n\n Initialising SparseLab Setup');

  try
    SL_path = [pwd,FS,'toolboxes',FS,'SparseLab'];
    if exist([SL_path, FS, 'SparseLab21-Core.zip'],'file'),
        SL_zip=[SL_path, FS, 'SparseLab21-Core.zip'];
    else
        SL_zip='http://sparselab.stanford.edu/SparseLab_files/Download_files/SparseLab21-Core.zip';
        fprintf('\n\n Downloading toolbox, please be patient\n\n');
    end
    unzip(SL_zip,SL_path);
    SL_p=genpath(SL_path);
    addpath(SL_p);
    fprintf('\n SparseLab Installation Successful!\n');
  catch
    fprintf('\n SparseLab Installation Failed\n');    
    cd(SMALL_path);   
  end


fprintf('\n ******************************************************************');
fprintf('\n\n Initialising Sparsify Setup');

  try
    Sparsify_path = [pwd,FS,'toolboxes',FS,'Sparsify'];
    if exist([Sparsify_path, FS, 'sparsify_0_4.zip'],'file'),
        Sparsify_zip=[Sparsify_path, FS, 'sparsify_0_4.zip'];
    else
        Sparsify_zip='http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify_0_4.zip';
        fprintf('\n\n Downloading toolbox, please be patient\n\n');
    end
    unzip(Sparsify_zip,Sparsify_path);
    Sparsify_p=genpath(Sparsify_path);
    addpath(Sparsify_p);
    fprintf('\n Sparsify Installation Successful\n'); 
  catch
    fprintf('\n Sparsify Installation Failed\n');    
    cd(SMALL_path);   
  end

fprintf('\n ******************************************************************');
fprintf('\n\n Initialising GPSR Setup');

  try
    GPSR_path = [pwd,FS,'toolboxes',FS,'GPSR'];
    if exist([GPSR_path, FS, 'GPSR_6.0.zip'],'file'),
        GPSR_zip=[GPSR_path, FS,'GPSR_6.0.zip'];
    else
        GPSR_zip='http://www.lx.it.pt/~mtf/GPSR/GPSR_6.0.zip';
        fprintf('\n\n Downloading toolbox, please be patient\n\n');
    end
    unzip(GPSR_zip,GPSR_path);
    GPSR_p=genpath(GPSR_path);
    addpath(GPSR_p);
    fprintf('\n GPSR Installation Successful\n'); 
  catch
    fprintf('\n GPSR Installation Failed'); 
    cd(SMALL_path);    
  end
  

fprintf('\n ******************************************************************');
fprintf('\n\n Initialising OMPbox and KSVDBox Setup');

  try
    KSVD_path = [pwd,FS,'toolboxes',FS,'KSVD'];
    if exist([KSVD_path, FS, 'ompbox9.zip'],'file'),
        omp_zip=[KSVD_path, FS, 'ompbox9.zip'];
    else
        omp_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ompbox9.zip';
        fprintf('\n\n Downloading toolbox, please be patient\n\n');
    end
    unzip(omp_zip,[KSVD_path, FS, 'ompbox']);
    
    cd([KSVD_path, FS, 'ompbox', FS, 'private']);
    make;
    cd(SMALL_path);
    
    if exist([KSVD_path, FS, 'ksvdbox10.zip'],'file'),
        KSVD_zip=[KSVD_path, FS, 'ksvdbox10.zip'];
    else
        KSVD_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ksvdbox10.zip';
        fprintf('\n\n Downloading toolbox, please be patient\n\n');
    end
    unzip(KSVD_zip,[KSVD_path, FS, 'ksvdbox']);
    cd([KSVD_path, FS, 'ksvdbox', FS, 'private']);
    make;
    cd(SMALL_path);
    KSVD_p=genpath(KSVD_path);
    addpath(KSVD_p);
    fprintf('\n KSVDBox and OMPBox Installation Successful\n'); 
  catch
    fprintf('\n KSVDBox and OMPBox Installation Failed'); 
    cd(SMALL_path);    
  end
  



fprintf('\n ******************************************************************');
fprintf('\n\n Initialising SMALLbox Examples Setup');

    % Need to do a bit of temporary housekeeping first.
    cd(SMALL_path);
  try
    cd(['examples',FS,'private']);
    if exist('addtocols'  ,'file')~=3,
    fprintf('\n Compiling MEX interfaces for SMALL examples \n');
    make;
    end
    fprintf('\n SMALLbox Examples Installation Successful! \n');
  catch
    fprintf('\n SMALLbox Examples Installation Failed \n');
  end
    cd(SMALL_path);



fprintf('\n ******************************************************************');
fprintf('\n\n SMALLbox Installation Complete!');


fprintf('\n\n For more information on the installed toolboxes see');
fprintf('\n\n Sparco: http://www.cs.ubc.ca/labs/scl/sparco/');
fprintf('\n\n SPGL1: http://www.cs.ubc.ca/labs/spgl1/?n=HomePage');
fprintf('\n\n SparseLab: http://sparselab.stanford.edu/   (PLEASE REGISTER SPARSELAB!)');
fprintf('\n\n Sparsify: http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify.html');
fprintf('\n\n GPSR: http://www.lx.it.pt/~mtf/GPSR/');
fprintf('\n\n OMPbox and KSVDBox: http://www.cs.technion.ac.il/~ronrubin/\n');


% LIST DEMOS FROM EXAMPLE DIRECTORY...

demo_ack = input('\n\n Would you like to run a demo: ([y]/n)? ','s');

if demo_ack == 'n',
  fprintf('\n Thank you for installing SMALLbox.');
  fprintf('\n For information on the SMALLbox example scripts');
  fprintf('\n Please see the examples directory. \n');
  return;
else
  
  demo_choice = input('\n Enter 1 to run SMALL_solver_test, 2 to run SMALL_solver_test_Audio or q to quit: ','s');
  switch(demo_choice)
  case{'1'}
    fprintf('\n Running SMALL_solver_test problem');
    SMALL_solver_test;
  case{'2'}
    fprintf('\n Running SMALL_solver_test_Audio problem');
    SMALL_solver_test_Audio;
  otherwise
    return;
  end
  
end