skimage 0.17.2

NotesParametersReturnsBackRef
cycle_spin(x, func, max_shifts, shift_steps=1, num_workers=None, multichannel=False, func_kw={})

Notes

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.

Parameters

x : array-like

Data for input to func .

func : function

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 .

max_shifts : int or tuple

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.

shift_steps : int or tuple, optional

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.

num_workers : int or None, optional

The number of parallel threads to use during cycle spinning. If set to None , the full set of available cores are used.

multichannel : bool, optional

Whether to treat the final axis as channels (no cycle shifts are performed over the channels axis).

func_kw : dict, optional

Additional keyword arguments to supply to func .

Returns

avg_y : np.ndarray

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).

Examples

This example is valid syntax, but we were not able to check execution
>>> import skimage.data
... 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
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.restoration._cycle_spin.cycle_spin

Local connectivity graph

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


File: /skimage/restoration/_cycle_spin.py#49
type: <class 'function'>
Commit: