darsia.DriftCorrection#

class DriftCorrection(base=None, config=None)[source]#

Bases: BaseCorrection

Class for drift correction of images wrt. a baseline image.

Set up the drift correction.

Parameters:
basenumpy.ndarray or darsia.Image

Baseline image.

configdict, optional

Configuration. Recognised keys:

roi (2-tuple of ranges | ndarray of points)
    area used for feature detection and alignment
padding (float)   relative padding factor
active (bool)     apply the correction (default True)

Methods

correct_array(img[, roi])

Main routine for aligning image with baseline image.

correct_metadata([metadata])

Correction routine on metadata level.

load(path)

Load the drift correction from a file.

return_config()

Return config file for the drift correction.

save(path)

Save the drift correction to a file.

Attributes

base

Base image array.

translation_estimator

Detection of effective translation based on feature detection.

correct_array(img, roi=None)[source]#

Main routine for aligning image with baseline image.

Parameters:
imgnp.ndarray

Input image, to be aligned.

roi2-tuple of slices, optional

ROI to be applied to img; if None the cached roi is used.

Returns:
np.ndarray

Aligned image array.

load(path)[source]#

Load the drift correction from a file.

return_config()[source]#

Return config file for the drift correction.

save(path)[source]#

Save the drift correction to a file.

base#

Base image array.

translation_estimator#

Detection of effective translation based on feature detection.