darsia.ResizeCorrection#

class ResizeCorrection(ref_image=None, shape=None, fx=None, fy=None, interpolation=None, dtype=None, key='', **kwargs)[source]#

Bases: BaseCorrection

Shape correction wrapping darsia.Resize to fit the BaseCorrection interface.

darsia.Resize.__call__’s overwrite=True path for Image inputs does not actually mutate the caller’s object — it only rebinds a local variable to a new Image, leaving the original stale. This wrapper reuses Resize’s array-level resize logic (resize_array) but routes Image/overwrite handling through BaseCorrection.__call__, which correctly mutates image.img in place.

Constructor matching darsia.Resize’s signature.

Parameters:
ref_imageImage, optional

Image whose shape is desired.

shapetuple of int, optional

Desired shape (in matrix indexing).

fxfloat, optional

Resize factor in x-dimension.

fyfloat, optional

Resize factor in y-dimension.

interpolationstr, optional

Interpolation method.

dtypenp.dtype or type, optional

Conversion dtype before resizing; nothing happens if None.

keystr

Prefix for kwargs-based configuration.

**kwargs

Additional configuration options.

Methods

correct_array(image)

Resize a raw numpy array.

correct_metadata([metadata])

Correction routine on metadata level.

load(path)

Load the resize correction from a file.

save(path)

Save the resize correction to a file.

correct_array(image)[source]#

Resize a raw numpy array.

Parameters:
imagenp.ndarray

Input image array.

Returns:
np.ndarray

Resized image array.

load(path)[source]#

Load the resize correction from a file.

Parameters:
pathPath

Path to load the parameters from.

save(path)[source]#

Save the resize correction to a file.

Parameters:
pathPath

Path to save the parameters to.