swectral.make_img_func#

swectral.make_img_func(func, name_suffix='img_only', *fixed_args, **fixed_kwargs)[source]#

Create a function from the given function that accepts image path only, fixing other parameters.

Parameters:
funccallable()

Original function with signature func(image_path, *args, **kwargs).

name_suffixstr, optional

The name suffix for the output function, default is "img_only".

``*fixed_args``

Positional arguments to fix.

``**fixed_kwargs``

Keyword arguments to fix.

Returns:
callable()

Modified function that accepts only image path.

Return type:

Callable

Examples

Suppose the original function is used as follows:

>>> processed_img_path = image_processing_function("/image1.tif", param1=1, param2=2)

A version that only requires image path is created as follows:

>>> func_accept_img_path = make_img_func(image_processing_function, param1=1, param2=2)

Usage of the modified function:

>>> processed_img_path = func_accept_img_path("/image1.tif")