[931198]: wavelets / private / nodeSubtreeBF.m Maximize Restore History

Download this file

nodeSubtreeBF.m    30 lines (28 with data), 911 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function nodesIdxs = nodeSubtreeBF(nodeNo,wt)
%NODESUBTREEBF Node subtree nodes in Breath-First order
% Usage: noOut = nodeSubtreeBF(nodeNo,wt);
%
% Input parameters:
% nodeNo : Node index.
% wt : Structure containing description of the filter tree.
%
% Output parameters:
% noOut : Nodes in a Breath-First order.
%
% subtreeIdx = [];
%
% children = treeStruct.children{nodeNo}(find(treeStruct.children{nodeNo}~=0));
% subtreeIdx(end+1:end+length(children)) = children;
%
% for ii=1:length(children)
% tmpSbIdx = nodeSubtreeBF(children(ii),treeStruct);
% subtreeIdx(end+1:end+length(tmpSbIdx)) = tmpSbIdx;
% end
toGoTrough = [nodeNo];
nodesIdxs = [];
while ~isempty(toGoTrough)
chtmp = find(wt.children{toGoTrough(1)}~=0);
chIdxtmp = wt.children{toGoTrough(1)}(chtmp);
nodesIdxs = [nodesIdxs,chIdxtmp];
toGoTrough = [toGoTrough(2:end),chIdxtmp];
end