WaveletMapIndexed[f,wd]
applies the function f to the arrays of coefficients and indices of a ContinuousWaveletData or DiscreteWaveletData object.
WaveletMapIndexed[f,dwd,wind]
applies f to the DiscreteWaveletData coefficients specified by wind.
WaveletMapIndexed[f,cwd,octvoc]
applies f to the ContinuousWaveletData coefficients specified by octvoc.
WaveletMapIndexed
WaveletMapIndexed[f,wd]
applies the function f to the arrays of coefficients and indices of a ContinuousWaveletData or DiscreteWaveletData object.
WaveletMapIndexed[f,dwd,wind]
applies f to the DiscreteWaveletData coefficients specified by wind.
WaveletMapIndexed[f,cwd,octvoc]
applies f to the ContinuousWaveletData coefficients specified by octvoc.
Details
- WaveletMapIndexed takes a ContinuousWaveletData or DiscreteWaveletData object and returns an object of the same type.
- For dwd with coefficients {wind1->coef1,…}, WaveletMapIndexed[f,dwd] effectively corresponds to DiscreteWaveletData[{wind1->f[coef1,wind1],…},…].
- For cwd with coefficients {{oct1,voc1}->coef1,…}, WaveletMapIndexed[f,cwd] effectively corresponds to ContinuousWaveletData[{{oct1,voc1}->f[coef1,{oct1,voc1}],…},…].
- Each f[coefi,windi] should return an array or Image of the same dimensions as coefi.
- For Sound and SampledSoundList, each coefi is given as a list of vectors, each corresponding to a channel of sound samples.
- The wavelet index convention is the same as explained in ContinuousWaveletData and DiscreteWaveletData.
Examples
open all close allBasic Examples (2)
Rescale all coefficients of a discrete wavelet transform by 20:
dwd = DiscreteWaveletTransform[{0, 1, 2, 0}];WaveletMapIndexed[20#&, dwd]Normal gives the array of coefficients:
Normal[%]Compare with the unmodified coefficients:
Normal[dwd]Amplify the {1} coefficient of the stationary wavelet transform of an image:
swt = StationaryWaveletTransform[[image]]WaveletMapIndexed[ImageMultiply[#, 10]&, swt, {1}]The inverse wavelet transform gives an image with vertical edges sharpened:
{InverseWaveletTransform[%], [image]}Scope (11)
Basic Uses (3)
Apply an arbitrary function to all coefficients of a discrete wavelet transform:
WaveletMapIndexed[Map[f, #]&, DiscreteWaveletTransform[{0, 1, 2, 0}]]//NormalApply a symbolic function that also depends on the wavelet index for each coefficient vector:
WaveletMapIndexed[Function[{v, wind}, Map[f[#, wind]&, v]], DiscreteWaveletTransform[{0, 1, 2, 0}]]//NormalWaveletMapIndexed operates on ContinuousWaveletData or DiscreteWaveletData:
{DiscreteWaveletTransform[{0, 1, 2, 0}], ContinuousWaveletTransform[{1, 2, 3, 4}]}The result is a wavelet data object of the same type:
{dwd, cwd} = Map[WaveletMapIndexed[c c + 0.2, #]&, %]The modified data can be used in other wavelet functions such as inverse wavelet transforms:
{InverseWaveletTransform[dwd], InverseContinuousWaveletTransform[cwd]}Coefficient Specification (4)
Transform only specified coefficients in DiscreteWaveletData:
dwd = DiscreteWaveletTransform[{0, 1, 2, 0}]Apply a function to detail coefficients only, using the index pattern {___, 1}:
WaveletMapIndexed[c Map[f, c], dwd, {___, 1}]//NormalApply a function to coarse coefficients only, using the index pattern {___, 0}:
WaveletMapIndexed[c Map[f, c], dwd, {___, 0}]//NormalTransform only specified coefficients in a ContinuousWaveletData:
cwd = ContinuousWaveletTransform[{1, 2, 5}, Automatic, {3, 2}]Apply a function to coefficients in the first octave {1,_} only:
WaveletMapIndexed[c Map[f, c], cwd, {1, _}]//NormalApply a function to all coefficients except those in the second octave, first voice {2,1}:
WaveletMapIndexed[c Map[f, c], cwd, Except[{2, 1}]]//NormalThe function f can depend on the wavelet index as its second argument:
WaveletMapIndexed[{c, wind} Length[wind] * c, DiscreteWaveletTransform[{0, 1, 2, 0}]]//NormalDefine a function with an arbitrary dependence on the wavelet index:
f[c_, wind_] := c
f[c_, {1, 2}] := 0c
f[c_, {1, 4}] := Chop[c, 0.5]Apply the function to continuous wavelet transform coefficients:
WaveletMapIndexed[f, ContinuousWaveletTransform[{0, 1, 2, 0}]]//NormalData (4)
For list data, the coefficients supplied as the first argument of f are lists:
dwd = DiscreteWaveletTransform[{0, 1, 2, 0}];Normal[dwd]Apply a function that transforms lists:
WaveletMapIndexed[c 2c, dwd]//NormalFor multidimensional data, the coefficients are arrays of the same depth:
dwd = DiscreteWaveletTransform[(| | | | |
| - | -- | -- | -- |
| 1 | 2 | 3 | 0 |
| 5 | 6 | 0 | 8 |
| 9 | 0 | 11 | 12 |
| 0 | 14 | 15 | 16 |)];Normal[dwd]Apply a function that transforms array coefficients of that depth:
WaveletMapIndexed[c Inverse[c], dwd]//NormalFor image data, the coefficients are supplied to f as Image objects:
dwd = DiscreteWaveletTransform[[image], Automatic, 2];dwd[All, "Image"]The coefficients have the same number of channels as the original image:
{ImageChannels[{0, 2} /. %], ImageChannels[[image]]}Apply a function that transforms image coefficients:
dwd2 = WaveletMapIndexed[c Blur[c], dwd]dwd2[All, "Image"]For sound data, the coefficients are two-dimensional arrays:
dwd = DiscreteWaveletTransform[Play[{Sin[12000t ^ 2], Sin[16000t ^ 2]}, {t, 0, 0.25}]]Dimensions of one coefficient:
Dimensions[{0, 0, 0, 1} /. Normal[dwd]]The two dimensions specify the channel number and the wavelet coefficients for that channel:
Map[ListLinePlot, {0, 0, 0, 1} /. Normal[dwd]]Apply a function that transforms two-channel data:
f[{l_, r_}, index_] := {l, r ^ 2}dwd2 = WaveletMapIndexed[f, dwd]Map[ListLinePlot, {0, 0, 0, 1} /. Normal[dwd2]]Reconstructed Sound data:
InverseWaveletTransform[dwd2]Applications (7)
Data Processing (2)
Coefficients with short indices correspond to small-scale structure in the data:
indspec = index_ /; Length[index] ≤ 3;Zero all small-scale coefficients from the stationary wavelet transform of random data:
WaveletMapIndexed[0#&, StationaryWaveletTransform[RandomReal[1, 100]], indspec]The inverse wavelet transform varies only on larger scales:
ListLinePlot[InverseWaveletTransform[%]]Perform a simple thresholding operation by removing low-amplitude wavelet coefficients:
d = Sin[Sqrt[Range[100]]] + RandomReal[0.1, 100];WaveletMapIndexed[Chop[#, 0.1]&, StationaryWaveletTransform[d, DaubechiesWavelet[4]]]Compare with the original data:
{ListLinePlot[d, PlotLabel -> "data"],
ListLinePlot[InverseWaveletTransform[%], PlotLabel -> "filtered data"]}Image Processing (3)
Blur an image by setting small-scale detail coefficients to zero:
WaveletMapIndexed[ImageMultiply[#, 0]&, StationaryWaveletTransform[[image], Automatic, 2], {___, 1 | 2 | 3}]Compare with the original image:
{InverseWaveletTransform[%], [image]}Sharpen an image by amplifying small-scale detail coefficients:
WaveletMapIndexed[ImageMultiply[#, 3]&, StationaryWaveletTransform[[image], Automatic, 2], {___, 1 | 2 | 3}]Compare with the original image:
{InverseWaveletTransform[%], [image]}Use a mask image to vary between blurring and sharpening across an image:
WaveletMapIndexed[ImageMultiply[#, [image]]&, StationaryWaveletTransform[[image], Automatic, 3], {___, 1 | 2 | 3}]Compare with the original image:
{InverseWaveletTransform[%], [image]}Sound Processing (1)
Apply a nonlinear function to wavelet coefficients for sound data:
dwd = DiscreteWaveletTransform[Sound[«1»]];WaveletMapIndexed[c Sin[10c ^ 2], dwd]Inverse transform to obtain a reconstructed sound object:
InverseWaveletTransform[%]Wavelet Thresholding (1)
Perform a wavelet-based shrinkage based on conditional mean:
data = Table[5 Exp[-100 (t - 0.5)^2] + 5 Exp[-10 t], {t, 0, 1, 0.001}];noisy = data + RandomReal[NormalDistribution[0, 0.2], Length[data]];ListLinePlot[noisy]Compute a discrete wavelet transform up to refinement level 6:
dwd = DiscreteWaveletTransform[noisy, SymletWavelet[4], 6, Padding -> "Extrapolated"];Compute the standard deviation
for the finest detail coefficients:
Subscript[σ, ϵ] = StandardDeviation[First@dwd[{1}, "Values"]]Compute the standard deviation
for all wavelet coefficients:
Subscript[σ, W] = StandardDeviation[Flatten[dwd[{___, 1}, "Values"]]]Assuming a Gaussian mixture model, variance
can be estimated in the proportion
to
:
p = 0.99;Subscript[σ, G] = Sqrt[(Subsuperscript[σ, W, 2] - Subsuperscript[σ, ϵ, 2]/1 - p)];Shrinkage estimates of the signal coefficients are given by:
b = (Subsuperscript[σ, G, 2]/Subsuperscript[σ, G, 2] + Subsuperscript[σ, ϵ, 2]);c = (p Sqrt[Subsuperscript[σ, G, 2] + Subsuperscript[σ, ϵ, 2]]/(1 - p) Subscript[σ, ϵ]);shrink[w_List, wind_] := (b w/1 + c Exp[-(w^2 b/2 Subsuperscript[σ, ϵ, 2])])Use WaveletMapIndexed to map over detail coefficients:
ndwd = WaveletMapIndexed[shrink, dwd, {___, 1}];Reconstruct thresholded signal coefficients:
ListLinePlot[{data, InverseWaveletTransform[ndwd]}, PlotLabel -> "p=0.99"]Properties & Relations (3)
MapIndexed[f,expr] applies f to the parts of any expression:
MapIndexed[x f[x], {a, b, c}]WaveletMapIndexed[f,wd] applies f to the coefficients in the wavelet data object wd:
dwd = DiscreteWaveletTransform[{0, 1, 2}];WaveletMapIndexed[v Rescale[v], dwd]//NormalWaveletMapIndexed[vMap[f,v],wd] applies f to each part of each coefficient:
WaveletMapIndexed[v Map[f, v], dwd]//NormalMapIndexed gives the part specification as the second argument of f:
MapIndexed[{x, p} f[x, p], {a, b, c}]WaveletMapIndexed gives the wavelet index specification as the second argument of f:
WaveletMapIndexed[{v, wind} Map[f[#, wind]&, v], DiscreteWaveletTransform[{0, 1, 2}]]//NormalWaveletMapIndexed transforms arrays of coefficients, giving a new DiscreteWaveletData:
dwd = DiscreteWaveletTransform[Sqrt[Range[10]]];WaveletMapIndexed[v v ^ 2, dwd]Use Map and Normal[dwd] to transform coefficients into normal expressions:
Map[ListLinePlot[Last[#]]&, Normal[dwd]]Or use ReplaceAll (/.):
Normal[dwd] /. (wind_ -> v_) :> Framed[v]Possible Issues (2)
The function f is always passed the index specification as its second argument:
dwd = StationaryWaveletTransform[[image]];WaveletMapIndexed[Blur, dwd]Use a function that operates on its first argument only:
WaveletMapIndexed[img Blur[img], dwd]The function f should return an array or image of the same dimensions:
dwd = DiscreteWaveletTransform[{0, 0, 1, 0, 0}];WaveletMapIndexed[c 0, dwd]Listable functions return an array of the same dimensions:
WaveletMapIndexed[c Sqrt[c], dwd]Arithmetic operations such as multiplication are Listable:
WaveletMapIndexed[c 0c, dwd]Use Map for functions that are not Listable:
WaveletMapIndexed[c Map[f, c], dwd]//NormalRelated Guides
History
Text
Wolfram Research (2010), WaveletMapIndexed, Wolfram Language function, https://reference.wolfram.com/language/ref/WaveletMapIndexed.html.
CMS
Wolfram Language. 2010. "WaveletMapIndexed." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WaveletMapIndexed.html.
APA
Wolfram Language. (2010). WaveletMapIndexed. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WaveletMapIndexed.html
BibTeX
@misc{reference.wolfram_2026_waveletmapindexed, author="Wolfram Research", title="{WaveletMapIndexed}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/WaveletMapIndexed.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_waveletmapindexed, organization={Wolfram Research}, title={WaveletMapIndexed}, year={2010}, url={https://reference.wolfram.com/language/ref/WaveletMapIndexed.html}, note=[Accessed: 13-June-2026]}