putpacket.wst2D          package:wavethresh          R Documentation

_R_e_p_l_a_c_e _p_a_c_k_e_t _o_f _c_o_e_f_f_i_c_i_e_n_t_s _i_n _a _t_w_o-_d_i_m_e_n_s_i_o_n_a_l _n_o_n-_d_e_c_i_m_a_t_e_d _w_a_v_e_l_e_t _o_b_j_e_c_t (_w_s_t_2_D).

_D_e_s_c_r_i_p_t_i_o_n:

     This function replaces a packet of coefficients from a
     two-dimensional non-decimated wavelet ('wst2D') object and returns
     the modified object.

_U_s_a_g_e:

     putpacket.wst2D(wst2D, level, index, type="S", packet, Ccode=TRUE, ...)

_A_r_g_u_m_e_n_t_s:

   wst2D: 2D non-decimated wavelet object containing the coefficients
          you wish to replace.

   level: The resolution level of the coefficients that you wish to
          replace. Can range from 0 to 'nlevels(wpst)-1'.

   index: The index number within the resolution level of the packet of
          coefficients that you wish to replace. Index is a base-4
          number which is 'r' digits long. Each digit can be 0, 1, 2 or
          3 corresponding to no shifts, horizontal shift, vertical
          shift or horizontal and vertical shifts. The number 'r'
          indicates the depth of the resolution level from the data
          resolution i.e. where 'r = nlevels - level'.

          Where there is a string of more than one digit the left most
          digits correspond to finest scale shift selection, the right
          most digits to the coarser scales (I think).

  packet: A square matrix of dimension '2^level' which contains the new
          coefficients that you wish to insert.

    type: This is a one letter character string: one of "S", "H", "V"
          or "D" for the smooth coefficients, horizontal, vertical or
          diagonal detail.

   Ccode: If T then fast C code is used to obtain the packet, otherwise
          slow SPlus code is used. Unless you have some special reason
          always use the C code (and leave the argument at its
          default).

     ...: any other arguments

_D_e_t_a_i_l_s:

     The 'wst2D' function creates a 'wst2D' class object. Starting with
     a smooth the operators H, G, GS and HS (where G, H are the usual
     Mallat operators and S is the shift-by-one operator) are operated
     first on the rows and then the columns: i.e. so each of the
     operators HH, HG, GH, GG, HSH, HSG, GSH, GSG HHS, GHS, HGS, GGS
     HSHS, HSGS, GSHS and GSGS are applied. Then the same collection of
     operators is applied to all the derived smooths, i.e. HH, HSH, HHS
     and HSHS. 

     So the next level is obtained from the previous level with
     basically HH, HG, GH and GG but with extra shifts in the
     horizontal, vertical and horizontal and vertical directions. The
     index provides a way to enumerate the paths through this tree
     where each smooth has 4 children and indexed by a number between 0
     and 3. 

     Each of the 4 children has 4 components: a smooth, horizontal,
     vertical and diagonal detail, much in the same way as for the
     Mallat 2D wavelet transform implemented in the WaveThresh function
     'imwd'.

_V_a_l_u_e:

     An object of class 'wst2D' with coefficients at resolution level
     level, packet index and orientation given by type replaced by the
     matrix packet.

_R_E_L_E_A_S_E:

     Version 3.9 Copyright Guy Nason 1998

_S_e_e _A_l_s_o:

     'getpacket.wst2D', 'wst2D', 'wst2D.object'.

_E_x_a_m_p_l_e_s:

     #
     # Create a random image. 
     #
     #myrand <- matrix(rnorm(16), nrow=4, ncol=4)
     #myrand
     #            [,1]       [,2]        [,3]       [,4] 
     #[1,]  0.01692807  0.1400891 -0.38225727  0.3372708
     #[2,] -0.79799841 -0.3306080  1.59789958 -1.0606204
     #[3,]  0.29151629 -0.2028172 -0.02346776  0.5833292
     #[4,] -2.21505532 -0.3591296 -0.39354119  0.6147043
     #
     # Do the 2D non-decimated wavelet transform
     #
     #myrwst2D <- wst2D(myrand)
     #
     # Let's access the finest scale detail, not shifted in the vertical
     # direction.
     #
     #getpacket(myrwst2D, nlevels(myrwst2D)-1, index=0, type="V")
     #           [,1]       [,2] 
     #[1,] -0.1626819 -1.3244064
     #[2,]  1.4113247 -0.7383336
     #
     # Let's put some zeros in instead...
     #
     #zmat <- matrix(c(0,0,0,0), 2,2)
     #newwst2D <- putpacket(myrwst2D, nlevels(myrwst2D)-1,
     #       index=0, packet=zmat, type="V")
     #
     # And now look at the same packet as before
     #
     #getpacket(myrwst2D, nlevels(myrwst2D)-1, index=0, type
     #="V")
     #     [,1] [,2] 
     #[1,]    0    0
     #[2,]    0    0
     #
     # Yup, packet insertion o.k.

