substituteWaveletCoef substitutes the wavelet coefficients stored wavelet object generated through 2D wavelet transform with user-given values and returns the modified wavelet object.

substituteWaveletCoef(grid, waveletobj, values)

Arguments

grid

The number of voxels in one row (or, one column) of the brain slice of interest. Must be a power of 2. The total number of voxels is grid^2. The maximum value of grid for this package is 512.

waveletobj

A wavelet object of class imwd.object, usually obtained by performing 2D wavelet transformion through the function imwd of package wavethresh.

values

The values with which the wavelet coefficients are to be replaced. The order should be consistent with imwd.object class.

Value

A wavelet object of class imwd.object with updated wavelet coefficients.

Details

The maximum value of grid for this package is 512.

Author

Nilotpal Sanyal, Marco Ferreira

Maintainer: Nilotpal Sanyal <nilotpal.sanyal@gmail.com>

See also

Examples

set.seed(1)
n <- 3
grid <- 8
ntime <- 10
designmat <- cbind( rep(1,10), c(rep(c(1,0),5)) )
data <- array(dim=c(n,grid,grid,ntime),
  rnorm(n*grid*grid*ntime))
glm.fit <- glmcoef(n, grid, data, designmat)
glmcoefstd <- glm.fit$GLMCoefStandardized[,,,1]
dwt = wavethresh::imwd(glmcoefstd[1,,],type="wavelet",
  family="DaubLeAsymm",filter.number=6,bc="periodic")
dwt
#> Class 'imwd' : Discrete Image Wavelet Transform Object:
#>        ~~~~  : List with 19 components with names
#>               nlevels fl.dbase filter type bc date w2L4 w2L1 w2L2 w2L3 w1L4 w1L1 w1L2 w1L3 w0L4 w0L1 w0L2 w0L3 w0Lconstant 
#> 
#> $ wNLx are LONG coefficient vectors !
#> 
#> summary(.):
#> ----------
#> UNcompressed image wavelet decomposition structure
#> Levels:  3 
#> Original image was 8 x 8  pixels.
#> Filter was:  Daub cmpct on least asymm N=6 
#> Boundary handling:  periodic 

values = rnorm(grid^2-1)
dwtnew = substituteWaveletCoef(grid,dwt,values)
dwtnew
#> Class 'imwd' : Discrete Image Wavelet Transform Object:
#>        ~~~~  : List with 19 components with names
#>               nlevels fl.dbase filter type bc date w2L4 w2L1 w2L2 w2L3 w1L4 w1L1 w1L2 w1L3 w0L4 w0L1 w0L2 w0L3 w0Lconstant 
#> 
#> $ wNLx are LONG coefficient vectors !
#> 
#> summary(.):
#> ----------
#> UNcompressed image wavelet decomposition structure
#> Levels:  3 
#> Original image was 8 x 8  pixels.
#> Filter was:  Daub cmpct on least asymm N=6 
#> Boundary handling:  periodic