0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % FILTERBANK constructor for filterbank class.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: FILTERBANK constructor for filterbank class.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % CONSTRUCTOR:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % fb = filterbank() - creates an empty filterbank object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % fb = filterbank(filters) - construct from an array of filters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % fb = filterbank(filters, type) - construct from an array of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % filters and the bank type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % <a href="matlab:utils.helper.displayMethodInfo('filterbank', 'filterbank')">Parameters Description</a>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % VERSION: $Id: filterbank.m,v 1.31 2011/08/15 13:40:18 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 classdef filterbank < ltpda_uoh
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % Property definition %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 %---------- Public (read/write) Properties ----------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 %---------- Protected read-only Properties ----------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 properties (SetAccess = protected)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 filters = []; % Filters of the bank
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 type = ''; % Type of the bank
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 %---------- Private Properties ----------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 properties (GetAccess = protected, SetAccess = protected)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % Check property setting %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 % Constructor %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 function obj = filterbank(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 import utils.const.*
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 utils.helper.msg(msg.OMNAME, 'running %s/%s', mfilename('class'), mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % Collect all filterbank objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 [banks, invars, rest] = utils.helper.collect_objects(varargin(:), 'filterbank');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 if isempty(rest) && ~isempty(banks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % Do copy constructor and return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 utils.helper.msg(msg.OPROC1, 'copy constructor');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 obj = copy(banks, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 for kk=1:numel(obj)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 obj(kk).addHistory(filterbank.getInfo('filterbank', 'None'), [], [], obj(kk).hist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 switch nargin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 case 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%% no input %%%%%%%%%%%%%%%%%%%%%%%%%%%*
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 utils.helper.msg(msg.OPROC1, 'empty constructor');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 obj.addHistory(filterbank.getInfo('filterbank', 'None'), plist(), [], []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 case 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 %%%%%%%%%%%%%%%%%%%%%%%%%%% One input %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 if ischar(varargin{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 %%%%%%%%%% pzm = filterbank('foo.mat') %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 %%%%%%%%%% pzm = filterbank('foo.xml') %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 utils.helper.msg(msg.OPROC1, 'constructing from file %s', varargin{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 obj = fromFile(obj, varargin{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 elseif isa(varargin{1}, 'miir') || isa(varargin{1}, 'mfir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 obj = obj.fromFilters(plist('filters', varargin{1}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 elseif isstruct(varargin{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 %%%%%%%%%% mdl = filterbank(struct) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 utils.helper.msg(msg.OPROC1, 'constructing from struct');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 obj = obj.fromStruct(varargin{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 elseif isa(varargin{1}, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 %%%%%%%%%% mdl = filterbank(plist-object) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 pl = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 if pl.isparam('filters')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 utils.helper.msg(msg.OPROC1, 'constructing from filters');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 obj = obj.fromFilters(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 elseif pl.isparam('filename')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 %%%%%%%%%% f = filterbank('foo.mat') %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 %%%%%%%%%% f = filterbank('foo.xml') %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 utils.helper.msg(msg.OPROC1, 'constructing from file %s', varargin{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 obj = fromFile(obj, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 elseif pl.isparam('hostname') || pl.isparam('conn')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 utils.helper.msg(msg.OPROC1, 'constructing from repository %s', pl.find('hostname'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 obj = obj.fromRepository(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 elseif pl.isparam('built-in')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 utils.helper.msg(msg.OPROC1, 'constructing from built-in model');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 obj = fromModel(obj, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 obj.setObjectProperties(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 obj.addHistory(filterbank.getInfo('filterbank', 'None'), pl, [], []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 error('### Unknown single argument constructor.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 case 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 %%%%%%%%%%%%%%%%%%%%%%%%%%% two input %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 if (isa(varargin{1}, 'database') || isa(varargin{1}, 'mpipeline.repository.RepositoryConnection')) && isnumeric(varargin{2})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 %%%%%%%%%% mdl = filterbank(<database-object>, [IDs]) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 obj = obj.fromRepository(plist('conn', varargin{1}, 'id', varargin{2}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 elseif isa(varargin{1}, 'filterbank') && isa(varargin{2}, 'plist') && isempty(varargin{2}.params)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 %%%%%%%%%% f = filterbank(filterbank, <empty-plist>) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 obj = filterbank(varargin{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 elseif isa(varargin{1}, 'ltpda_filter') && ischar(varargin{2})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 %%%%%%%%%% f = filterbank(filter-object, 'parallel') %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 obj = obj.fromFilters(plist('filters', varargin{1}, 'type', varargin{2}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 elseif isa(varargin{1}, 'ltpda_filter') && isa(varargin{2}, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 %%%%%%%%%% f = filterbank(filter-object, plist-object) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 obj = obj.fromFilters(combine(plist('filters', varargin{1}), varargin{2}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 elseif isa(varargin{1}, 'org.apache.xerces.dom.DeferredElementImpl') && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 isa(varargin{2}, 'history')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 %%%%%%%%%% obj = filterbank(DOM node, history-objects) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 obj = fromDom(obj, varargin{1}, varargin{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 elseif isa(varargin{1}, 'ltpda_uoh') && isa(varargin{2}, 'plist')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 %%%%%%%%%%% filterbank(<ltpda_uoh>-object, plist-object) %%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 % always recreate from plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 % If we are trying to load from file, and the file exists, do
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 % that. Otherwise, copy the input object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 if varargin{2}.isparam('filename')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 if exist(fullfile('.', find(varargin{2}, 'filename')), 'file')==2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 obj = filterbank(varargin{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 obj = filterbank(varargin{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 obj = filterbank(varargin{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 elseif isa(varargin{1}, 'ltpda_filter') && isa(varargin{2}, 'ltpda_filter')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 obj = obj.fromFilters(plist('filters', [varargin{:}]));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 error('### Unknown 2 argument constructor.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 [filts, invars, rest] = utils.helper.collect_objects(varargin, 'ltpda_filter');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 if numel(filts) > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 obj = obj.fromFilters(plist('filters', filts));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 [mdls, invars, rest] = utils.helper.collect_objects(varargin, 'filterbank');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 %%% Do we have a list of filterbanks as input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 if ~isempty(mdls) && isempty(rest)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 obj = filterbank(mdls);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 error('### Unknown number of arguments.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 end % End constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 % Methods (protected) %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 methods (Access = protected)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 % Methods (static) %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 methods (Static)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 function mdls = getBuiltInModels(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 mdls = ltpda_uo.getBuiltInModels('filterbank');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 function out = VEROUT()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 out = '$Id: filterbank.m,v 1.31 2011/08/15 13:40:18 hewitson Exp $';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 function ii = getInfo(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 ii = utils.helper.generic_getInfo(varargin{:}, 'filterbank');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 function out = SETS()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 out = [SETS@ltpda_uoh, {'From Filters'}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 function plout = getDefaultPlist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 persistent pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 persistent lastset;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 pl = filterbank.buildplist(set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 lastset = set;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 plout = pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 function out = buildplist(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 if ~utils.helper.ismember(lower(filterbank.SETS), lower(set))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 error('### Unknown set [%s]', set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 out = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 out = filterbank.addGlobalKeys(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 out = buildplist@ltpda_uoh(out, set);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 switch lower(set)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 case 'from filters'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 % Filters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 p = param({'filters','The array of MFIR or MIIR filter objects.'}, paramValue.EMPTY_DOUBLE);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 % Type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 p = param({'type','The type of filter bank (parallel or serial).'}, {1, {'parallel', 'serial'}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 out.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 end % function out = getDefaultPlist(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 function obj = initObjectWithSize(n,m)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 obj = filterbank.newarray([n m]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 end % End static methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 % Methods (static, private) %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 methods (Static, Access=private)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 end % End static, private methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 % Methods (static, hidden) %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 methods (Static = true, Hidden = true)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 varargout = loadobj(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 varargout = update_struct(varargin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 % Methods (public) %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 varargout = char(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 varargout = display(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 varargout = copy(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 varargout = resp(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 varargout = setIunits(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 varargout = setOunits(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 methods (Hidden = true)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 varargout = attachToDom(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 % Methods (protected) %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 methods (Access = protected)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 varargout = fromStruct(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 varargout = fromDom(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 % Methods (private) %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 methods (Access = private)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 % Constructors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 varargout = fromFilters(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 end % End classdef
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314
|