diff SMALLboxSetup.m @ 12:b6d8f2c4f5fa

(none)
author idamnjanovic
date Thu, 25 Mar 2010 13:03:50 +0000
parents 7750624e0c73
children a0571bf2ff54
line wrap: on
line diff
--- a/SMALLboxSetup.m	Thu Mar 25 12:28:16 2010 +0000
+++ b/SMALLboxSetup.m	Thu Mar 25 13:03:50 2010 +0000
@@ -1,16 +1,17 @@
 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.  
+% 
+% 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;
@@ -23,8 +24,10 @@
 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 OMPbox version 10');
+fprintf('\n OMPSbox version 1');
+fprintf('\n KSVDbox version 13');
+fprintf('\n KSVDSbox version 11');
 fprintf('\n\n ********************************************************************');
 
 fprintf('\n\n The toolbox will be installed in: ');
@@ -51,7 +54,7 @@
   return;
 else
   fprintf('\n\n Installation now beginning...');
-%  fprintf('\n\nFor further information on the toolboxes see SMALLbox documentation\n\n');
+
 end
 
 
@@ -62,10 +65,13 @@
 addpath(SMALL_p);
 
 
-fprintf('\n ******************************************************************');
-fprintf('\n\n Initialising SPARCO and Rice Wavelet Toolbox Setup');
+%%
 
 
+if ~exist('sparcoSetup.m','file')
+    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'];
@@ -77,20 +83,20 @@
     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 ' ...
+    
+    
+    
+    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
-   
+    end
+    
     cd([Sparco_path, FS, 'sparco-1.2', FS, 'tools' ,FS, 'rwt'])
     fprintf('Compiling the Rice Wavelet Toolbox MEX interfaces...');
     try
@@ -102,137 +108,243 @@
     catch
         warning('Could not compile Rice Wavelet Toolbox MEX interfaces.');
     end
-    cd(SMALL_path)
+    cd(SMALL_path);
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n SPARCO and Rice Wavelet Toolbox are already installed');
+end
+%%
 
 
+if ~exist('spgsetup.m','file')
+    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);
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n SPGL1 is already installed');
+end
+%%
 
-fprintf('\n ******************************************************************');
-fprintf('\n\n Initialising SPGL1 Setup');
+if ~exist('SparsePath.m','file')
+    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
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n SparseLab is already installed');
+end
+%%
 
-  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'];
+if ~exist('greed_pcgp.m','file')
+    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
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n Sparsify is already installed');
+end
+%%
+if ~exist('GPSR_Basic.m','file')
+    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
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n GPSR is already installed');
+end
+
+%%
+
+if ~exist('ksvdver.m','file')
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n Initialising OMPbox and KSVDBox Setup');
+    
+    try
+        KSVD_path = [pwd,FS,'toolboxes',FS,'KSVD'];
+        if exist([KSVD_path, FS, 'ompbox10.zip'],'file'),
+            omp_zip=[KSVD_path, FS, 'ompbox10.zip'];
+        else
+            omp_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ompbox10.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, 'ksvdbox13.zip'],'file'),
+            KSVD_zip=[KSVD_path, FS, 'ksvdbox13.zip'];
+        else
+            KSVD_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ksvdbox13.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
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n KSVD is already installed');
+end
+%%
+if ~exist('ksvdsver.m','file')
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n Initialising OMPSbox and KSVDSBox Setup');
+    
+    try
+        KSVDS_path = [pwd,FS,'toolboxes',FS,'KSVDS'];
+        if exist([KSVDS_path, FS, 'ompsbox1.zip'],'file'),
+            omps_zip=[KSVDS_path, FS, 'ompsbox1.zip'];
+        else
+            omps_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ompsbox1.zip';
+            fprintf('\n\n Downloading toolbox, please be patient\n\n');
+        end
+        unzip(omps_zip,[KSVDS_path, FS, 'ompsbox']);
+        
+        cd([KSVDS_path, FS, 'ompsbox', FS, 'private']);
+        make;
+        cd(SMALL_path);
+        
+        if exist([KSVDS_path, FS, 'ksvdsbox11.zip'],'file'),
+            KSVDS_zip=[KSVDS_path, FS, 'ksvdsbox11.zip'];
+        else
+            KSVDS_zip='http://www.cs.technion.ac.il/%7Eronrubin/Software/ksvdsbox11.zip';
+            fprintf('\n\n Downloading toolbox, please be patient\n\n');
+        end
+        unzip(KSVDS_zip,[KSVDS_path, FS, 'ksvdsbox']);
+        cd([KSVDS_path, FS, 'ksvdsbox', FS, 'private']);
+        make;
+        cd(SMALL_path);
+        KSVDS_p=genpath(KSVDS_path);
+        addpath(KSVDS_p);
+        fprintf('\n KSVDSbox and OMPSbox Installation Successful\n');
+    catch
+        fprintf('\n KSVDSbox and OMPSbox Installation Failed');
+        cd(SMALL_path);
+    end
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n KSVDS is already installed');
+end
+%%
+
+if ~exist('mexTrainDL.m','file')
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n If you want to use SMALLbox with SPAMS On-line Dictionary Learning please go to:');
+     fprintf('\n http://www.di.ens.fr/willow/SPAMS/index.html');
+    fprintf('\n and follow the instructions. The License prohibits redistribution of the SPAMS.');
+    
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n SPAMS On-line Dictionary Learning is already installed');
+end;
+%%
+
+
+if ~exist('midiInfo.m','file')
+try
+    matlab_midi_path = [pwd,FS,'util',FS,'matlab_midi'];
+    if exist([matlab_midi_path, FS, 'matlab_midi.zip'],'file'),
+        matlab_midi_zip=[SL_path, FS, 'matlab_midi.zip'];
     else
-        SPGL1_zip='http://www.cs.ubc.ca/labs/scl/spgl1/downloads.php?filename=spgl1-1.7.zip';
+        matlab_midi_zip='http://www.kenschutte.com/static/code/matlab_midi.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;
+    unzip(matlab_midi_zip,matlab_midi_path);
+    matlab_midi_p=genpath(matlab_midi_path);
+    addpath(matlab_midi_p);
+    fprintf('\n matlab_midi (http://www.kenschutte.com/midi/) Installation Successful!\n');
+catch
+    fprintf('\n matlab_midi (http://www.kenschutte.com/midi/) Installation Failed\n');
     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
-  
-
+end
+else
+    fprintf('\n ******************************************************************');
+    fprintf('\n\n matlab_midi (http://www.kenschutte.com/midi/) is already installed');
+end 
+%%
 
 
 fprintf('\n ******************************************************************');
@@ -241,7 +353,7 @@
     % Need to do a bit of temporary housekeeping first.
     cd(SMALL_path);
   try
-    cd(['examples',FS,'private']);
+    cd(['Problems',FS,'private']);
     if exist('addtocols'  ,'file')~=3,
     fprintf('\n Compiling MEX interfaces for SMALL examples \n');
     make;
@@ -278,18 +390,19 @@
   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');
+  demo_choice = input('\n 1 to run SMALL_solver_test \n 2 to run Dictionary Learning for Image Denoising demo \n 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;
+    fprintf('\n Running SMALL Image Denoise problem');
+    SMALL_ImgDenoise_DL_test_KSVDvsSPAMS;
   otherwise
     return;
   end
   
 end
-

+
+