Restoration (darsia.restoration)#
Smoothness and shape altering restoration algorithms.
Submodules#
darsia.restoration.binaryinpaint module#
Module containing class with inpainting workflow for binary signals.
- class BinaryFillHoles(area_threshold=None, key='', **kwargs)[source]#
Bases:
objectWrapper for filing holes in binary images with skimage.
darsia.restoration.heterogeneous_tvd module#
darsia.restoration.median module#
Module wrapping median algoriths from skimage into the realm of DarSIA.
darsia.restoration.resize module#
Module containing wrappers to resize routines from skimage and cv2.
Access is given through objects. Also contains utility routine which equalizes voxel size lengths.
- class Resize(ref_image=None, shape=None, fx=None, fy=None, interpolation=None, dtype=None, key='', **kwargs)[source]#
Bases:
objectObject for resizing 2d arrays.
Example:
import darsia options = {
“example resize x”: 0.2, “example resize y”: 0.5, “example interpolation”: “inter_nearest”,
} resizer = darsia.Resize(key = “example “, **options) img_small = resizer(img_large)
- equalize_voxel_size(image, voxel_size=None, **kwargs)[source]#
Resize routine which keeps physical dimensions, but unifies the voxel length.
- Parameters:
image (darsia.Image) – image to be resized
voxel_size (float, optional) – side length, min of the voxel side of the image if None.
arguments (keyword) – interpolation (str): interpolation type used for resize
- Returns:
resized image
- Return type:
darsia.Image
- resize(image, ref_image=None, shape=None, fx=None, fy=None, interpolation=None, dtype=None)[source]#
Function wrapper to Resize object.
- Parameters:
image (darsia.Image) – image to be resized
ref_image (Image, optional) – reference image whose shape is desired
shape (tuple of int, optional) – desired shape (in matrix indexing)
fx (float, optional) – resize factor in x-dimension.
fy (float, optional) – resize factor in y-dimension.
interpolation (str, optional) – interpolation method, default: None, invoking the default option in cv2.resize.
dtype – conversion dtype before resizing; noting happens if None
darsia.restoration.tvd module#
Module wrapping TV denoising algoriths from skimage into the realm of DarSIA. These can be directly integrated in darsia.ConcentrationAnalysis, in particular as part of the definition of a restoration object.
- class TVD(key='', **kwargs)[source]#
Bases:
objectTotal variation denoising interface.
Connects to skimage.restoration.denoise_tv_* methods as well as to the DarSIA implementation of the split Bregman method (:mod:’split_bregman_tvd.py’).
- tvd(img, method='chambolle', weight=1.0, max_num_iter=200, eps=0.0002, **kwargs)[source]#
Inline application of TVD.
- Parameters:
img (np.ndarray or Image) – image
method (str) – TVD method
weight (float or np.ndarray) – weight
max_num_iter (int) – maximum number of iterations
eps (float) – tolerance
**kwargs – additional arguments - omega (array or float): data fidelity weight for heterogeneous bregman - regularization (float): regularization parameter for heterogeneous bregman
- Returns:
upscaled image (same type as input)
- Return type:
np.ndarray or Image