darsia.DiffeomorphicImageRegistration#

class DiffeomorphicImageRegistration(img_dst, **kwargs)[source]#

Bases: object

Class to detect the deformation between different images.

After all, DiffeomorphicImageRegistration is a wrapper using TranslationAnalysis.

Constructor for DiffeomorphicImageRegistration.

Parameters:
img_dstdarsia.Image

Reference image, held fixed in the analysis (the destination).

**kwargs

Registration parameters:

N_patches      list of two int -- patches in x and y
rel_overlap    float -- relative patch overlap per direction
max_features   int -- max features in the feature detection
tol            float -- tolerance
mask           ndarray -- ROI in which features are considered

Methods

add(diffeomorphic_image_registration)

Update the store translation by adding the translation of an external diffeomorphic image registration.

apply(img[, reverse])

Apply computed transformation onto arbitrary image.

call_with_output(img[, ...])

Determine the deformation pattern and apply diffeomorphism to the image aiming at matching the reference/destination (dst) image.

deduct(diffeomorphic_image_registration)

Effectviely copy from external DiffeomorphicImageRegistration.

displacement()

Return displacement in metric units on all pixels.

evaluate(coords[, reverse, units])

Evaluate diffeormorphism in arbitrary points.

plot([scaling, mask])

Plots diffeomorphism.

update_dst(img_dst)

Update of dst image.

add(diffeomorphic_image_registration)[source]#

Update the store translation by adding the translation of an external diffeomorphic image registration.

Parameters:
diffeomorphic_image_registrationdarsia.DiffeomorphicImageRegistration

Diffeomorphic image registraton object holding a translation analysis.

apply(img, reverse=False)[source]#

Apply computed transformation onto arbitrary image.

Parameters:
imgnp.ndarray or darsia.Image

Image.

reversebool

Flag whether the translation is understood as from the test image to the baseline image, or reversed. The default is the latter.

Returns:
np.ndarray, optional

Transformed image, if input is array; no output otherwise.

call_with_output(img, plot_patch_translation=False, return_patch_translation=False, mask=None)[source]#

Determine the deformation pattern and apply diffeomorphism to the image aiming at matching the reference/destination (dst) image.

This in the end only a wrapper for the translation analysis.

Parameters:
imgdarsia.Image

Test image.

plot_patch_translationbool

Flag controlling whether the displacement is also visualized as vector field.

return_patch_translationbool

Flag controlling whether the displacement in the patch centers is returned in the sense of img to dst, complying to the plot; default is False.

maskdarsia.Image, optional

Active mask.

deduct(diffeomorphic_image_registration)[source]#

Effectviely copy from external DiffeomorphicImageRegistration.

Parameters:
diffeomorphic_image_registrationdarsia.DiffeomorphicImageRegistration

Diffeomorphic image registration object holding a translation analysis.

displacement()[source]#

Return displacement in metric units on all pixels.

evaluate(coords, reverse=False, units='metric')[source]#

Evaluate diffeormorphism in arbitrary points.

Parameters:
coordsnp.ndarray, or darsia.Patches

Coordinate array with shape num_pts x 2, or alternatively num_rows_pts x num_cols_pts x 2, identifying points in a mesh/patched image, or equivalently patch.

reversebool

Flag whether the translation is understood as from the test image to the baseline image, or reversed. The default is the former latter.

unitsstr

Input and output units; “metric” default; otherwise assumed to be “pixel”.

Returns:
np.ndarray

Deformation vectors for all coordinates.

plot(scaling=1.0, mask=None)[source]#

Plots diffeomorphism.

Parameters:
scalingfloat

Scaling for vectors.

maskdarsia.Image, optional

Active set.

update_dst(img_dst)[source]#

Update of dst image.

Parameters:
img_dstnp.ndarray

Image array.