Home > phiwave > @phiw_wavelet > phiw_wavelet.m

phiw_wavelet

PURPOSE ^

class constructor for phiw_wavelet object

SYNOPSIS ^

function [o, others] = phiw_wavelet(params, varargin)

DESCRIPTION ^

 class constructor for phiw_wavelet object
 FORMAT [o, others] = phiw_wavelet(params, varargin)

 Synopsis
 --------
 o = phiw_wavelet;
 
 % Imagine you have set variables H G RH RG to be analysis low, high pass
 % synthesis low, high pass filters respectively
 o = phiw_wavelet(struct('H', H, 'G', G, 'RH', RH, 'RG', RG));
 
 % Or to access classdata (see classdata method)
 res = maroi('classdata', 'wtcentermethod'); 

 Inputs [defaults]
 params  - maybe a filter structure containing fields
              H  - analysis low pass   [1]
              G  - analysis high pass  [1]
              RH - synthesis low pass  [1]
              RG - synthesis high pass [1]
            OR
              structure containing field 'filters' as above, and any other
              object fields - see below for other object fields
            OR 
              string specifying class function - one of
              - classdata: get or set class data
   
 varargin - if first argument was string, then varargin represent input
 to class function calls.  Otherwise varargin will be one argument:

 others   - optional structure with any other fields for the object
            Fields can be 
             - detail_right - flag, if == 1 specifies detail coeffs to
                              right of vector (UviWave) [1]
             - verbose      - flag, if == 1, gives messages sometimes
             - wtcentermethod - method to determine wavelet centre
                                method, see center.m function for
                                definitions.  Can be integer from 0 to 3

 As usual, any unrecognized fields in input structures are passed out
 for other (child) objects to parse if they like

 $Id: phiw_wavelet.m,v 1.6 2005/06/05 04:42:22 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [o, others] = phiw_wavelet(params, varargin)
0002 % class constructor for phiw_wavelet object
0003 % FORMAT [o, others] = phiw_wavelet(params, varargin)
0004 %
0005 % Synopsis
0006 % --------
0007 % o = phiw_wavelet;
0008 %
0009 % % Imagine you have set variables H G RH RG to be analysis low, high pass
0010 % % synthesis low, high pass filters respectively
0011 % o = phiw_wavelet(struct('H', H, 'G', G, 'RH', RH, 'RG', RG));
0012 %
0013 % % Or to access classdata (see classdata method)
0014 % res = maroi('classdata', 'wtcentermethod');
0015 %
0016 % Inputs [defaults]
0017 % params  - maybe a filter structure containing fields
0018 %              H  - analysis low pass   [1]
0019 %              G  - analysis high pass  [1]
0020 %              RH - synthesis low pass  [1]
0021 %              RG - synthesis high pass [1]
0022 %            OR
0023 %              structure containing field 'filters' as above, and any other
0024 %              object fields - see below for other object fields
0025 %            OR
0026 %              string specifying class function - one of
0027 %              - classdata: get or set class data
0028 %
0029 % varargin - if first argument was string, then varargin represent input
0030 % to class function calls.  Otherwise varargin will be one argument:
0031 %
0032 % others   - optional structure with any other fields for the object
0033 %            Fields can be
0034 %             - detail_right - flag, if == 1 specifies detail coeffs to
0035 %                              right of vector (UviWave) [1]
0036 %             - verbose      - flag, if == 1, gives messages sometimes
0037 %             - wtcentermethod - method to determine wavelet centre
0038 %                                method, see center.m function for
0039 %                                definitions.  Can be integer from 0 to 3
0040 %
0041 % As usual, any unrecognized fields in input structures are passed out
0042 % for other (child) objects to parse if they like
0043 %
0044 % $Id: phiw_wavelet.m,v 1.6 2005/06/05 04:42:22 matthewbrett Exp $
0045 
0046 myclass = 'phiw_wavelet'; 
0047 
0048 if nargin < 1
0049   params = [];
0050 end
0051 
0052 % parse out string action calls (class data, helper functions)
0053 if ischar(params)
0054   switch params
0055    case 'classdata'
0056     o = pr_classdata(varargin{:});
0057    otherwise
0058     error(['Do not recognize action string ' params]);
0059   end
0060   return
0061 end
0062 
0063 % Default object structure
0064 cvs_v   = mars_cvs_version(myclass);
0065 wtcm = phiw_wavelet('classdata', 'wtcentermethod');
0066 defstruct = struct('filters', struct('H',1,'G',1,'RH',1,'RG',1),...
0067            'detail_right', 1, ...
0068            'verbose', 1, ...
0069            'wtcentermethod', wtcm);
0070 
0071 if nargin < 1
0072   defstruct.cvs_version = cvs_v;
0073   o = class(defstruct, myclass);
0074   others = [];
0075   return
0076 end
0077 
0078 if nargin < 2
0079   others = [];
0080 else
0081   others = varargin{1};
0082 end
0083 
0084 if isa(params, myclass)
0085   o = params;
0086   % Check for simple form of call
0087   if isempty(others), return, end
0088 
0089   % Otherwise, we are being asked to set fields of object
0090   [p others] = mars_struct('split', others, defstruct);
0091   if isfield(p, 'filters'), o = set_filters(o, p.filters); end
0092   if isfield(p, 'detail_right'), o.detail_right = p.detail_right; end
0093   if isfield(p, 'verbose'), o.verbose = p.verbose; end
0094   if isfield(p, 'wtcentermethod'), o.wtcentermethod = p.wtcentermethod; end
0095   return
0096 end
0097 
0098 % Check params input argument
0099 if isfield(params, 'H'), params = struct('filters', params); end
0100 filt = mars_struct('getifthere', params, 'filters');
0101 if isempty(filt), error('Need filters as input'); end
0102 [errf msg] = pr_check_filters(filt);
0103 if errf, error(msg); end
0104 
0105 % Fill with other params, defaults
0106 % Parse into fields for this object,children
0107 params = mars_struct('ffillmerge', params, others);
0108 [params, others] = mars_struct('ffillsplit', defstruct, params);
0109 
0110 params.cvs_version = cvs_v;
0111 
0112 % set the phiw_wavelet object
0113 o  = class(params, myclass);
0114 
0115 return

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003