function WBBASIS, tree,D,value ;+ ;NAME: ; WBBASIS ; ;PURPOSE: ; To find the best basis using the Coifman-Wickerhauser Best-Basis Algorithm. ; ;CATEGORY: ; Wavelets. ; ;CALLING SEQUENCE: ; btree = WBBASIS(tree,D,vtree) ; ;INPUTS: ; tree = stat-tree (output by WSTATREE) ; D = maximum depth of tree-search ; ;OUTPUTS: ; vtree = value of components of best basis ; vtree(1) holds value of best basis ; ;RESTRICTIONS: ; None. ; ;EXAMPLE: ; ;SEE ALSO: ; wstatree ; ;NOTICE: ; Yale University has filed a patent application for this algorithm. ; Commercial Development based on this algorithm should ; be cleared by Yale University. Contact them for liscensing information. ; ;MODIFICATION HISTORY: ; Written by: Amara Graps December 1994/September1995 ;Translated from MatLab Wavelab routine: bestbasis.m ;- basis = FLTARR(N_ELEMENTS(tree)) value = tree FOR dd=D-1, 0, -1 DO BEGIN FOR b=0, (2^dd-1) DO BEGIN vparent = tree(WNODE(dd,b)-1) vchild = value(WNODE(dd+1,2*b)-1) + value(WNODE(dd+1,2*b+1)-1) IF ((vparent LE vchild)) THEN BEGIN basis(WNODE(dd,b)-1) = 0 value(WNODE(dd,b)-1) = vparent END ELSE BEGIN basis(WNODE(dd,b)-1) = 1 value(WNODE(dd,b)-1) = vchild END ;else END END PRINT, 'Best basis is: ' PRINT, value(0) ; ; Algorithm Source: WaveLab Version 0.600 ; WaveLab WWW site: http://playfair.stanford.edu/ ; WaveLab Questions? e-mail wavelab@playfair.stanford.edu ; RETURN, basis End ;***************************************************