76 Chapter 4: <strong>IDL</strong> <strong>Wavelet</strong> <strong>Toolkit</strong> Reference\ / \ /S0,D0S1,D1At each level of the hierarchy, the WV_PWT function is used to compute the scalingcoefficient Si and wavelet coefficient Di (where i represents the position). Theletters s, S, S and d, D, D represent increasing scale. The wavelet coefficients arestored in Result in order from largest scales to smallest:Result = [ S0, S1, D0, D1, D0, D1, D2, D3,d0, d1, d2, d3, d4, d5, d6, d7 ]Two-Dimensional ArrayFor a two-dimensional Array, the wavelet transform is computed using the pyramidalalgorithm along each dimension. The wavelet coefficients are stored in order with thelargest scales in the [0, 0] position. As an example, for an 8 x 8 Array, the Result is an8 x 8 array with the following structure:[0,0][[ A0B0 A1B0 C0B0 C1B0 c0B0 c1B0 c2B0 c3B0 ],[ A0B1 A1B1 C0B1 C1B1 c0B1 c1B1 c2B1 c3B1 ],[ A0D0 A1D0 C0D0 C1D0 c0D0 c1D0 c2D0 c3D0 ],[ A0D1 A1D1 C0D1 C1D1 c0D1 c1D1 c2D1 c3D1 ],[ A0d0 A1d0 C0d0 C1d0 c0d0 c1d0 c2d0 c3d0 ],[ A0d1 A1d1 C0d1 C1d1 c0d1 c1d1 c2d1 c3d1 ],[ A0d2 A1d2 C0d2 C1d2 c0d2 c1d2 c2d2 c3d2 ],[ A0d3 A1d3 C0d3 C1d3 c0d3 c1d3 c2d3 c3d3 ]]Here A and B represent the scale coefficients for the first and second dimensions,respectively, The C and D represent the largest-scale wavelet coefficients for the firstand second dimensions, respectively, while c and d represent the small-scale waveletcoefficients. Subscripts 0, 1, 2, 3 denote the position of the wavelet within the image.ExampleThe following example shows how to compute the first three levels of the pyramidalgorithm using either the N_LEVELS keyword or WV_PWT:; Construct a random vector.n = 1024x = randomn(s,n)info = WV_FN_DAUBECHIES(2, wavelet, scaling, ioff, joff); Take the wavelet transform but stop at level 3.WV_DWT<strong>IDL</strong> <strong>Wavelet</strong> <strong>Toolkit</strong>
Chapter 4: <strong>IDL</strong> <strong>Wavelet</strong> <strong>Toolkit</strong> Reference 77wv_dwtpartial = WV_DWT(x, wavelet, scaling, ioff, joff, $N_LEVELS=3); First level of the pyramid algorithm.wv_level1 = WV_PWT(x, wavelet, scaling, ioff, joff)w_scaling1 = wv_level1[0:n/2-1] ; Left (scaling) halfw_wavelet1 = wv_level1[n/2:*] ; Right (wavelet) half; Second level of the pyramid algorithm.wv_level2 = WV_PWT(w_scaling1, wavelet, scaling, ioff, joff)w_scaling2 = wv_level2[0:n/4-1] ; Left (scaling) halfw_wavelet2 = wv_level2[n/4:*] ; Right (wavelet) half; Third level of the pyramid algorithm.wv_level3 = WV_PWT(w_scaling2, wavelet, scaling, ioff, joff); Verify that using WV_DWT with N_LEVELS=3; is the same as calling WV_PWT three times.wv_partial123 = [wv_level3, w_wavelet2, w_wavelet1]print, MAX(ABS(wv_dwtpartial - wv_partial123))<strong>IDL</strong> prints:0.000000Version History5.3 Introduced6.1 Added N_LEVELS keywordSee AlsoWV_CWT, WV_PWT, WTN<strong>IDL</strong> <strong>Wavelet</strong> <strong>Toolkit</strong>WV_DWT