help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Easy Wavelet capability - got it right finally


From: Marc Normandin
Subject: Re: Easy Wavelet capability - got it right finally
Date: Wed, 13 Aug 2008 14:43:10 -0400
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

John W. Eaton wrote:
> On 12-Aug-2008, Marc Normandin wrote:
> 
> | WavePath.m does a check for what kind of system you're running in order
> | to decide whether to use / or \ to separate directory names in the path.
> |  It looks like it doesn't recognize your system type because Octave is
> | running through cygwin or something similar.
> |
> | Could you run the following commands in Octave and report the results
> | back?
> |
> | 1. computer
> | 2. isunix
> | 3. ispc
> |
> | With that information I should be able to make a quick fix to WavePath.m.
> 
> Wouldn't it be better to use the fullfile to concatenate filename
> components instead of trying to determine the separator?  Using
> fullfile should be portable to recent versions of both Octave and
> Matlab and wouldn't depend the return value from any of these
> functions.
> 
> jwe

Thanks, John, for suggesting the fullfile command, and Matthias, for
suggesting filesep in a subsequent post.  I wasn't aware of these
functions until you mentioned them.  (Seems the WaveLab crew didn't know
of them either.)

Using fullfile would make for a clean solution, but would have required
more substantial changes because the original file concatenates the
directories and path explicitly.  For the dual reasons of laziness and
desire to leave the structure of the original as intact as possible, I
simply modified the existing definitions of variables to use filesep and
pathsep in place of system-specific, hard-coded values.  The modified
file is attached.

Ran the script and successfully added Wavelab directories to the path on
Ubuntu 8.04 (Octave 3.0.0) and Windows XP (Octave 3.0.0 MSVC).

-- 
------------------------------------------------------------------
Marc D. Normandin              http://web.ics.purdue.edu/~mdnorman
Graduate Research Assistant                     address@hidden
Indiana University School of Medicine           317-278-9841 (tel)
Department of Radiology, Division of Research   317-274-1067 (fax)
------------------------------------------------------------------
%  WavePath -- initialize path to include WaveLab 
%       
% This file was modified to remove some strange markup characters and
% to remove dependency on the "matlabroot" variable.  The second
% change was implemented by simply assuming that this file is being
% run from the WaveLab directory.  If this does not suit your needs,
% you should assign the "WAVELABPATH" variable appropriately below.
%
% Modified: 10 August 2008
%           Marc Normandin  address@hidden
%             Removed some strange markup characters and eliminated 
%             dependency on the "matlabroot" variable.  This second
%             change makes it necessary to run the script from the
%             Wavelab850/ directory.
% Modified: 13 August 2008
%           Marc Normandin  address@hidden
%             Removed hard-coded, system-dependent, hard-coded 
%             definitions of path and file separators (as was used in
%             original WavePath.m file).  Now using pathsep and 
%             filesep instead.

fprintf('Welcome to WaveLab v 850 \n');
disp('Setting Global Variables');
%
global WAVELABPATH
global PATHNAMESEPARATOR
global PREFERIMAGEGRAPHICS
global MATLABPATHSEPARATOR
global WLVERBOSE

WLVERBOSE = 'Yes';
PREFERIMAGEGRAPHICS = 1;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% make path independent of "matlabroot"
% requires you run this from WaveLab directory
% using pathsep and filesep instead of system specific definitions
PATHNAMESEPARATOR = filesep;
WAVELABPATH = strcat (pwd, PATHNAMESEPARATOR);
MATLABPATHSEPARATOR = pathsep;
% Marc Normandin  address@hidden
% 13 August 2008
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

UserWavelabPath='';
while (exist(WAVELABPATH)~=7)
  WAVELABPATH=input(sprintf('Directory %s does not exist.\nEnter the correct 
path (type 0 to exit): ',WAVELABPATH),'s')
  if WAVELABPATH=='0'
    fprintf('\nError occurs and WaveLab has not been set up.\n')
    fprintf('Solution: Identify the correct path for WaveLab Directory in 
toolbox\n\n')
    clear all;
    return;
  end
  if (WAVELABPATH(end))~=PATHNAMESEPARATOR
    WAVELABPATH=strcat(WAVELABPATH, PATHNAMESEPARATOR);
  end
end


%
global MATLABVERSION
V = version;
MATLABVERSION = str2num(V(1:3));

if MATLABVERSION < 6,
  disp('Warning: This version is only supported on Matlab 6.x and 7.x');
end

%
% Basic Tools
p = path;
pref = [MATLABPATHSEPARATOR WAVELABPATH];
post = PATHNAMESEPARATOR;
p = [p pref];

p = [p pref 'Biorthogonal'      post];
p = [p pref 'Continuous'        post];
p = [p pref 'Datasets'          post];
p = [p pref 'DeNoising'         post];
p = [p pref 'Documentation'     post];
p = [p pref 'FastAlgorithms'    post];
p = [p pref 'Fractals'          post];
p = [p pref 'Interpolating'     post];
p = [p pref 'MEXSource'         post];
p = [p pref 'Median'            post];
p = [p pref 'Median' PATHNAMESEPARATOR 'HigherDegree' post];
p = [p pref 'Meyer'             post];
p = [p pref 'Orthogonal'        post];
p = [p pref 'Packets' PATHNAMESEPARATOR 'One-D' post];
p = [p pref 'Packets' PATHNAMESEPARATOR 'Two-D' post];
p = [p pref 'Papers'            post];
p = [p pref 'Pursuit'           post];
p = [p pref 'Invariant'         post];
p = [p pref 'Utilities'         post];
p = [p pref 'TimeFrequency'     post];
p = [p pref 'Workouts'          post];

% Papers
pref = [MATLABPATHSEPARATOR WAVELABPATH];
pref = [pref 'Papers'   post];
p = [p pref 'Adapt'                     post];
p = [p pref 'Asymp'                     post];
p = [p pref 'Blocky'                    post];
p = [p pref 'Correl'                    post];
p = [p pref 'Ideal'                     post];
p = [p pref 'MinEntSeg'                 post];
p = [p pref 'MIPT'                      post];
p = [p pref 'RiskAnalysis'              post];
p = [p pref 'ShortCourse'               post];
p = [p pref 'SpinCycle'                 post];
p = [p pref 'Tour'                      post];
p = [p pref 'VillardDeLans'             post];

pref = [MATLABPATHSEPARATOR WAVELABPATH];
pref = [pref 'Workouts'         post];
p = [p pref 'BestOrthoBasis'    post];
p = [p pref 'MatchingPursuit'   post];
p = [p pref 'Toons'             post];
p = [p pref 'MultiFractal'              post];

% Browsers
pref = [MATLABPATHSEPARATOR WAVELABPATH];
pref = [pref 'Browsers' post];
p = [p pref 'One-D'     post];
p = [p pref 'WaveTour'  post];

pref = [MATLABPATHSEPARATOR WAVELABPATH];

% Book(s)
pref = [MATLABPATHSEPARATOR WAVELABPATH];
pref = [pref 'Books' PATHNAMESEPARATOR 'WaveTour' post];
p = [p pref 'WTCh02'    post];
p = [p pref 'WTCh04'    post];
p = [p pref 'WTCh05'    post];
p = [p pref 'WTCh06'    post];
p = [p pref 'WTCh07'    post];
p = [p pref 'WTCh08'    post];
p = [p pref 'WTCh09'    post];
p = [p pref 'WTCh10'    post];

path(p);
disp('Pathnames Successfully Set');
clear p pref post

%
fprintf('global WAVELABPATH = "%s"\n',              WAVELABPATH)
fprintf('global PATHNAMESEPARATOR = "%s"; ',  PATHNAMESEPARATOR)
fprintf('global MATLABVERSION = %g\n',            MATLABVERSION)
fprintf('global PREFERIMAGEGRAPHICS = %g\n',PREFERIMAGEGRAPHICS)
fprintf('WaveLab v 802 Setup Complete\n\n')
fprintf('Available Demos - Figures from the following papers:\n')
fprintf('  AdaptDemo  - ``Adapting to Unknown Smoothness via Wavelet 
Shrinkage''''\n')
fprintf('  AsympDemo  - ``Wavelet Shrinkage: Asymptopia?''''\n')
fprintf('  BlockyDemo - ``Smooth Wavelet Decompositions with Blocky Coefficient 
Kernels''''\n')
fprintf('  CorrelDemo - ``Wavelet Threshold Estimators for Data with Correlated 
Noise''''\n')
fprintf('  IdealDemo  - ``Ideal Spatial Adaptation via Wavelet Shrinkage''''\n')
fprintf('  MESDemo    - ``Minimum Entropy Segmentation''''\n')
fprintf('  MIPTDemo  - ``Nonlinear Wavelet Transforms based on 
Median-Interpolaton''''\n')
fprintf('  RiskDemo  - ``Exact Risk Analysis of Wavelet Regression''''\n')
fprintf('  SCDemo     - ``Nonlinear Wavelet Methods for Recovery of Signals, 
Densities\n')
fprintf('                  and Spectra from Indirect and Noisy Data''''\n')
fprintf('  CSpinDemo   - ``Translation-Invariant De-Noising''''\n')
fprintf('  TourDemo   - ``Wavelet Shrinkage and W.V.D. -- A Ten-Minute 
Tour''''\n')
fprintf('  VdLDemo    - ``WaveLab and Reproducible Research''''\n\n')
fprintf('Available Workouts:\n')
fprintf('  BBWorkout  - Workouts for Best Basis\n')
fprintf('  MPWorkout  - Workouts for Matching Pursuit\n')
fprintf('  MultiFrac  - Workouts for Continuous Wavelet Transform\n')
fprintf('  Toons      - The Cartoon Guide to Wavelets\n\n')
fprintf('Available Book(s):\n')
fprintf('  WaveTour   - ``WaveLet Tour of Signal Processing''''\n\n')

%
% the next statement leaves items in global workspace
%  but hides them from local workspace
%
clear WAVELABPATH MATLABVERSION PATHNAMESEPARATOR
clear Friend PREFERIMAGEGRAPHICS MATLABPATHSEPARATOR
 
 
%
%  Part of Wavelab Version 850
%  Built Tue Jan  3 13:20:38 EST 2006
%  This is Copyrighted Material
%  For Copying permissions see COPYING.m
%  Comments? e-mail address@hidden 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]