cycle_spin(x, func, max_shifts, shift_steps=1, num_workers=None, multichannel=False, func_kw={})
Cycle spinning was proposed as a way to approach shift-invariance via performing several circular shifts of a shift-variant transform .
For a n-level discrete wavelet transforms, one may wish to perform all shifts up to max_shifts = 2**n - 1
. In practice, much of the benefit can often be realized with only a small number of shifts per axis.
For transforms such as the blockwise discrete cosine transform, one may wish to evaluate shifts up to the block size used by the transform.
Data for input to func
.
A function to apply to circularly shifted versions of x
. Should take x
as its first argument. Any additional arguments can be supplied via func_kw
.
If an integer, shifts in range(0, max_shifts+1)
will be used along each axis of x
. If a tuple, range(0, max_shifts[i]+1)
will be along axis i.
The step size for the shifts applied along axis, i, are range((0, max_shifts[i]+1, shift_steps[i]))
. If an integer is provided, the same step size is used for all axes.
The number of parallel threads to use during cycle spinning. If set to None
, the full set of available cores are used.
Whether to treat the final axis as channels (no cycle shifts are performed over the channels axis).
Additional keyword arguments to supply to func
.
The output of func(x, **func_kw)
averaged over all combinations of the specified axis shifts.
Cycle spinning (repeatedly apply func to shifted versions of x).
>>> import skimage.dataSee :
... from skimage import img_as_float
... from skimage.restoration import denoise_wavelet, cycle_spin
... img = img_as_float(skimage.data.camera())
... sigma = 0.1
... img = img + sigma * np.random.standard_normal(img.shape)
... denoised = cycle_spin(img, func=denoise_wavelet,
... max_shifts=3) # doctest: +SKIP
The following pages refer to to this document either explicitly or contain code examples using this.
skimage.restoration._cycle_spin.cycle_spin
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them