Computation (sigima.proc)#

This package contains the Sigima computation functions that implement processing features for signal, image and scalar objects. These functions are designed to operate directly on sigima.objects.SignalObj, sigima.objects.ImageObj, sigima.objects.GeometryResult and sigima.objects.TableResult objects, which are defined in the sigima.objects package.

Even though these functions are primarily designed to be used in the Sigima pipeline, they can also be used independently.

See also

See the sigima.tools package for some algorithms that operate directly on NumPy arrays.

Each computation module defines a set of computation objects, that is, functions that implement processing features and classes that implement the corresponding parameters (in the form of guidata.dataset.datatypes.Dataset subclasses). The computation functions takes a signal or image object (e.g. sigima.objects.SignalObj) and a parameter object (e.g. sigima.params.MovingAverageParam) as input and return a signal or image object as output (the result of the computation). The parameter object is used to configure the computation function (e.g. the size of the moving average window).

In Sigima overall architecture, the purpose of this package is to provide the computation functions that are used by DataLab processor modules, based on the algorithms defined in the sigima.tools module and on the data model defined in the sigima.objects module.

The computation modules are organized in subpackages according to their purpose. The following subpackages are available:

Common processing features#

sigima.proc.base.dst_1_to_1(src: Obj, name: str, suffix: str | None = None) Obj[source]#

Create a result object, for processing functions that take a single signal or image object as input and return a single signal or image object (1-to-1).

Note

Data of the result object is copied from the source object (src). This initial data is usually replaced by the processing function, but it may also be used to initialize the result object as part of the processing function.

Parameters:
  • src – source signal or image object

  • name – name of the function. The title format depends on the configured title formatter (SimpleTitleFormatter creates readable titles, PlaceholderTitleFormatter creates DataLab-compatible placeholder titles).

  • suffix – suffix to add to the title. Optional.

Returns:

Result signal or image object

sigima.proc.base.dst_2_to_1(src1: Obj, src2: Obj, name: str, suffix: str | None = None) Obj[source]#

Create a result object, for processing functions that take two signal or image objects as input and return a single signal or image object (2-to-1).

Note

Data of the result object is copied from the first source object (src1). This initial data is usually replaced by the processing function, but it may also be used to initialize the result object as part of the processing function.

Parameters:
  • src1 – input signal or image object

  • src2 – input signal or image object

  • name – name of the processing function. The title format depends on the configured title formatter (SimpleTitleFormatter creates readable titles, PlaceholderTitleFormatter creates DataLab-compatible placeholder titles).

  • suffix – suffix to add to the title

Returns:

Output signal or image object

sigima.proc.base.dst_n_to_1(src_list: list[Obj], name: str, suffix: str | None = None) Obj[source]#

Create a result object, for processing functions that take a list of signal or image objects as input and return a single signal or image object (n-to-1).

Note

Data of the result object is copied from the first source object (src_list[0]). This initial data is usually replaced by the processing function, but it may also be used to initialize the result object as part of the processing function.

Parameters:
  • src_list – list of input signal or image objects

  • name – name of the processing function. The title format depends on the configured title formatter (SimpleTitleFormatter creates readable titles, PlaceholderTitleFormatter creates DataLab-compatible placeholder titles).

  • suffix – suffix to add to the title

Returns:

Result signal or image object

sigima.proc.base.new_signal_result(src: SignalObj | ImageObj, name: str, suffix: str | None = None, units: tuple[str, str] | None = None, labels: tuple[str, str] | None = None) SignalObj[source]#

Create new signal object as a result of a compute_1_to_1 function

As opposed to the dst_1_to_1 functions, this function creates a new signal object without copying the original object metadata, except for the “source” entry.

Parameters:
  • src – input signal or image object

  • name – name of the processing function. The title format depends on the configured title formatter (SimpleTitleFormatter creates readable titles, PlaceholderTitleFormatter creates DataLab-compatible placeholder titles).

  • suffix – suffix to add to the title

  • units – units of the output signal

  • labels – labels of the output signal

Returns:

Output signal object

Signal processing features#

Basic signal processing#

Base signal processing functions and utilities#

sigima.proc.signal.base.restore_data_outside_roi(dst: SignalObj, src: SignalObj) None[source]

Restore data outside the Region Of Interest (ROI) of the input signal after a computation, only if the input signal has a ROI, and if the output signal has the same ROI as the input signal, and if the data types are the same, and if the shapes are the same. Otherwise, do nothing.

Parameters:
  • dst – destination signal object

  • src – source signal object

sigima.proc.signal.base.is_uncertainty_data_available(signals: SignalObj | list[SignalObj]) bool[source]

Check if all signals have uncertainty data.

This functions is used to determine whether enough information is available to propagate uncertainty.

Parameters:

signals – Signal object or list of signal objects.

Returns:

True if all signals have uncertainty data, False otherwise.

class sigima.proc.signal.base.Wrap1to1Func(func: Callable, *args: Any, **kwargs: Any)[source]

Wrap a 1 array → 1 array function (the simple case of y1 = f(y0)) to produce a 1 signal → 1 signal function, which can be used as a Sigima computation function and inside DataLab’s infrastructure to perform computations with the Signal Processor object.

This wrapping mechanism using a class is necessary for the resulted function to be pickable by the multiprocessing module.

The instance of this wrapper is callable and returns a sigima.objects.SignalObj object.

Example

>>> import numpy as np
>>> from sigima.proc.signal import Wrap1to1Func
>>> import sigima.objects
>>> def square(y):
...     return y**2
>>> compute_square = Wrap1to1Func(square)
>>> x = np.linspace(0, 10, 100)
>>> y = np.sin(x)
>>> sig0 = sigima.objects.create_signal("Example", x, y)
>>> sig1 = compute_square(sig0)
Parameters:
  • func – 1 array → 1 array function

  • *args – Additional positional arguments to pass to the function

  • **kwargs – Additional keyword arguments to pass to the function

Note

If func_name is provided in the keyword arguments, it will be used as the function name instead of the default name derived from the function itself.

Note

This wrapper is suitable for functions that don’t require custom uncertainty propagation. For mathematical functions with specific uncertainty formulas (sqrt, log10, exp, etc.), implement uncertainty propagation directly in the computation function.

sigima.proc.signal.base.compute_geometry_from_obj(title: str, shape: str | KindShape, obj: SignalObj, func: Callable, *args: Any) GeometryResult | None[source]

Calculate result geometry by executing a computation function on a signal object.

Parameters:
  • title – Result title

  • shape – Result shape kind (e.g., “segment”, “point”, KindShape.MARKER)

  • obj – Input signal object

  • func – Computation function that takes (x, y, *args) and returns coordinates

  • *args – Additional computation function arguments

Returns:

Result geometry object or None if no result is found

Note

The computation function must take x and y arrays as the first two arguments, followed by any additional arguments, and return a NumPy array containing coordinate pairs in the form [[x0, y0], [x1, y1], ...].

Arithmetic#

Arithmetic operations on signals#

sigima.proc.signal.arithmetic.addition(src_list: list[SignalObj]) SignalObj[source]

Compute the element-wise sum of multiple signals.

The first signal in the list defines the “base” signal. All other signals are added element-wise to the base signal.

Note

If all signals share the same region of interest (ROI), the sum is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the sum of the source signals.

sigima.proc.signal.arithmetic.average(src_list: list[SignalObj]) SignalObj[source]

Compute the element-wise average of multiple signals.

The first signal in the list defines the “base” signal. All other signals are averaged element-wise with the base signal.

Note

If all signals share the same region of interest (ROI), the average is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the average of the source signals.

sigima.proc.signal.arithmetic.standard_deviation(src_list: list[SignalObj]) SignalObj[source]

Compute the element-wise standard deviation of multiple signals.

The first signal in the list defines the “base” signal. All other signals are used to compute the element-wise standard deviation with the base signal.

Note

If all signals share the same region of interest (ROI), the standard deviation is computed only within the ROI.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the standard deviation of the source signals.

sigima.proc.signal.arithmetic.product(src_list: list[SignalObj]) SignalObj[source]

Compute the element-wise product of multiple signals.

The first signal in the list defines the “base” signal. All other signals are multiplied element-wise with the base signal.

Note

If all signals share the same region of interest (ROI), the product is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the product of the source signals.

sigima.proc.signal.arithmetic.addition_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]

Compute the sum of a signal and a constant value.

The function adds a constant value to each element of the input signal.

Note

If the signal has a region of interest (ROI), the addition is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the sum of the input signal and the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.arithmetic.difference_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]

Compute the difference between a signal and a constant value.

The function subtracts a constant value from each element of the input signal.

Note

If the signal has a region of interest (ROI), the subtraction is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the difference between the input signal and the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.arithmetic.product_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]

Compute the product of a signal and a constant value.

The function multiplies each element of the input signal by a constant value.

Note

If the signal has a region of interest (ROI), the multiplication is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the product of the input signal and the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.arithmetic.division_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]

Compute the division of a signal by a constant value.

The function divides each element of the input signal by a constant value.

Note

If the signal has a region of interest (ROI), the division is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the division of the input signal by the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.arithmetic.arithmetic(src1: SignalObj, src2: SignalObj, p: ArithmeticParam = None, *, operator: Literal['ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE'] = 'ADD', factor: float = 1.0, constant: float = 0.0, operation: str = '', restore_dtype: bool = True) SignalObj[source]

Perform an arithmetic operation on two signals.

The function applies the specified arithmetic operation to each element of the input signals.

Note

The operation is performed only within the region of interest of src1.

Note

Uncertainties are propagated.

Warning

It is assumed that both signals have the same size and x-coordinates.

Args:

src1: First input signal. src2: Second input signal. p: Arithmetic operation parameters.

Returns:

Result signal object representing the arithmetic operation on the input signals.

Note

This computation function can be called in two ways:

  1. With a parameter ArithmeticParam object:

    param = ArithmeticParam.create(operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.arithmetic.difference(src1: SignalObj, src2: SignalObj) SignalObj[source]

Compute the element-wise difference between two signals.

The function subtracts each element of the second signal from the corresponding element of the first signal.

Note

If both signals share the same region of interest (ROI), the difference is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that both signals have the same size and x-coordinates.

Parameters:
  • src1 – First input signal.

  • src2 – Second input signal.

Returns:

Result signal object representing the difference between the input signals.

sigima.proc.signal.arithmetic.quadratic_difference(src1: SignalObj, src2: SignalObj) SignalObj[source]

Compute the normalized difference between two signals.

The function computes the element-wise difference between the two signals and divides the result by sqrt(2.0).

Note

If both signals share the same region of interest (ROI), the operation is performed only within the ROI.

Note

Uncertainties are propagated. For two input signals with identical standard deviations, the standard deviation of the output signal equals the standard deviation of each of the input signals.

Warning

It is assumed that both signals have the same size and x-coordinates.

Parameters:
  • src1 – First input signal.

  • src2 – Second input signal.

Returns:

Result signal object representing the quadratic difference between the input signals.

sigima.proc.signal.arithmetic.division(src1: SignalObj, src2: SignalObj) SignalObj[source]

Compute the element-wise division between two signals.

The function divides each element of the first signal by the corresponding element of the second signal.

Note

If both signals share the same region of interest (ROI), the division is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that both signals have the same size and x-coordinates.

Parameters:
  • src1 – First input signal.

  • src2 – Second input signal.

Returns:

Result signal object representing the division of the input signals.

sigima.proc.signal.arithmetic.signals_to_image(src_list: list[SignalObj], p: SignalsToImageParam) ImageObj[source]

Combine multiple signals into an image.

The function takes a list of signals and combines them into a 2D image, arranging them either as rows or columns based on the specified orientation. Optionally, each signal can be normalized before combining.

Note

All signals must have the same size (number of data points).

Note

If normalization is enabled, each signal is normalized independently using the specified normalization method before being added to the image.

Parameters:
  • src_list – List of source signals to combine.

  • p – Parameters specifying orientation and normalization options.

Returns:

Image object representing the combined signals.

Raises:

ValueError – If the signal list is empty or signals have different sizes.

Mathematical Operations#

Mathematical operations on signals#

sigima.proc.signal.mathops.transpose(src: SignalObj) SignalObj[source]

Transpose signal (swap X and Y axes).

Parameters:

src – Source signal.

Returns:

Result signal object.

sigima.proc.signal.mathops.inverse(src: SignalObj) SignalObj[source]

Compute the element-wise inverse of a signal.

The function computes the reciprocal (1/y) of each element of the input signal.

Note

If the signal has a region of interest (ROI), the inverse is performed only within the ROI.

Note

Uncertainties are propagated.

Parameters:

src – Input signal object.

Returns:

Result signal object representing the inverse of the input signal.

sigima.proc.signal.mathops.absolute(src: SignalObj) SignalObj[source]

Compute absolute value with numpy.absolute

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.mathops.real(src: SignalObj) SignalObj[source]

Compute real part with numpy.real()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.mathops.imag(src: SignalObj) SignalObj[source]

Compute imaginary part with numpy.imag()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.mathops.phase(src: SignalObj, p: PhaseParam = None, *, unwrap: bool = True, unit: Literal['RADIAN', 'DEGREE'] = 'DEGREE') SignalObj[source]

Compute the phase (argument) of a complex signal.

The function uses numpy.angle() to compute the argument and numpy.unwrap() to unwrap it.

Args:

src: Input signal object. p: Phase parameters.

Returns:

Signal object containing the phase, optionally unwrapped.

Note

This computation function can be called in two ways:

  1. With a parameter PhaseParam object:

    param = PhaseParam.create(unwrap=..., unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unwrap=..., unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.mathops.complex_from_real_imag(src1: SignalObj, src2: SignalObj) SignalObj[source]

Combine two real signals into a complex signal using real + i * imag.

Warning

The x coordinates of the two signals must be the same.

Parameters:
  • src1 – Real part signal.

  • src2 – Imaginary part signal.

Returns:

Result signal object with complex-valued y.

sigima.proc.signal.mathops.complex_from_magnitude_phase(src1: SignalObj, src2: SignalObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') SignalObj[source]

Combine magnitude and phase signals into a complex signal.

Warning

The x coordinates of the two signals must be the same.

Warning

Negative values are not allowed for the radius and will be clipped to 0.

Args:

src1: Magnitude (module) signal. src2: Phase (argument) signal. p: Parameters (must provide unit for the phase).

Returns:

Result signal object with complex-valued y.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

class sigima.proc.signal.mathops.DataTypeSParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Convert signal data type parameters

sigima.proc.signal.mathops.astype(src: SignalObj, p: DataTypeSParam = None, *, dtype_str: Literal['float32', 'float64', 'complex128'] = 'float32') SignalObj[source]

Convert data type with numpy.astype()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter DataTypeSParam object:

    param = DataTypeSParam.create(dtype_str=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, dtype_str=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.mathops.log10(src: SignalObj) SignalObj[source]

Compute Log10 with numpy.log10

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.mathops.exp(src: SignalObj) SignalObj[source]

Compute exponential with numpy.exp

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.mathops.sqrt(src: SignalObj) SignalObj[source]

Compute square root with numpy.sqrt

Parameters:

src – source signal

Returns:

Result signal object

class sigima.proc.signal.mathops.PowerParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Power parameters

sigima.proc.signal.mathops.power(src: SignalObj, p: PowerParam = None, *, power: float = 2.0) SignalObj[source]

Compute power with numpy.power

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter PowerParam object:

    param = PowerParam.create(power=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, power=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.mathops.to_polar(src: SignalObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') SignalObj[source]

Convert Cartesian coordinates to polar coordinates.

This function converts the x and y coordinates of a signal to polar coordinates using sigima.tools.coordinates.to_polar().

Warning

X and y must share the same units for the computation to make sense.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Raises:

ValueError: If the x and y units are not the same.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.mathops.to_cartesian(src: SignalObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') SignalObj[source]

Convert polar coordinates to Cartesian coordinates.

This function converts the r and theta coordinates of a signal to Cartesian coordinates using sigima.tools.coordinates.to_cartesian().

Note

It is assumed that the x-axis represents the radius and the y-axis the angle.

Warning

Negative values are not allowed for the radius and will be clipped to 0.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

Extraction#

Signal extraction and ROI operations#

sigima.proc.signal.extraction.extract_rois(src: SignalObj, params: list[ROI1DParam]) SignalObj[source]

Extract multiple regions of interest from data

Parameters:
  • src – source signal

  • params – list of ROI parameters

Returns:

Signal with multiple regions of interest

sigima.proc.signal.extraction.extract_roi(src: SignalObj, p: ROI1DParam = None, *, title: str = '', xmin: float = 0.0, xmax: float = 1.0) SignalObj[source]

Extract single region of interest from data

Args:

src: source signal p: ROI parameters

Returns:

Signal with single region of interest

Note

This computation function can be called in two ways:

  1. With a parameter ROI1DParam object:

    param = ROI1DParam.create(title=..., xmin=..., xmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., xmin=..., xmax=...)
    

Both styles are fully supported and equivalent.

Filtering#

Filtering processing functions for signal objects#

This module provides filtering operations for signal objects:

  • Gaussian filter

  • Moving average and median filters

  • Wiener filter

  • Frequency filters (low-pass, high-pass, band-pass, band-stop)

  • Noise addition functions

Note

Uses zero-phase filtering when possible for better phase response.

sigima.proc.signal.filtering.gaussian_filter(src: SignalObj, p: GaussianParam = None, *, sigma: float = 1.0) SignalObj[source]

Compute gaussian filter with scipy.ndimage.gaussian_filter()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter GaussianParam object:

    param = GaussianParam.create(sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.moving_average(src: SignalObj, p: MovingAverageParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'REFLECT') SignalObj[source]

Compute moving average with scipy.ndimage.uniform_filter()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter MovingAverageParam object:

    param = MovingAverageParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.moving_median(src: SignalObj, p: MovingMedianParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'NEAREST') SignalObj[source]

Compute moving median with scipy.ndimage.median_filter()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter MovingMedianParam object:

    param = MovingMedianParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.wiener(src: SignalObj) SignalObj[source]

Compute Wiener filter with scipy.signal.wiener()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.filtering.get_nyquist_frequency(obj: SignalObj) float[source]

Return the Nyquist frequency of a signal object

Parameters:

obj – signal object

Returns:

Nyquist frequency

class sigima.proc.signal.filtering.BaseHighLowBandParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Base class for high-pass, low-pass, band-pass and band-stop filters

get_filter_func() Callable[source]

Get the scipy filter function corresponding to the method.

update_from_obj(obj: SignalObj) None[source]

Update the filter parameters from a signal object

Parameters:

obj – signal object

get_filter_params(obj: SignalObj) tuple[float | str, float | str][source]

Return the filter parameters (a and b) as a tuple. These parameters are used in the scipy.signal filter functions (eg. scipy.signal.filtfilt).

Parameters:

obj – signal object

Returns:

filter parameters

Return type:

tuple

class sigima.proc.signal.filtering.LowPassFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Low-pass filter parameters

class sigima.proc.signal.filtering.HighPassFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

High-pass filter parameters

class sigima.proc.signal.filtering.BandPassFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Band-pass filter parameters

class sigima.proc.signal.filtering.BandStopFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Band-stop filter parameters

sigima.proc.signal.filtering.frequency_filter(src: SignalObj, p: BaseHighLowBandParam) SignalObj[source]

Compute frequency filter (low-pass, high-pass, band-pass, band-stop), with scipy.signal.filtfilt()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

Note

Uses zero-phase filtering (filtfilt) when possible for better phase response. If numerical instability occurs (e.g., singular matrix errors), automatically falls back to forward filtering (lfilter) with a warning. This ensures cross-platform compatibility while maintaining optimal filtering when possible.

sigima.proc.signal.filtering.lowpass(src: SignalObj, p: LowPassFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]

Compute low-pass filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter LowPassFilterParam object:

    param = LowPassFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.highpass(src: SignalObj, p: HighPassFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]

Compute high-pass filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter HighPassFilterParam object:

    param = HighPassFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.bandpass(src: SignalObj, p: BandPassFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]

Compute band-pass filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter BandPassFilterParam object:

    param = BandPassFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.bandstop(src: SignalObj, p: BandStopFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]

Compute band-stop filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter BandStopFilterParam object:

    param = BandStopFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.add_gaussian_noise(src: SignalObj, p: NormalDistributionParam = None, *, seed: int = 1, mu: float = 0.1, sigma: float = 0.02) SignalObj[source]

Add normal noise to the input signal.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter NormalDistributionParam object:

    param = NormalDistributionParam.create(seed=..., mu=..., sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., mu=..., sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.add_poisson_noise(src: SignalObj, p: PoissonDistributionParam = None, *, seed: int = 1, lam: float = 0.1) SignalObj[source]

Add Poisson noise to the input signal.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter PoissonDistributionParam object:

    param = PoissonDistributionParam.create(seed=..., lam=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., lam=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.filtering.add_uniform_noise(src: SignalObj, p: UniformDistributionParam = None, *, seed: int = 1, vmin: float = -0.5, vmax: float = 0.5) SignalObj[source]

Add uniform noise to the input signal.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter UniformDistributionParam object:

    param = UniformDistributionParam.create(seed=..., vmin=..., vmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., vmin=..., vmax=...)
    

Both styles are fully supported and equivalent.

Processing#

Signal processing operations#

This module provides signal processing operations:

  • Zero padding

  • Interpolation and resampling

  • Convolution and deconvolution

  • Signal manipulation functions

Note

Most operations use functions from sigima.tools.signal for actual computations.

class sigima.proc.signal.processing.InterpolationParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Interpolation parameters

sigima.proc.signal.processing.interpolate(src1: SignalObj, src2: SignalObj, p: InterpolationParam = None, *, method: Literal[Interpolation1DMethod.LINEAR, Interpolation1DMethod.SPLINE, Interpolation1DMethod.QUADRATIC, Interpolation1DMethod.CUBIC, Interpolation1DMethod.BARYCENTRIC, Interpolation1DMethod.PCHIP] = 'linear', fill_value: float = None) SignalObj[source]

Interpolate data with sigima.tools.signal.interpolation.interpolate().

Args:

src1: Source signal to interpolate. src2: Signal with new x-axis. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter InterpolationParam object:

    param = InterpolationParam.create(method=..., fill_value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., fill_value=...)
    

Both styles are fully supported and equivalent.

class sigima.proc.signal.processing.Resampling1DParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Resample parameters for 1D signals

update_from_obj(obj: SignalObj) None[source]

Update parameters from a signal object.

sigima.proc.signal.processing.resampling(src: SignalObj, p: Resampling1DParam = None, *, method: Literal[Interpolation1DMethod.LINEAR, Interpolation1DMethod.SPLINE, Interpolation1DMethod.QUADRATIC, Interpolation1DMethod.CUBIC, Interpolation1DMethod.BARYCENTRIC, Interpolation1DMethod.PCHIP] = 'linear', fill_value: float = None, xmin: float = None, xmax: float = None, mode: Literal['dx', 'nbpts'] = 'nbpts', dx: float = None, nbpts: int = None) SignalObj[source]

Resample data with sigima.tools.signal.interpolation.interpolate()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter Resampling1DParam object:

    param = Resampling1DParam.create(method=..., fill_value=..., xmin=..., xmax=..., mode=..., dx=..., nbpts=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., fill_value=..., xmin=..., xmax=..., mode=..., dx=..., nbpts=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.processing.check_same_sample_rate(src1: SignalObj, src2: SignalObj) None[source]

Check if two signals have a constant step size and the same sample rate.

Parameters:
  • src1 – First signal.

  • src2 – Second signal.

Raises:

ValueError – If the signals do not have a constant step size or the same sample rate.

sigima.proc.signal.processing.deconvolution(src1: SignalObj, src2: SignalObj) SignalObj[source]

Compute deconvolution.

The function computes the deconvolution of a signal using sigima_.algorithms.signal.fourier.deconvolve().

Parameters:
  • src1 – Source signal.

  • src2 – Filter signal.

Returns:

Result signal.

Notes

The kernel normalization behavior can be configured globally using sigima.config.options.auto_normalize_kernel.

sigima.proc.signal.processing.normalize(src: SignalObj, p: NormalizeParam = None, *, method: Literal['MAXIMUM', 'AMPLITUDE', 'AREA', 'ENERGY', 'RMS'] = 'MAXIMUM') SignalObj[source]

Normalize data with sigima.tools.signal.level.normalize()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter NormalizeParam object:

    param = NormalizeParam.create(method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.processing.derivative(src: SignalObj) SignalObj[source]

Compute derivative with numpy.gradient()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.processing.integral(src: SignalObj) SignalObj[source]

Compute integral with scipy.integrate.cumulative_trapezoid()

Parameters:

src – source signal

Returns:

Result signal object

class sigima.proc.signal.processing.XYCalibrateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Signal calibration parameters

sigima.proc.signal.processing.calibration(src: SignalObj, p: XYCalibrateParam = None, *, axis: Literal['x', 'y'] = 'y', a: float = 1.0, b: float = 0.0) SignalObj[source]

Compute linear calibration

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter XYCalibrateParam object:

    param = XYCalibrateParam.create(axis=..., a=..., b=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, axis=..., a=..., b=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.processing.clip(src: SignalObj, p: ClipParam = None, *, lower: float = None, upper: float = None) SignalObj[source]

Compute maximum data clipping with numpy.clip()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter ClipParam object:

    param = ClipParam.create(lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, lower=..., upper=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.processing.offset_correction(src: SignalObj, p: ROI1DParam = None, *, title: str = '', xmin: float = 0.0, xmax: float = 1.0) SignalObj[source]
Correct offset: subtract the mean value of the signal in the specified range

(baseline correction)

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter ROI1DParam object:

    param = ROI1DParam.create(title=..., xmin=..., xmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., xmin=..., xmax=...)
    

Both styles are fully supported and equivalent.

class sigima.proc.signal.processing.DetrendingParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Detrending parameters

sigima.proc.signal.processing.detrending(src: SignalObj, p: DetrendingParam = None, *, method: Literal['linear', 'constant'] = 'linear') SignalObj[source]

Detrend data with scipy.signal.detrend()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter DetrendingParam object:

    param = DetrendingParam.create(method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=...)
    

Both styles are fully supported and equivalent.

class sigima.proc.signal.processing.WindowingParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Windowing parameters.

sigima.proc.signal.processing.apply_window(src: SignalObj, p: WindowingParam = None, *, method: Literal['BARTHANN', 'BARTLETT', 'BLACKMAN', 'BLACKMAN_HARRIS', 'BOHMAN', 'BOXCAR', 'COSINE', 'EXPONENTIAL', 'FLAT_TOP', 'GAUSSIAN', 'HAMMING', 'HANN', 'KAISER', 'LANCZOS', 'NUTTALL', 'PARZEN', 'TAYLOR', 'TUKEY'] = 'HAMMING', alpha: float = 0.5, beta: float = 14.0, sigma: float = 0.5) SignalObj[source]

Compute windowing with sigima.tools.signal.windowing.apply_window().

Args:

src: Source signal. p: Parameters for windowing.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter WindowingParam object:

    param = WindowingParam.create(method=..., alpha=..., beta=..., sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., alpha=..., beta=..., sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.processing.reverse_x(src: SignalObj) SignalObj[source]

Reverse x-axis

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.processing.convolution(src1: SignalObj, src2: SignalObj) SignalObj[source]

Compute convolution of two signals with scipy.signal.convolve().

Parameters:
  • src1 – Source signal 1.

  • src2 – Source signal 2.

Returns:

Result signal.

Notes

The behavior of kernel normalization is controlled by the global configuration option sigima.config.options.auto_normalize_kernel.

sigima.proc.signal.processing.xy_mode(src1: SignalObj, src2: SignalObj) SignalObj[source]

Simulate the X-Y mode of an oscilloscope.

Use the first signal as the X-axis and the second signal as the Y-axis.

Parameters:
  • src1 – First input signal (X-axis).

  • src2 – Second input signal (Y-axis).

Returns:

A signal object representing the X-Y mode.

sigima.proc.signal.processing.replace_x_by_other_y(src1: SignalObj, src2: SignalObj) SignalObj[source]

Create a new signal using Y from src1 and Y from src2 as X coordinates.

This is useful for calibration scenarios where one signal contains calibration data (e.g., wavelengths) in its Y values, and you want to plot another signal’s Y values against these calibration points.

The two signals must have the same number of points.

Parameters:
  • src1 – First signal (provides Y data for output).

  • src2 – Second signal (provides Y data to be used as X coordinates for output).

Returns:

A new signal with X from src2.y and Y from src1.y.

Raises:

ValueError – If signals don’t have the same number of points.

Fourier#

Fourier transform and frequency domain operations#

This module provides Fourier transform and frequency domain operations:

  • FFT and inverse FFT

  • Magnitude and phase spectrum

  • Power spectral density (PSD)

Note

Most operations use functions from sigima.tools.signal.fourier for actual computations.

class sigima.proc.signal.fourier.ZeroPadding1DParam(*args, **kwargs)[source]

Zero-padding parameters for signals.

This class manages parameters for applying zero-padding to signals, commonly used to improve FFT resolution or prepare signals for convolution.

Important

For strategies other than “custom”, the number of points to add (n) is automatically calculated based on the signal size. However, this calculation requires knowledge of the signal, so you must call update_from_obj() before using the parameters.

Example usage:

import sigima.params
import sigima.proc.signal as sips

# Create the parameter object
param = sigima.params.ZeroPadding1DParam.create(strategy="next_pow2")

# IMPORTANT: Update parameters from the signal to compute 'n'
param.update_from_obj(signal)

# Now the parameters are ready to use
result = sips.zero_padding(signal, param)

Attributes:

  • strategies: Available strategies (“next_pow2”, “double”, “triple”, “custom”).

  • strategy: Choice item for selecting the zero-padding strategy.

    • "next_pow2": Pad to the next power of 2 (optimal for FFT)

    • "double": Double the signal length

    • "triple": Triple the signal length

    • "custom": Use a user-specified number of points

  • location: Where to add the padding (“append”, “prepend”, or “both”).

  • n: Number of points to add as padding. For “custom” strategy, this is user-specified. For other strategies, it is computed automatically by update_from_obj().

update_from_obj(obj: SignalObj) None[source]

Update parameters based on a signal object.

This method computes the number of padding points (n) based on the selected strategy and the actual signal size. This must be called before using the parameters for strategies other than “custom”.

Parameters:

obj – Signal object from which to compute the padding parameters.

static next_power_of_two(size: int) int[source]

Compute the next power of two greater than or equal to the given size.

Parameters:

size – The input integer.

Returns:

The smallest power of two greater than or equal to ‘size’.

strategy_callback(_, value)[source]

Callback for strategy choice item.

Parameters:
  • _ – Unused argument (in this context).

  • value – The selected strategy value.

sigima.proc.signal.fourier.zero_padding(src: SignalObj, p: ZeroPadding1DParam = None, *, strategy: Literal['next_pow2', 'double', 'triple', 'custom'] = 'next_pow2', location: Literal['APPEND', 'PREPEND', 'BOTH'] = 'APPEND', n: int = 1) SignalObj[source]

Compute zero padding with sigima.tools.signal.fourier.zero_padding().

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter ZeroPadding1DParam object:

    param = ZeroPadding1DParam.create(strategy=..., location=..., n=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, strategy=..., location=..., n=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.fourier.fft(src: SignalObj, p: FFTParam | None = None) SignalObj[source]

Compute FFT with sigima.tools.signal.fourier.fft1d().

Parameters:
  • src – Source signal.

  • p – Parameters.

Returns:

Result signal object.

sigima.proc.signal.fourier.ifft(src: SignalObj) SignalObj[source]

Compute the inverse FFT with sigima.tools.signal.fourier.ifft1d().

Parameters:

src – Source signal.

Returns:

Result signal object.

sigima.proc.signal.fourier.magnitude_spectrum(src: SignalObj, p: SpectrumParam | None = None) SignalObj[source]

Compute magnitude spectrum.

This function computes the magnitude spectrum of a signal using sigima.tools.signal.fourier.magnitude_spectrum().

Parameters:
  • src – Source signal.

  • p – Parameters.

Returns:

Result signal object.

sigima.proc.signal.fourier.phase_spectrum(src: SignalObj) SignalObj[source]

Compute phase spectrum.

This function computes the phase spectrum of a signal using sigima.tools.signal.fourier.phase_spectrum()

Parameters:

src – Source signal.

Returns:

Result signal object.

sigima.proc.signal.fourier.psd(src: SignalObj, p: SpectrumParam | None = None) SignalObj[source]

Compute power spectral density with sigima.tools.signal.fourier.psd().

Parameters:
  • src – Source signal.

  • p – Parameters.

Returns:

Result signal object.

Fitting#

Curve fitting operations#

This module provides curve fitting operations for signal objects:

  • Linear and polynomial fits

  • Gaussian, Lorentzian, and Voigt fits

  • Exponential and CDF fits

Note

Most operations use functions from sigima.tools.signal.fitting for actual computations.

sigima.proc.signal.fitting.linear_fit(src: SignalObj) SignalObj[source]

Compute linear fit with numpy.polyfit()

Parameters:

src – source signal

Returns:

Result signal object

class sigima.proc.signal.fitting.PolynomialFitParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Polynomial fitting parameters

sigima.proc.signal.fitting.polynomial_fit(src: SignalObj, p: PolynomialFitParam = None, *, degree: int = 3) SignalObj[source]

Compute polynomial fit with numpy.polyfit()

Args:

src: source signal p: polynomial fitting parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter PolynomialFitParam object:

    param = PolynomialFitParam.create(degree=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, degree=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.fitting.gaussian_fit(src: SignalObj) SignalObj[source]

Compute Gaussian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.lorentzian_fit(src: SignalObj) SignalObj[source]

Compute Lorentzian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.voigt_fit(src: SignalObj) SignalObj[source]

Compute Voigt fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.exponential_fit(src: SignalObj) SignalObj[source]

Compute exponential fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.cdf_fit(src: SignalObj) SignalObj[source]

Compute CDF fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.planckian_fit(src: SignalObj) SignalObj[source]

Compute Planckian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.twohalfgaussian_fit(src: SignalObj) SignalObj[source]

Compute two-half-Gaussian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.sigmoid_fit(src: SignalObj) SignalObj[source]

Compute sigmoid fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.piecewiseexponential_fit(src: SignalObj) SignalObj[source]

Compute piecewise exponential fit (raise-decay) with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.sinusoidal_fit(src: SignalObj) SignalObj[source]

Compute sinusoidal fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.fitting.extract_fit_params(signal: SignalObj) dict[str, float | str][source]

Extract fit parameters from a fitted signal.

Parameters:

signal – Signal object containing fit metadata

Returns:

Fit parameters

sigima.proc.signal.fitting.evaluate_fit(src1: SignalObj, src2: SignalObj) SignalObj[source]

Evaluate fit function from src1 on the x-axis of src2.

This function extracts fit parameters from src1 (which must contain fit metadata from a previous fitting operation) and evaluates the fit function on the x-axis of src2.

Parameters:
  • src1 – Signal object containing fit parameters in metadata (from a fit operation)

  • src2 – Signal object whose x-axis will be used for evaluation

Returns:

New signal with the fit evaluated on src2’s x-axis

Features#

Feature extraction and analysis functions#

This module provides feature extraction and analysis functions for signal objects:

  • Peak detection

  • Full Width at Half Maximum (FWHM) and related measurements

  • Statistical analysis

  • Bandwidth calculations

  • Dynamic parameters (ENOB, SNR, SINAD, THD, SFDR)

Note

Most operations use functions from sigima.tools.signal for actual computations.

class sigima.proc.signal.features.PeakDetectionParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Peak detection parameters

sigima.proc.signal.features.peak_detection(src: SignalObj, p: PeakDetectionParam = None, *, threshold: float = 0.1, min_dist: int = 1) SignalObj[source]
Peak detection with

sigima.tools.signal.peakdetection.peak_indices()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter PeakDetectionParam object:

    param = PeakDetectionParam.create(threshold=..., min_dist=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, threshold=..., min_dist=...)
    

Both styles are fully supported and equivalent.

class sigima.proc.signal.features.FWHMParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

FWHM parameters

sigima.proc.signal.features.fwhm(obj: SignalObj, param: FWHMParam = None, *, method: Literal['zero-crossing', 'gauss', 'lorentz', 'voigt'] = 'zero-crossing', xmin: float = None, xmax: float = None) GeometryResult | None[source]

Compute FWHM with sigima.tools.signal.pulse.fwhm()

Args:

obj: source signal param: parameters

Returns:

Segment coordinates

Note

This computation function can be called in two ways:

  1. With a parameter FWHMParam object:

    param = FWHMParam.create(method=..., xmin=..., xmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., xmin=..., xmax=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.features.fw1e2(obj: SignalObj) GeometryResult | None[source]

Compute FW at 1/e² with sigima.tools.signal.pulse.fw1e2()

Parameters:

obj – source signal

Returns:

Segment coordinates

class sigima.proc.signal.features.OrdinateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Ordinate parameter.

sigima.proc.signal.features.full_width_at_y(obj: SignalObj, p: OrdinateParam = None, *, y: float = 0.0) GeometryResult | None[source]

Compute full width at a given y value for a signal object.

Args:

obj: The signal object containing x and y data. p: The ordinate parameter dataset

Returns:

Segment coordinates

Note

This computation function can be called in two ways:

  1. With a parameter OrdinateParam object:

    param = OrdinateParam.create(y=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, y=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.features.x_at_y(obj: SignalObj, p: OrdinateParam = None, *, y: float = 0.0) GeometryResult | None[source]

Compute the smallest x-value at a given y-value for a signal object.

Args:

obj: The signal object containing x and y data. p: The parameter dataset for finding the abscissa.

Returns:

A GeometryResult with a cross marker at the (x, y) position.

Note

This computation function can be called in two ways:

  1. With a parameter OrdinateParam object:

    param = OrdinateParam.create(y=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, y=...)
    

Both styles are fully supported and equivalent.

class sigima.proc.signal.features.AbscissaParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Abscissa parameter.

sigima.proc.signal.features.y_at_x(obj: SignalObj, p: AbscissaParam = None, *, x: float = 0.0) GeometryResult | None[source]

Compute the smallest y-value at a given x-value for a signal object.

Args:

obj: The signal object containing x and y data. p: The parameter dataset for finding the ordinate.

Returns:

A GeometryResult with a cross marker at the (x, y) position.

Note

This computation function can be called in two ways:

  1. With a parameter AbscissaParam object:

    param = AbscissaParam.create(x=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, x=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.features.stats(obj: SignalObj) TableResult[source]

Compute statistics on a signal

Parameters:

obj – source signal

Returns:

Result properties object

sigima.proc.signal.features.bandwidth_3db(obj: SignalObj) GeometryResult | None[source]

Compute bandwidth at -3 dB with sigima.tools.signal.misc.bandwidth()

Note

The bandwidth is defined as the range of frequencies over which the signal maintains a certain level relative to its peak.

Warning

The signal is assumed to be smooth enough for the bandwidth calculation to be meaningful. If the signal contains excessive noise, multiple peaks, or is not sufficiently continuous, the computed bandwidth may not accurately represent the true -3dB range. It is recommended to preprocess the signal to ensure reliable results.

Parameters:

obj – Source signal.

Returns:

Result shape with bandwidth.

class sigima.proc.signal.features.DynamicParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Parameters for dynamic range computation (ENOB, SNR, SINAD, THD, SFDR)

sigima.proc.signal.features.dynamic_parameters(src: SignalObj, p: DynamicParam = None, *, full_scale: float = 0.16, unit: Literal[PowerUnit.DBC, PowerUnit.DBFS] = 'dBc', nb_harm: int = 5) TableResult[source]
Compute Dynamic parameters

using the following functions:

Args:

src: source signal p: parameters

Returns:

Result properties with ENOB, SNR, SINAD, THD, SFDR

Note

This computation function can be called in two ways:

  1. With a parameter DynamicParam object:

    param = DynamicParam.create(full_scale=..., unit=..., nb_harm=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, full_scale=..., unit=..., nb_harm=...)
    

Both styles are fully supported and equivalent.

Stability#

Stability analysis functions#

This module provides stability analysis functions for signal objects:

  • Allan variance and deviation

  • Overlapping Allan variance

  • Modified Allan variance

  • Hadamard variance

  • Total variance

Note

All operations use functions from sigima.tools.signal.stability for actual computations.

class sigima.proc.signal.stability.AllanVarianceParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Allan variance parameters

sigima.proc.signal.stability.allan_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]
Compute Allan variance with

sigima.tools.signal.stability.allan_variance().

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.stability.allan_deviation(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]
Compute Allan deviation with

sigima.tools.signal.stability.allan_deviation()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.stability.overlapping_allan_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]

Compute Overlapping Allan variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.stability.modified_allan_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]

Compute Modified Allan variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.stability.hadamard_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]

Compute Hadamard variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.stability.total_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]

Compute Total variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.stability.time_deviation(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]

Compute Time Deviation (TDEV).

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

Analysis#

General analysis functions#

This module provides general analysis functions for signal objects:

  • Histogram computation

  • Other analysis operations

Note

Most operations use standard NumPy/SciPy functions or custom analysis routines.

sigima.proc.signal.analysis.histogram(src: SignalObj, p: HistogramParam = None, *, bins: int = 256, lower: float = None, upper: float = None) SignalObj[source]

Compute histogram with numpy.histogram()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter HistogramParam object:

    param = HistogramParam.create(bins=..., lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, bins=..., lower=..., upper=...)
    

Both styles are fully supported and equivalent.

class sigima.proc.signal.analysis.PulseFeaturesParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Pulse features parameters.

update_from_obj(obj: SignalObj) None[source]

Update parameters from a signal object.

sigima.proc.signal.analysis.extract_pulse_features(obj: SignalObj, p: PulseFeaturesParam = None, *, signal_shape: Literal[None, 'step', 'square'] = None, xstartmin: float = 0.0, xstartmax: float = 0.0, xendmin: float = 1.0, xendmax: float = 1.0, reference_levels: Literal[5, 95, 10, 90, 20, 80, 25, 75] = (10, 90)) TableResult[source]

Extract pulse features.

Args:

obj: The signal object from which to extract features. p: The pulse features parameters.

Returns:

An object containing the pulse features.

Note

This computation function can be called in two ways:

  1. With a parameter PulseFeaturesParam object:

    param = PulseFeaturesParam.create(signal_shape=..., xstartmin=..., xstartmax=..., xendmin=..., xendmax=..., reference_levels=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, signal_shape=..., xstartmin=..., xstartmax=..., xendmin=..., xendmax=..., reference_levels=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.analysis.sampling_rate_period(obj: SignalObj) TableResult[source]

Compute sampling rate and period using the following functions:

Parameters:

obj – source signal

Returns:

Result properties with sampling rate and period

sigima.proc.signal.analysis.contrast(obj: SignalObj) TableResult[source]

Compute contrast with sigima.tools.signal.misc.contrast()

sigima.proc.signal.analysis.x_at_minmax(obj: SignalObj) TableResult[source]

Compute the smallest argument at the minima and the smallest argument at the maxima.

Parameters:

obj – The signal object.

Returns:

An object containing the x-values at the minima and the maxima.

class sigima.proc.signal.AbscissaParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Abscissa parameter.

class sigima.proc.signal.AllanVarianceParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Allan variance parameters

class sigima.proc.signal.BandPassFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Band-pass filter parameters

class sigima.proc.signal.BandStopFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Band-stop filter parameters

class sigima.proc.signal.BaseHighLowBandParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Base class for high-pass, low-pass, band-pass and band-stop filters

get_filter_func() Callable[source]#

Get the scipy filter function corresponding to the method.

update_from_obj(obj: SignalObj) None[source]#

Update the filter parameters from a signal object

Parameters:

obj – signal object

get_filter_params(obj: SignalObj) tuple[float | str, float | str][source]#

Return the filter parameters (a and b) as a tuple. These parameters are used in the scipy.signal filter functions (eg. scipy.signal.filtfilt).

Parameters:

obj – signal object

Returns:

filter parameters

Return type:

tuple

class sigima.proc.signal.DataTypeSParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Convert signal data type parameters

class sigima.proc.signal.DetrendingParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Detrending parameters

class sigima.proc.signal.DynamicParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Parameters for dynamic range computation (ENOB, SNR, SINAD, THD, SFDR)

class sigima.proc.signal.FWHMParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

FWHM parameters

class sigima.proc.signal.FrequencyFilterMethod(value)[source]#

Frequency filter methods for signal processing.

class sigima.proc.signal.HighPassFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

High-pass filter parameters

class sigima.proc.signal.InterpolationParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Interpolation parameters

class sigima.proc.signal.LowPassFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Low-pass filter parameters

class sigima.proc.signal.OrdinateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Ordinate parameter.

class sigima.proc.signal.PadLocation1D(value)[source]#

Padding location for 1D signal processing.

class sigima.proc.signal.PeakDetectionParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Peak detection parameters

class sigima.proc.signal.PolynomialFitParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Polynomial fitting parameters

class sigima.proc.signal.PowerParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Power parameters

class sigima.proc.signal.PulseFeaturesParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Pulse features parameters.

update_from_obj(obj: SignalObj) None[source]#

Update parameters from a signal object.

class sigima.proc.signal.Resampling1DParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Resample parameters for 1D signals

update_from_obj(obj: SignalObj) None[source]#

Update parameters from a signal object.

class sigima.proc.signal.WindowingParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Windowing parameters.

class sigima.proc.signal.Wrap1to1Func(func: Callable, *args: Any, **kwargs: Any)[source]#

Wrap a 1 array → 1 array function (the simple case of y1 = f(y0)) to produce a 1 signal → 1 signal function, which can be used as a Sigima computation function and inside DataLab’s infrastructure to perform computations with the Signal Processor object.

This wrapping mechanism using a class is necessary for the resulted function to be pickable by the multiprocessing module.

The instance of this wrapper is callable and returns a sigima.objects.SignalObj object.

Example

>>> import numpy as np
>>> from sigima.proc.signal import Wrap1to1Func
>>> import sigima.objects
>>> def square(y):
...     return y**2
>>> compute_square = Wrap1to1Func(square)
>>> x = np.linspace(0, 10, 100)
>>> y = np.sin(x)
>>> sig0 = sigima.objects.create_signal("Example", x, y)
>>> sig1 = compute_square(sig0)
Parameters:
  • func – 1 array → 1 array function

  • *args – Additional positional arguments to pass to the function

  • **kwargs – Additional keyword arguments to pass to the function

Note

If func_name is provided in the keyword arguments, it will be used as the function name instead of the default name derived from the function itself.

Note

This wrapper is suitable for functions that don’t require custom uncertainty propagation. For mathematical functions with specific uncertainty formulas (sqrt, log10, exp, etc.), implement uncertainty propagation directly in the computation function.

class sigima.proc.signal.XYCalibrateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Signal calibration parameters

class sigima.proc.signal.ZeroPadding1DParam(*args, **kwargs)[source]#

Zero-padding parameters for signals.

This class manages parameters for applying zero-padding to signals, commonly used to improve FFT resolution or prepare signals for convolution.

Important

For strategies other than “custom”, the number of points to add (n) is automatically calculated based on the signal size. However, this calculation requires knowledge of the signal, so you must call update_from_obj() before using the parameters.

Example usage:

import sigima.params
import sigima.proc.signal as sips

# Create the parameter object
param = sigima.params.ZeroPadding1DParam.create(strategy="next_pow2")

# IMPORTANT: Update parameters from the signal to compute 'n'
param.update_from_obj(signal)

# Now the parameters are ready to use
result = sips.zero_padding(signal, param)

Attributes:

  • strategies: Available strategies (“next_pow2”, “double”, “triple”, “custom”).

  • strategy: Choice item for selecting the zero-padding strategy.

    • "next_pow2": Pad to the next power of 2 (optimal for FFT)

    • "double": Double the signal length

    • "triple": Triple the signal length

    • "custom": Use a user-specified number of points

  • location: Where to add the padding (“append”, “prepend”, or “both”).

  • n: Number of points to add as padding. For “custom” strategy, this is user-specified. For other strategies, it is computed automatically by update_from_obj().

update_from_obj(obj: SignalObj) None[source]#

Update parameters based on a signal object.

This method computes the number of padding points (n) based on the selected strategy and the actual signal size. This must be called before using the parameters for strategies other than “custom”.

Parameters:

obj – Signal object from which to compute the padding parameters.

static next_power_of_two(size: int) int[source]#

Compute the next power of two greater than or equal to the given size.

Parameters:

size – The input integer.

Returns:

The smallest power of two greater than or equal to ‘size’.

strategy_callback(_, value)[source]#

Callback for strategy choice item.

Parameters:
  • _ – Unused argument (in this context).

  • value – The selected strategy value.

sigima.proc.signal.absolute(src: SignalObj) SignalObj[source]#

Compute absolute value with numpy.absolute

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.add_gaussian_noise(src: SignalObj, p: NormalDistributionParam = None, *, seed: int = 1, mu: float = 0.1, sigma: float = 0.02) SignalObj[source]#

Add normal noise to the input signal.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter NormalDistributionParam object:

    param = NormalDistributionParam.create(seed=..., mu=..., sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., mu=..., sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.add_poisson_noise(src: SignalObj, p: PoissonDistributionParam = None, *, seed: int = 1, lam: float = 0.1) SignalObj[source]#

Add Poisson noise to the input signal.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter PoissonDistributionParam object:

    param = PoissonDistributionParam.create(seed=..., lam=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., lam=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.add_uniform_noise(src: SignalObj, p: UniformDistributionParam = None, *, seed: int = 1, vmin: float = -0.5, vmax: float = 0.5) SignalObj[source]#

Add uniform noise to the input signal.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter UniformDistributionParam object:

    param = UniformDistributionParam.create(seed=..., vmin=..., vmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., vmin=..., vmax=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.addition(src_list: list[SignalObj]) SignalObj[source]#

Compute the element-wise sum of multiple signals.

The first signal in the list defines the “base” signal. All other signals are added element-wise to the base signal.

Note

If all signals share the same region of interest (ROI), the sum is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the sum of the source signals.

sigima.proc.signal.addition_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]#

Compute the sum of a signal and a constant value.

The function adds a constant value to each element of the input signal.

Note

If the signal has a region of interest (ROI), the addition is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the sum of the input signal and the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.allan_deviation(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]#
Compute Allan deviation with

sigima.tools.signal.stability.allan_deviation()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.allan_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]#
Compute Allan variance with

sigima.tools.signal.stability.allan_variance().

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.apply_window(src: SignalObj, p: WindowingParam = None, *, method: Literal['BARTHANN', 'BARTLETT', 'BLACKMAN', 'BLACKMAN_HARRIS', 'BOHMAN', 'BOXCAR', 'COSINE', 'EXPONENTIAL', 'FLAT_TOP', 'GAUSSIAN', 'HAMMING', 'HANN', 'KAISER', 'LANCZOS', 'NUTTALL', 'PARZEN', 'TAYLOR', 'TUKEY'] = 'HAMMING', alpha: float = 0.5, beta: float = 14.0, sigma: float = 0.5) SignalObj[source]#

Compute windowing with sigima.tools.signal.windowing.apply_window().

Args:

src: Source signal. p: Parameters for windowing.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter WindowingParam object:

    param = WindowingParam.create(method=..., alpha=..., beta=..., sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., alpha=..., beta=..., sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.arithmetic(src1: SignalObj, src2: SignalObj, p: ArithmeticParam = None, *, operator: Literal['ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE'] = 'ADD', factor: float = 1.0, constant: float = 0.0, operation: str = '', restore_dtype: bool = True) SignalObj[source]#

Perform an arithmetic operation on two signals.

The function applies the specified arithmetic operation to each element of the input signals.

Note

The operation is performed only within the region of interest of src1.

Note

Uncertainties are propagated.

Warning

It is assumed that both signals have the same size and x-coordinates.

Args:

src1: First input signal. src2: Second input signal. p: Arithmetic operation parameters.

Returns:

Result signal object representing the arithmetic operation on the input signals.

Note

This computation function can be called in two ways:

  1. With a parameter ArithmeticParam object:

    param = ArithmeticParam.create(operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.astype(src: SignalObj, p: DataTypeSParam = None, *, dtype_str: Literal['float32', 'float64', 'complex128'] = 'float32') SignalObj[source]#

Convert data type with numpy.astype()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter DataTypeSParam object:

    param = DataTypeSParam.create(dtype_str=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, dtype_str=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.average(src_list: list[SignalObj]) SignalObj[source]#

Compute the element-wise average of multiple signals.

The first signal in the list defines the “base” signal. All other signals are averaged element-wise with the base signal.

Note

If all signals share the same region of interest (ROI), the average is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the average of the source signals.

sigima.proc.signal.bandpass(src: SignalObj, p: BandPassFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]#

Compute band-pass filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter BandPassFilterParam object:

    param = BandPassFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.bandstop(src: SignalObj, p: BandStopFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]#

Compute band-stop filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter BandStopFilterParam object:

    param = BandStopFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.bandwidth_3db(obj: SignalObj) GeometryResult | None[source]#

Compute bandwidth at -3 dB with sigima.tools.signal.misc.bandwidth()

Note

The bandwidth is defined as the range of frequencies over which the signal maintains a certain level relative to its peak.

Warning

The signal is assumed to be smooth enough for the bandwidth calculation to be meaningful. If the signal contains excessive noise, multiple peaks, or is not sufficiently continuous, the computed bandwidth may not accurately represent the true -3dB range. It is recommended to preprocess the signal to ensure reliable results.

Parameters:

obj – Source signal.

Returns:

Result shape with bandwidth.

sigima.proc.signal.calibration(src: SignalObj, p: XYCalibrateParam = None, *, axis: Literal['x', 'y'] = 'y', a: float = 1.0, b: float = 0.0) SignalObj[source]#

Compute linear calibration

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter XYCalibrateParam object:

    param = XYCalibrateParam.create(axis=..., a=..., b=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, axis=..., a=..., b=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.cdf_fit(src: SignalObj) SignalObj[source]#

Compute CDF fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.check_same_sample_rate(src1: SignalObj, src2: SignalObj) None[source]#

Check if two signals have a constant step size and the same sample rate.

Parameters:
  • src1 – First signal.

  • src2 – Second signal.

Raises:

ValueError – If the signals do not have a constant step size or the same sample rate.

sigima.proc.signal.clip(src: SignalObj, p: ClipParam = None, *, lower: float = None, upper: float = None) SignalObj[source]#

Compute maximum data clipping with numpy.clip()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter ClipParam object:

    param = ClipParam.create(lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, lower=..., upper=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.complex_from_magnitude_phase(src1: SignalObj, src2: SignalObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') SignalObj[source]#

Combine magnitude and phase signals into a complex signal.

Warning

The x coordinates of the two signals must be the same.

Warning

Negative values are not allowed for the radius and will be clipped to 0.

Args:

src1: Magnitude (module) signal. src2: Phase (argument) signal. p: Parameters (must provide unit for the phase).

Returns:

Result signal object with complex-valued y.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.complex_from_real_imag(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Combine two real signals into a complex signal using real + i * imag.

Warning

The x coordinates of the two signals must be the same.

Parameters:
  • src1 – Real part signal.

  • src2 – Imaginary part signal.

Returns:

Result signal object with complex-valued y.

sigima.proc.signal.compute_geometry_from_obj(title: str, shape: str | KindShape, obj: SignalObj, func: Callable, *args: Any) GeometryResult | None[source]#

Calculate result geometry by executing a computation function on a signal object.

Parameters:
  • title – Result title

  • shape – Result shape kind (e.g., “segment”, “point”, KindShape.MARKER)

  • obj – Input signal object

  • func – Computation function that takes (x, y, *args) and returns coordinates

  • *args – Additional computation function arguments

Returns:

Result geometry object or None if no result is found

Note

The computation function must take x and y arrays as the first two arguments, followed by any additional arguments, and return a NumPy array containing coordinate pairs in the form [[x0, y0], [x1, y1], ...].

sigima.proc.signal.contrast(obj: SignalObj) TableResult[source]#

Compute contrast with sigima.tools.signal.misc.contrast()

sigima.proc.signal.convolution(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute convolution of two signals with scipy.signal.convolve().

Parameters:
  • src1 – Source signal 1.

  • src2 – Source signal 2.

Returns:

Result signal.

Notes

The behavior of kernel normalization is controlled by the global configuration option sigima.config.options.auto_normalize_kernel.

sigima.proc.signal.deconvolution(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute deconvolution.

The function computes the deconvolution of a signal using sigima_.algorithms.signal.fourier.deconvolve().

Parameters:
  • src1 – Source signal.

  • src2 – Filter signal.

Returns:

Result signal.

Notes

The kernel normalization behavior can be configured globally using sigima.config.options.auto_normalize_kernel.

sigima.proc.signal.derivative(src: SignalObj) SignalObj[source]#

Compute derivative with numpy.gradient()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.detrending(src: SignalObj, p: DetrendingParam = None, *, method: Literal['linear', 'constant'] = 'linear') SignalObj[source]#

Detrend data with scipy.signal.detrend()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter DetrendingParam object:

    param = DetrendingParam.create(method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.difference(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute the element-wise difference between two signals.

The function subtracts each element of the second signal from the corresponding element of the first signal.

Note

If both signals share the same region of interest (ROI), the difference is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that both signals have the same size and x-coordinates.

Parameters:
  • src1 – First input signal.

  • src2 – Second input signal.

Returns:

Result signal object representing the difference between the input signals.

sigima.proc.signal.difference_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]#

Compute the difference between a signal and a constant value.

The function subtracts a constant value from each element of the input signal.

Note

If the signal has a region of interest (ROI), the subtraction is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the difference between the input signal and the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.division(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute the element-wise division between two signals.

The function divides each element of the first signal by the corresponding element of the second signal.

Note

If both signals share the same region of interest (ROI), the division is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that both signals have the same size and x-coordinates.

Parameters:
  • src1 – First input signal.

  • src2 – Second input signal.

Returns:

Result signal object representing the division of the input signals.

sigima.proc.signal.division_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]#

Compute the division of a signal by a constant value.

The function divides each element of the input signal by a constant value.

Note

If the signal has a region of interest (ROI), the division is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the division of the input signal by the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.dynamic_parameters(src: SignalObj, p: DynamicParam = None, *, full_scale: float = 0.16, unit: Literal[PowerUnit.DBC, PowerUnit.DBFS] = 'dBc', nb_harm: int = 5) TableResult[source]#
Compute Dynamic parameters

using the following functions:

Args:

src: source signal p: parameters

Returns:

Result properties with ENOB, SNR, SINAD, THD, SFDR

Note

This computation function can be called in two ways:

  1. With a parameter DynamicParam object:

    param = DynamicParam.create(full_scale=..., unit=..., nb_harm=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, full_scale=..., unit=..., nb_harm=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.evaluate_fit(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Evaluate fit function from src1 on the x-axis of src2.

This function extracts fit parameters from src1 (which must contain fit metadata from a previous fitting operation) and evaluates the fit function on the x-axis of src2.

Parameters:
  • src1 – Signal object containing fit parameters in metadata (from a fit operation)

  • src2 – Signal object whose x-axis will be used for evaluation

Returns:

New signal with the fit evaluated on src2’s x-axis

sigima.proc.signal.exp(src: SignalObj) SignalObj[source]#

Compute exponential with numpy.exp

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.exponential_fit(src: SignalObj) SignalObj[source]#

Compute exponential fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.extract_fit_params(signal: SignalObj) dict[str, float | str][source]#

Extract fit parameters from a fitted signal.

Parameters:

signal – Signal object containing fit metadata

Returns:

Fit parameters

sigima.proc.signal.extract_pulse_features(obj: SignalObj, p: PulseFeaturesParam = None, *, signal_shape: Literal[None, 'step', 'square'] = None, xstartmin: float = 0.0, xstartmax: float = 0.0, xendmin: float = 1.0, xendmax: float = 1.0, reference_levels: Literal[5, 95, 10, 90, 20, 80, 25, 75] = (10, 90)) TableResult[source]#

Extract pulse features.

Args:

obj: The signal object from which to extract features. p: The pulse features parameters.

Returns:

An object containing the pulse features.

Note

This computation function can be called in two ways:

  1. With a parameter PulseFeaturesParam object:

    param = PulseFeaturesParam.create(signal_shape=..., xstartmin=..., xstartmax=..., xendmin=..., xendmax=..., reference_levels=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, signal_shape=..., xstartmin=..., xstartmax=..., xendmin=..., xendmax=..., reference_levels=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.extract_roi(src: SignalObj, p: ROI1DParam = None, *, title: str = '', xmin: float = 0.0, xmax: float = 1.0) SignalObj[source]#

Extract single region of interest from data

Args:

src: source signal p: ROI parameters

Returns:

Signal with single region of interest

Note

This computation function can be called in two ways:

  1. With a parameter ROI1DParam object:

    param = ROI1DParam.create(title=..., xmin=..., xmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., xmin=..., xmax=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.extract_rois(src: SignalObj, params: list[ROI1DParam]) SignalObj[source]#

Extract multiple regions of interest from data

Parameters:
  • src – source signal

  • params – list of ROI parameters

Returns:

Signal with multiple regions of interest

sigima.proc.signal.fft(src: SignalObj, p: FFTParam | None = None) SignalObj[source]#

Compute FFT with sigima.tools.signal.fourier.fft1d().

Parameters:
  • src – Source signal.

  • p – Parameters.

Returns:

Result signal object.

sigima.proc.signal.frequency_filter(src: SignalObj, p: BaseHighLowBandParam) SignalObj[source]#

Compute frequency filter (low-pass, high-pass, band-pass, band-stop), with scipy.signal.filtfilt()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

Note

Uses zero-phase filtering (filtfilt) when possible for better phase response. If numerical instability occurs (e.g., singular matrix errors), automatically falls back to forward filtering (lfilter) with a warning. This ensures cross-platform compatibility while maintaining optimal filtering when possible.

sigima.proc.signal.full_width_at_y(obj: SignalObj, p: OrdinateParam = None, *, y: float = 0.0) GeometryResult | None[source]#

Compute full width at a given y value for a signal object.

Args:

obj: The signal object containing x and y data. p: The ordinate parameter dataset

Returns:

Segment coordinates

Note

This computation function can be called in two ways:

  1. With a parameter OrdinateParam object:

    param = OrdinateParam.create(y=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, y=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.fw1e2(obj: SignalObj) GeometryResult | None[source]#

Compute FW at 1/e² with sigima.tools.signal.pulse.fw1e2()

Parameters:

obj – source signal

Returns:

Segment coordinates

sigima.proc.signal.fwhm(obj: SignalObj, param: FWHMParam = None, *, method: Literal['zero-crossing', 'gauss', 'lorentz', 'voigt'] = 'zero-crossing', xmin: float = None, xmax: float = None) GeometryResult | None[source]#

Compute FWHM with sigima.tools.signal.pulse.fwhm()

Args:

obj: source signal param: parameters

Returns:

Segment coordinates

Note

This computation function can be called in two ways:

  1. With a parameter FWHMParam object:

    param = FWHMParam.create(method=..., xmin=..., xmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., xmin=..., xmax=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.gaussian_filter(src: SignalObj, p: GaussianParam = None, *, sigma: float = 1.0) SignalObj[source]#

Compute gaussian filter with scipy.ndimage.gaussian_filter()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter GaussianParam object:

    param = GaussianParam.create(sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.gaussian_fit(src: SignalObj) SignalObj[source]#

Compute Gaussian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.get_nyquist_frequency(obj: SignalObj) float[source]#

Return the Nyquist frequency of a signal object

Parameters:

obj – signal object

Returns:

Nyquist frequency

sigima.proc.signal.hadamard_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]#

Compute Hadamard variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.highpass(src: SignalObj, p: HighPassFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]#

Compute high-pass filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter HighPassFilterParam object:

    param = HighPassFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.histogram(src: SignalObj, p: HistogramParam = None, *, bins: int = 256, lower: float = None, upper: float = None) SignalObj[source]#

Compute histogram with numpy.histogram()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter HistogramParam object:

    param = HistogramParam.create(bins=..., lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, bins=..., lower=..., upper=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.ifft(src: SignalObj) SignalObj[source]#

Compute the inverse FFT with sigima.tools.signal.fourier.ifft1d().

Parameters:

src – Source signal.

Returns:

Result signal object.

sigima.proc.signal.imag(src: SignalObj) SignalObj[source]#

Compute imaginary part with numpy.imag()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.integral(src: SignalObj) SignalObj[source]#

Compute integral with scipy.integrate.cumulative_trapezoid()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.interpolate(src1: SignalObj, src2: SignalObj, p: InterpolationParam = None, *, method: Literal[Interpolation1DMethod.LINEAR, Interpolation1DMethod.SPLINE, Interpolation1DMethod.QUADRATIC, Interpolation1DMethod.CUBIC, Interpolation1DMethod.BARYCENTRIC, Interpolation1DMethod.PCHIP] = 'linear', fill_value: float = None) SignalObj[source]#

Interpolate data with sigima.tools.signal.interpolation.interpolate().

Args:

src1: Source signal to interpolate. src2: Signal with new x-axis. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter InterpolationParam object:

    param = InterpolationParam.create(method=..., fill_value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., fill_value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.inverse(src: SignalObj) SignalObj[source]#

Compute the element-wise inverse of a signal.

The function computes the reciprocal (1/y) of each element of the input signal.

Note

If the signal has a region of interest (ROI), the inverse is performed only within the ROI.

Note

Uncertainties are propagated.

Parameters:

src – Input signal object.

Returns:

Result signal object representing the inverse of the input signal.

sigima.proc.signal.is_uncertainty_data_available(signals: SignalObj | list[SignalObj]) bool[source]#

Check if all signals have uncertainty data.

This functions is used to determine whether enough information is available to propagate uncertainty.

Parameters:

signals – Signal object or list of signal objects.

Returns:

True if all signals have uncertainty data, False otherwise.

sigima.proc.signal.linear_fit(src: SignalObj) SignalObj[source]#

Compute linear fit with numpy.polyfit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.log10(src: SignalObj) SignalObj[source]#

Compute Log10 with numpy.log10

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.lorentzian_fit(src: SignalObj) SignalObj[source]#

Compute Lorentzian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.lowpass(src: SignalObj, p: LowPassFilterParam = None, *, method: Literal[FrequencyFilterMethod.BUTTERWORTH, FrequencyFilterMethod.BESSEL, FrequencyFilterMethod.CHEBYSHEV1, FrequencyFilterMethod.CHEBYSHEV2, FrequencyFilterMethod.ELLIPTIC, FrequencyFilterMethod.BRICKWALL] = 'butterworth', order: int = 3, cut0: float = None, cut1: float = None, rp: float = 1.0, rs: float = 60.0, zero_padding: bool = True, nfft: int = 0) SignalObj[source]#

Compute low-pass filter with scipy.signal.filtfilt()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter LowPassFilterParam object:

    param = LowPassFilterParam.create(method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., order=..., cut0=..., cut1=..., rp=..., rs=..., zero_padding=..., nfft=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.magnitude_spectrum(src: SignalObj, p: SpectrumParam | None = None) SignalObj[source]#

Compute magnitude spectrum.

This function computes the magnitude spectrum of a signal using sigima.tools.signal.fourier.magnitude_spectrum().

Parameters:
  • src – Source signal.

  • p – Parameters.

Returns:

Result signal object.

sigima.proc.signal.modified_allan_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]#

Compute Modified Allan variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.moving_average(src: SignalObj, p: MovingAverageParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'REFLECT') SignalObj[source]#

Compute moving average with scipy.ndimage.uniform_filter()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter MovingAverageParam object:

    param = MovingAverageParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.moving_median(src: SignalObj, p: MovingMedianParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'NEAREST') SignalObj[source]#

Compute moving median with scipy.ndimage.median_filter()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter MovingMedianParam object:

    param = MovingMedianParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.normalize(src: SignalObj, p: NormalizeParam = None, *, method: Literal['MAXIMUM', 'AMPLITUDE', 'AREA', 'ENERGY', 'RMS'] = 'MAXIMUM') SignalObj[source]#

Normalize data with sigima.tools.signal.level.normalize()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter NormalizeParam object:

    param = NormalizeParam.create(method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.offset_correction(src: SignalObj, p: ROI1DParam = None, *, title: str = '', xmin: float = 0.0, xmax: float = 1.0) SignalObj[source]#
Correct offset: subtract the mean value of the signal in the specified range

(baseline correction)

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter ROI1DParam object:

    param = ROI1DParam.create(title=..., xmin=..., xmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., xmin=..., xmax=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.overlapping_allan_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]#

Compute Overlapping Allan variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.peak_detection(src: SignalObj, p: PeakDetectionParam = None, *, threshold: float = 0.1, min_dist: int = 1) SignalObj[source]#
Peak detection with

sigima.tools.signal.peakdetection.peak_indices()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter PeakDetectionParam object:

    param = PeakDetectionParam.create(threshold=..., min_dist=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, threshold=..., min_dist=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.phase(src: SignalObj, p: PhaseParam = None, *, unwrap: bool = True, unit: Literal['RADIAN', 'DEGREE'] = 'DEGREE') SignalObj[source]#

Compute the phase (argument) of a complex signal.

The function uses numpy.angle() to compute the argument and numpy.unwrap() to unwrap it.

Args:

src: Input signal object. p: Phase parameters.

Returns:

Signal object containing the phase, optionally unwrapped.

Note

This computation function can be called in two ways:

  1. With a parameter PhaseParam object:

    param = PhaseParam.create(unwrap=..., unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unwrap=..., unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.phase_spectrum(src: SignalObj) SignalObj[source]#

Compute phase spectrum.

This function computes the phase spectrum of a signal using sigima.tools.signal.fourier.phase_spectrum()

Parameters:

src – Source signal.

Returns:

Result signal object.

sigima.proc.signal.piecewiseexponential_fit(src: SignalObj) SignalObj[source]#

Compute piecewise exponential fit (raise-decay) with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.planckian_fit(src: SignalObj) SignalObj[source]#

Compute Planckian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.polynomial_fit(src: SignalObj, p: PolynomialFitParam = None, *, degree: int = 3) SignalObj[source]#

Compute polynomial fit with numpy.polyfit()

Args:

src: source signal p: polynomial fitting parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter PolynomialFitParam object:

    param = PolynomialFitParam.create(degree=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, degree=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.power(src: SignalObj, p: PowerParam = None, *, power: float = 2.0) SignalObj[source]#

Compute power with numpy.power

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter PowerParam object:

    param = PowerParam.create(power=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, power=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.product(src_list: list[SignalObj]) SignalObj[source]#

Compute the element-wise product of multiple signals.

The first signal in the list defines the “base” signal. All other signals are multiplied element-wise with the base signal.

Note

If all signals share the same region of interest (ROI), the product is performed only within the ROI.

Note

Uncertainties are propagated.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the product of the source signals.

sigima.proc.signal.product_constant(src: SignalObj, p: ConstantParam = None, *, value: float = None) SignalObj[source]#

Compute the product of a signal and a constant value.

The function multiplies each element of the input signal by a constant value.

Note

If the signal has a region of interest (ROI), the multiplication is performed only within the ROI.

Note

Uncertainties are propagated.

Args:

src: Input signal object. p: Constant value.

Returns:

Result signal object representing the product of the input signal and the constant.

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.psd(src: SignalObj, p: SpectrumParam | None = None) SignalObj[source]#

Compute power spectral density with sigima.tools.signal.fourier.psd().

Parameters:
  • src – Source signal.

  • p – Parameters.

Returns:

Result signal object.

sigima.proc.signal.quadratic_difference(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute the normalized difference between two signals.

The function computes the element-wise difference between the two signals and divides the result by sqrt(2.0).

Note

If both signals share the same region of interest (ROI), the operation is performed only within the ROI.

Note

Uncertainties are propagated. For two input signals with identical standard deviations, the standard deviation of the output signal equals the standard deviation of each of the input signals.

Warning

It is assumed that both signals have the same size and x-coordinates.

Parameters:
  • src1 – First input signal.

  • src2 – Second input signal.

Returns:

Result signal object representing the quadratic difference between the input signals.

sigima.proc.signal.real(src: SignalObj) SignalObj[source]#

Compute real part with numpy.real()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.replace_x_by_other_y(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Create a new signal using Y from src1 and Y from src2 as X coordinates.

This is useful for calibration scenarios where one signal contains calibration data (e.g., wavelengths) in its Y values, and you want to plot another signal’s Y values against these calibration points.

The two signals must have the same number of points.

Parameters:
  • src1 – First signal (provides Y data for output).

  • src2 – Second signal (provides Y data to be used as X coordinates for output).

Returns:

A new signal with X from src2.y and Y from src1.y.

Raises:

ValueError – If signals don’t have the same number of points.

sigima.proc.signal.resampling(src: SignalObj, p: Resampling1DParam = None, *, method: Literal[Interpolation1DMethod.LINEAR, Interpolation1DMethod.SPLINE, Interpolation1DMethod.QUADRATIC, Interpolation1DMethod.CUBIC, Interpolation1DMethod.BARYCENTRIC, Interpolation1DMethod.PCHIP] = 'linear', fill_value: float = None, xmin: float = None, xmax: float = None, mode: Literal['dx', 'nbpts'] = 'nbpts', dx: float = None, nbpts: int = None) SignalObj[source]#

Resample data with sigima.tools.signal.interpolation.interpolate()

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter Resampling1DParam object:

    param = Resampling1DParam.create(method=..., fill_value=..., xmin=..., xmax=..., mode=..., dx=..., nbpts=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., fill_value=..., xmin=..., xmax=..., mode=..., dx=..., nbpts=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.restore_data_outside_roi(dst: SignalObj, src: SignalObj) None[source]#

Restore data outside the Region Of Interest (ROI) of the input signal after a computation, only if the input signal has a ROI, and if the output signal has the same ROI as the input signal, and if the data types are the same, and if the shapes are the same. Otherwise, do nothing.

Parameters:
  • dst – destination signal object

  • src – source signal object

sigima.proc.signal.reverse_x(src: SignalObj) SignalObj[source]#

Reverse x-axis

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.sampling_rate_period(obj: SignalObj) TableResult[source]#

Compute sampling rate and period using the following functions:

Parameters:

obj – source signal

Returns:

Result properties with sampling rate and period

sigima.proc.signal.sigmoid_fit(src: SignalObj) SignalObj[source]#

Compute sigmoid fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.signals_to_image(src_list: list[SignalObj], p: SignalsToImageParam) ImageObj[source]#

Combine multiple signals into an image.

The function takes a list of signals and combines them into a 2D image, arranging them either as rows or columns based on the specified orientation. Optionally, each signal can be normalized before combining.

Note

All signals must have the same size (number of data points).

Note

If normalization is enabled, each signal is normalized independently using the specified normalization method before being added to the image.

Parameters:
  • src_list – List of source signals to combine.

  • p – Parameters specifying orientation and normalization options.

Returns:

Image object representing the combined signals.

Raises:

ValueError – If the signal list is empty or signals have different sizes.

sigima.proc.signal.sinusoidal_fit(src: SignalObj) SignalObj[source]#

Compute sinusoidal fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.sqrt(src: SignalObj) SignalObj[source]#

Compute square root with numpy.sqrt

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.standard_deviation(src_list: list[SignalObj]) SignalObj[source]#

Compute the element-wise standard deviation of multiple signals.

The first signal in the list defines the “base” signal. All other signals are used to compute the element-wise standard deviation with the base signal.

Note

If all signals share the same region of interest (ROI), the standard deviation is computed only within the ROI.

Warning

It is assumed that all signals have the same size and x-coordinates.

Parameters:

src_list – List of source signals.

Returns:

Signal object representing the standard deviation of the source signals.

sigima.proc.signal.stats(obj: SignalObj) TableResult[source]#

Compute statistics on a signal

Parameters:

obj – source signal

Returns:

Result properties object

sigima.proc.signal.time_deviation(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]#

Compute Time Deviation (TDEV).

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.to_cartesian(src: SignalObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') SignalObj[source]#

Convert polar coordinates to Cartesian coordinates.

This function converts the r and theta coordinates of a signal to Cartesian coordinates using sigima.tools.coordinates.to_cartesian().

Note

It is assumed that the x-axis represents the radius and the y-axis the angle.

Warning

Negative values are not allowed for the radius and will be clipped to 0.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.to_polar(src: SignalObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') SignalObj[source]#

Convert Cartesian coordinates to polar coordinates.

This function converts the x and y coordinates of a signal to polar coordinates using sigima.tools.coordinates.to_polar().

Warning

X and y must share the same units for the computation to make sense.

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Raises:

ValueError: If the x and y units are not the same.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.total_variance(src: SignalObj, p: AllanVarianceParam = None, *, max_tau: int = 100) SignalObj[source]#

Compute Total variance.

Args:

src: source signal p: parameters

Returns:

Result signal object

Note

This computation function can be called in two ways:

  1. With a parameter AllanVarianceParam object:

    param = AllanVarianceParam.create(max_tau=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, max_tau=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.transpose(src: SignalObj) SignalObj[source]#

Transpose signal (swap X and Y axes).

Parameters:

src – Source signal.

Returns:

Result signal object.

sigima.proc.signal.twohalfgaussian_fit(src: SignalObj) SignalObj[source]#

Compute two-half-Gaussian fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.voigt_fit(src: SignalObj) SignalObj[source]#

Compute Voigt fit with scipy.optimize.curve_fit()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.wiener(src: SignalObj) SignalObj[source]#

Compute Wiener filter with scipy.signal.wiener()

Parameters:

src – source signal

Returns:

Result signal object

sigima.proc.signal.x_at_minmax(obj: SignalObj) TableResult[source]#

Compute the smallest argument at the minima and the smallest argument at the maxima.

Parameters:

obj – The signal object.

Returns:

An object containing the x-values at the minima and the maxima.

sigima.proc.signal.x_at_y(obj: SignalObj, p: OrdinateParam = None, *, y: float = 0.0) GeometryResult | None[source]#

Compute the smallest x-value at a given y-value for a signal object.

Args:

obj: The signal object containing x and y data. p: The parameter dataset for finding the abscissa.

Returns:

A GeometryResult with a cross marker at the (x, y) position.

Note

This computation function can be called in two ways:

  1. With a parameter OrdinateParam object:

    param = OrdinateParam.create(y=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, y=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.xy_mode(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Simulate the X-Y mode of an oscilloscope.

Use the first signal as the X-axis and the second signal as the Y-axis.

Parameters:
  • src1 – First input signal (X-axis).

  • src2 – Second input signal (Y-axis).

Returns:

A signal object representing the X-Y mode.

sigima.proc.signal.y_at_x(obj: SignalObj, p: AbscissaParam = None, *, x: float = 0.0) GeometryResult | None[source]#

Compute the smallest y-value at a given x-value for a signal object.

Args:

obj: The signal object containing x and y data. p: The parameter dataset for finding the ordinate.

Returns:

A GeometryResult with a cross marker at the (x, y) position.

Note

This computation function can be called in two ways:

  1. With a parameter AbscissaParam object:

    param = AbscissaParam.create(x=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, x=...)
    

Both styles are fully supported and equivalent.

sigima.proc.signal.zero_padding(src: SignalObj, p: ZeroPadding1DParam = None, *, strategy: Literal['next_pow2', 'double', 'triple', 'custom'] = 'next_pow2', location: Literal['APPEND', 'PREPEND', 'BOTH'] = 'APPEND', n: int = 1) SignalObj[source]#

Compute zero padding with sigima.tools.signal.fourier.zero_padding().

Args:

src: Source signal. p: Parameters.

Returns:

Result signal object.

Note

This computation function can be called in two ways:

  1. With a parameter ZeroPadding1DParam object:

    param = ZeroPadding1DParam.create(strategy=..., location=..., n=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, strategy=..., location=..., n=...)
    

Both styles are fully supported and equivalent.

Image processing features#

Basic image processing#

Base computation module#

This module provides core classes and utility functions that serve as building blocks for the other computation modules.

Main features include:

  • Generic helper functions used across image processing modules

  • Core wrappers and infrastructure for computation functions

Intended primarily for internal use, these tools support consistent API design and code reuse.

class sigima.proc.image.base.Wrap1to1Func(func: Callable, *args: Any, **kwargs: Any)[source]

Wrap a 1 array → 1 array function to produce a 1 image → 1 image function, which can be used as a Sigima computation function and inside DataLab’s infrastructure to perform computations with the Image Processor object.

This wrapping mechanism using a class is necessary for the resulted function to be pickable by the multiprocessing module.

The instance of this wrapper is callable and returns a sigima.objects.ImageObj object.

Example

>>> import numpy as np
>>> from sigima.proc.image import Wrap1to1Func
>>> import sigima.objects
>>> def add_noise(data):
...     return data + np.random.random(data.shape)
>>> compute_add_noise = Wrap1to1Func(add_noise)
>>> data= np.ones((100, 100))
>>> ima0 = sigima.objects.create_image("Example", data)
>>> ima1 = compute_add_noise(ima0)
Parameters:
  • func – 1 array → 1 array function

  • *args – Additional positional arguments to pass to the function

  • **kwargs – Additional keyword arguments to pass to the function

Note

If func_name is provided in the keyword arguments, it will be used as the function name instead of the default name derived from the function itself.

sigima.proc.image.base.compute_geometry_from_obj(title: str, shape: KindShape, obj: ImageObj, func: Callable, *args: Any) GeometryResult | None[source]

Compute a geometry shape from an image object by executing a computation function on the data of the image object, for each ROI (Region Of Interest) in the image.

Parameters:
  • title – result title

  • shape – result shape kind

  • obj – input image object

  • func – computation function

  • *args – computation function arguments

Returns:

A geometry result object or None if no result is found.

Important

Coordinate Conversion: This function automatically converts coordinates from pixel units (image indices) to physical units using the image object’s calibration information.

  • Input: Computation function returns coordinates in pixel units

  • Output: GeometryResult with coordinates in physical units (e.g., mm, µm)

The conversion is performed using the image’s calibration parameters: physical_x = obj.dx * pixel_x + obj.x0 and physical_y = obj.dy * pixel_y + obj.y0

Warning

The computation function must take either a single argument (the data) or multiple arguments (the data followed by the computation parameters).

Moreover, the computation function must return a single value or a NumPy array containing the result of the computation. This array contains the coordinates of points, polygons, circles or ellipses in the form [[x, y], …], or [[x0, y0, x1, y1, …], …], or [[x0, y0, r], …], or [[x0, y0, a, b, theta], …].

Example

>>> # func returns pixel coordinates like [[10, 20], [30, 40]]
>>> result = compute_geometry_from_obj(
...     "Points", KindShape.POINT, image_obj, func
... )
>>> # result.coords now contains physical coordinates like [[0.5, 1.0],
>>> # [1.5, 2.0]]

See also

GeometryResult: The result object that stores physical coordinates.

sigima.proc.image.base.dst_1_to_1(src: ImageObj, name: str, suffix: str | None = None) ImageObj[source]

Create a result image object for 1-to-1 processing.

This is the image-specific version that resets the LUT range after copying, so the result image auto-scales to fit its new data range.

Parameters:
  • src – source image object

  • name – name of the function

  • suffix – suffix to add to the title

Returns:

Result image object with LUT range reset

sigima.proc.image.base.dst_1_to_1_signal(src: ImageObj, name: str, suffix: str | None = None) SignalObj[source]

Create a result signal object, for processing functions that take a single image object as input and return a single signal object (1-to-1-signal).

Parameters:
  • src – input image object

  • name – name of the processing function

Returns:

Output signal object

sigima.proc.image.base.dst_2_to_1(src1: ImageObj, src2: ImageObj, name: str, suffix: str | None = None) ImageObj[source]

Create a result image object for 2-to-1 processing.

This is the image-specific version that resets the LUT range after copying, so the result image auto-scales to fit its new data range.

Parameters:
  • src1 – first source image object

  • src2 – second source image object

  • name – name of the function

  • suffix – suffix to add to the title

Returns:

Result image object with LUT range reset

sigima.proc.image.base.dst_n_to_1(src_list: list[ImageObj], name: str, suffix: str | None = None) ImageObj[source]

Create a result image object for n-to-1 processing.

This is the image-specific version that resets the LUT range after copying, so the result image auto-scales to fit its new data range.

Parameters:
  • src_list – list of source image objects

  • name – name of the function

  • suffix – suffix to add to the title

Returns:

Result image object with LUT range reset

sigima.proc.image.base.restore_data_outside_roi(dst: ImageObj, src: ImageObj) None[source]

Restore data outside the Region Of Interest (ROI) of the input image after a computation, only if the input image has a ROI, and if the output image has the same ROI as the input image, and if the data types are compatible, and if the shapes are the same. Otherwise, do nothing.

Parameters:
  • dst – output image object

  • src – input image object

Arithmetic#

Arithmetic computation module#

This module provides arithmetic operations for images, such as pixel-wise addition, subtraction, multiplication, division, as well as operations with constants and combined arithmetic formulas.

Main features include:

  • Pixel-wise addition, subtraction, multiplication, and division between images

  • Application of arithmetic operations with constants to images

  • Support for quadratic difference and general arithmetic expressions

These functions are typically used for basic algebraic processing and normalization of image data.

sigima.proc.image.arithmetic.addition(src_list: list[ImageObj]) ImageObj[source]

Add images in the list and return the result image object

Parameters:

src_list – list of input image objects

Returns:

Output image object (modified in place)

sigima.proc.image.arithmetic.addition_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]

Add dst and a constant value and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src + p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.arithmetic.arithmetic(src1: ImageObj, src2: ImageObj, p: ArithmeticParam = None, *, operator: Literal['ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE'] = 'ADD', factor: float = 1.0, constant: float = 0.0, operation: str = '', restore_dtype: bool = True) ImageObj[source]

Compute arithmetic operation on two images

Args:

src1: input image object src2: input image object p: arithmetic parameters

Returns:

Result image object

Note

This computation function can be called in two ways:

  1. With a parameter ArithmeticParam object:

    param = ArithmeticParam.create(operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.arithmetic.average(src_list: list[ImageObj]) ImageObj[source]

Compute the average of images in the list and return the result image object

Parameters:

src_list – list of input image objects

Returns:

Output image object (modified in place)

sigima.proc.image.arithmetic.difference(src1: ImageObj, src2: ImageObj) ImageObj[source]

Compute difference between two images

Parameters:
  • src1 – input image object

  • src2 – input image object

Returns:

Result image object src1 - src2 (new object)

sigima.proc.image.arithmetic.difference_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]

Subtract a constant value from an image and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src - p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.arithmetic.division(src1: ImageObj, src2: ImageObj) ImageObj[source]

Compute division between two images

Parameters:
  • src1 – input image object

  • src2 – input image object

Returns:

Result image object src1 / src2 (new object)

sigima.proc.image.arithmetic.division_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]

Divide an image by a constant value and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src / p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.arithmetic.product(src_list: list[ImageObj]) ImageObj[source]

Multiply images in the list and return the result image object

Parameters:

src_list – list of input image objects

Returns:

Output image object (modified in place)

sigima.proc.image.arithmetic.product_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]

Multiply dst by a constant value and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src * p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.arithmetic.quadratic_difference(src1: ImageObj, src2: ImageObj) ImageObj[source]

Compute quadratic difference between two images

Parameters:
  • src1 – input image object

  • src2 – input image object

Returns:

Result image object (src1 - src2) / sqrt(2.0) (new object)

sigima.proc.image.arithmetic.standard_deviation(src_list: list[ImageObj]) ImageObj[source]

Compute the element-wise standard deviation of multiple images.

The first image in the list defines the “base” image. All other images are used to compute the element-wise standard deviation with the base image.

Note

If all images share the same region of interest (ROI), the standard deviation is computed only within the ROI.

Warning

It is assumed that all images have the same size and x-coordinates.

Parameters:

src_list – List of source images.

Returns:

Image object representing the standard deviation of the source images.

Mathematical Operations#

Mathematical Operations Module#

This module implements mathematical operations on images, such as inversion, absolute value, real/imaginary part extraction, type casting, and exponentiation.

Main features include:

  • Pixel-wise mathematical transformations (e.g., log, exp, abs, real, imag, log10)

  • Type casting and other value-level operations

These functions enable flexible manipulation of image data at the value level.

class sigima.proc.image.mathops.DataTypeIParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Convert image data type parameters

class sigima.proc.image.mathops.Log10ZPlusNParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Log10(z+n) parameters

sigima.proc.image.mathops.absolute(src: ImageObj) ImageObj[source]

Compute absolute value with numpy.absolute

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.mathops.astype(src: ImageObj, p: DataTypeIParam = None, *, dtype_str: Literal['float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'float32') ImageObj[source]

Convert image data type with sigima.tools.datatypes.clip_astype()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DataTypeIParam object:

    param = DataTypeIParam.create(dtype_str=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, dtype_str=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.mathops.complex_from_magnitude_phase(src1: ImageObj, src2: ImageObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') ImageObj[source]

Combine magnitude and phase images into a complex image.

Warning

This function assumes that the input images have the same dimensions.

Args:

src1: Magnitude (module) image. src2: Phase (argument) image. p: Parameters (provides unit for the phase).

Returns:

Image object with complex-valued z.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.mathops.complex_from_real_imag(src1: ImageObj, src2: ImageObj) ImageObj[source]

Combine two real images into a complex image using real + i * imag.

Warning

This function assumes that the input images have the same dimensions and are properly aligned.

Parameters:
  • src1 – Real part image.

  • src2 – Imaginary part image.

Returns:

Image object with complex-valued z.

Raises:

ValueError – If the x or y coordinates of the two images are not the same.

sigima.proc.image.mathops.convolution(src: ImageObj, kernel: ImageObj) ImageObj[source]

Convolve an image with a kernel.

The kernel should ideally be smaller than the input image and centered.

Parameters:
  • src – Input image object.

  • kernel – Kernel image object.

Returns:

Output image object.

Notes

The behavior of kernel normalization is controlled by the global configuration option sigima.config.options.auto_normalize_kernel.

sigima.proc.image.mathops.deconvolution(src: ImageObj, kernel: ImageObj) ImageObj[source]

Deconvolve a kernel from an image using Fast Fourier Transform (FFT).

Parameters:
  • src – Input image object.

  • kernel – Kernel image object.

Returns:

Output image object.

Notes

The behavior of kernel normalization is controlled by the global configuration option sigima.config.options.auto_normalize_kernel.

sigima.proc.image.mathops.exp(src: ImageObj) ImageObj[source]

Compute exponential with numpy.exp

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.mathops.imag(src: ImageObj) ImageObj[source]

Compute imaginary part with numpy.imag()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.mathops.inverse(src: ImageObj) ImageObj[source]

Compute the inverse of an image and return the new result image object

Parameters:

src – input image object

Returns:

Result image object 1 / src (new object)

sigima.proc.image.mathops.log10(src: ImageObj) ImageObj[source]

Compute log10 with numpy.log10

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.mathops.log10_z_plus_n(src: ImageObj, p: Log10ZPlusNParam = None, *, n: float = None) ImageObj[source]

Compute log10(z+n) with numpy.log10

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter Log10ZPlusNParam object:

    param = Log10ZPlusNParam.create(n=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.mathops.phase(src: ImageObj, p: PhaseParam = None, *, unwrap: bool = True, unit: Literal['RADIAN', 'DEGREE'] = 'DEGREE') ImageObj[source]

Compute the phase (argument) of a complex image.

The function uses numpy.angle() to compute the argument and numpy.unwrap() to unwrap it.

Args:

src: Input image object. p: Phase parameters.

Returns:

Image object containing the phase, optionally unwrapped.

Note

This computation function can be called in two ways:

  1. With a parameter PhaseParam object:

    param = PhaseParam.create(unwrap=..., unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unwrap=..., unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.mathops.real(src: ImageObj) ImageObj[source]

Compute real part with numpy.real()

Parameters:

src – input image object

Returns:

Output image object

Measurements#

Measurement computation module#

This module provides tools for extracting quantitative information from images, such as object centroids, enclosing circles, and region-based statistics.

Main features include:

  • Centroid and enclosing circle computation

  • Region/property measurements

  • Statistical analysis of image regions

These functions are useful for image quantification and morphometric analysis.

sigima.proc.image.measurement.centroid(image: ImageObj) GeometryResult | None[source]

Compute centroid with sigima.tools.image.get_centroid_fourier()

Parameters:

image – input image

Returns:

Centroid coordinates

sigima.proc.image.measurement.enclosing_circle(image: ImageObj) GeometryResult | None[source]

Compute minimum enclosing circle with sigima.tools.image.get_enclosing_circle()

Parameters:

image – input image

Returns:

Diameter coords

sigima.proc.image.measurement.horizontal_projection(image: ImageObj) SignalObj[source]

Compute the sum of pixel intensities along each col. (projection on the x-axis).

Parameters:

image – Input image object.

Returns:

Signal object containing the profile.

sigima.proc.image.measurement.stats(obj: ImageObj) TableResult[source]

Compute statistics on an image

Parameters:

obj – input image object

Returns:

Result properties

sigima.proc.image.measurement.vertical_projection(image: ImageObj) SignalObj[source]

Compute the sum of pixel intensities along each row (projection on the y-axis).

Parameters:

image – Input image object.

Returns:

Signal object containing the profile.

Extraction#

Extraction computation module#

This module provides functions to extract sub-regions and intensity profiles from images.

Main features include:

  • Extraction of regions of interest (ROIs)

  • Extraction of line, segment, average, and radial intensity profiles

These functions are useful for isolating specific image zones and for analyzing signal intensity along defined paths.

class sigima.proc.image.extraction.AverageProfileParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Average horizontal or vertical profile parameters

class sigima.proc.image.extraction.LineProfileParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Horizontal or vertical profile parameters

class sigima.proc.image.extraction.ROIGridParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

ROI Grid parameters

geometry_changed(item, value) None[source]

Notify host (if any) that geometry changed.

class sigima.proc.image.extraction.RadialProfileParam(*args, **kwargs)[source]

Radial profile parameters

update_from_obj(obj: ImageObj) None[source]

Update parameters from image

choice_callback(item, value)[source]

Callback for choice item

class sigima.proc.image.extraction.SegmentProfileParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Segment profile parameters

sigima.proc.image.extraction.average_profile(src: ImageObj, p: AverageProfileParam = None, *, direction: Literal['horizontal', 'vertical'] = 'horizontal', _hgroup_begin: type = None, row1: int = 0, row2: int = -1, col1: int = 0, col2: int = -1, _hgroup_end: type = None) SignalObj[source]

Compute horizontal or vertical average profile

Args:

src: input image object p: parameters

Returns:

Signal object with the average profile

Note

This computation function can be called in two ways:

  1. With a parameter AverageProfileParam object:

    param = AverageProfileParam.create(direction=..., _hgroup_begin=..., row1=..., row2=..., col1=..., col2=..., _hgroup_end=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, direction=..., _hgroup_begin=..., row1=..., row2=..., col1=..., col2=..., _hgroup_end=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.extraction.extract_roi(src: ImageObj, p: ROI2DParam = None, *, title: str = '', geometry: Literal['rectangle', 'circle', 'polygon'] = 'rectangle', _tlcorner: type = None, x0: float = 0, y0: float = 0, _e_tlcorner: type = None, dx: float = 0, dy: float = 0, _cgroup: type = None, xc: float = 0, yc: float = 0, _e_cgroup: type = None, r: float = 0, points: ndarray = None, inverse: bool = False) ImageObj[source]

Extract single ROI

Args:

src: input image object p: ROI parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ROI2DParam object:

    param = ROI2DParam.create(title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.extraction.extract_rois(src: ImageObj, params: list[ROI2DParam]) ImageObj[source]

Extract multiple regions of interest from data

Parameters:
  • src – input image object

  • params – list of ROI parameters

Returns:

Output image object

sigima.proc.image.extraction.generate_image_grid_roi(src: ImageObj, p: ROIGridParam) ImageROI[source]

Create a grid of rectangular ROIs from an image object.

Parameters:
  • obj – The image object to create the ROI for.

  • p – ROIGridParam object containing the grid parameters.

Returns:

The created ROI object.

sigima.proc.image.extraction.line_profile(src: ImageObj, p: LineProfileParam = None, *, direction: Literal['horizontal', 'vertical'] = 'horizontal', row: int = 0, col: int = 0) SignalObj[source]

Compute horizontal or vertical profile

Args:

src: input image object p: parameters

Returns:

Signal object with the profile

Note

This computation function can be called in two ways:

  1. With a parameter LineProfileParam object:

    param = LineProfileParam.create(direction=..., row=..., col=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, direction=..., row=..., col=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.extraction.radial_profile(src: ImageObj, p: RadialProfileParam = None, *, center: Literal['centroid', 'center', 'user'] = 'centroid', x0: float = 0.0, y0: float = 0.0) SignalObj[source]
Compute radial profile around the centroid

with sigima.tools.image.get_radial_profile()

Args:

src: input image object p: parameters

Returns:

Signal object with the radial profile

Note

This computation function can be called in two ways:

  1. With a parameter RadialProfileParam object:

    param = RadialProfileParam.create(center=..., x0=..., y0=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, center=..., x0=..., y0=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.extraction.segment_profile(src: ImageObj, p: SegmentProfileParam = None, *, row1: int = 0, col1: int = 0, row2: int = 0, col2: int = 0) SignalObj[source]

Compute segment profile

Args:

src: input image object p: parameters

Returns:

Signal object with the segment profile

Note

This computation function can be called in two ways:

  1. With a parameter SegmentProfileParam object:

    param = SegmentProfileParam.create(row1=..., col1=..., row2=..., col2=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, row1=..., col1=..., row2=..., col2=...)
    

Both styles are fully supported and equivalent.

Filtering#

Filtering computation module.#

This module provides spatial and frequency-based filtering operations for images. Filtering functions are essential for enhancing image quality and removing noise.

Main features include:
  • Gaussian, median, moving average and Wiener filters

  • Butterworth and frequency domain Gaussian filters.

Filtering functions are essential for enhancing image quality and removing noise prior to further analysis.

class sigima.proc.image.filtering.ButterworthParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Butterworth filter parameters.

class sigima.proc.image.filtering.GaussianFreqFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Parameters for Gaussian filter applied in the frequency domain.

sigima.proc.image.filtering.butterworth(src: ImageObj, p: ButterworthParam = None, *, cut_off: float = 0.005, high_pass: bool = False, order: int = 2) ImageObj[source]

Compute Butterworth filter with skimage.filters.butterworth().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter ButterworthParam object:

    param = ButterworthParam.create(cut_off=..., high_pass=..., order=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, cut_off=..., high_pass=..., order=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.filtering.gaussian_filter(src: ImageObj, p: GaussianParam = None, *, sigma: float = 1.0) ImageObj[source]

Compute gaussian filter with scipy.ndimage.gaussian_filter().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter GaussianParam object:

    param = GaussianParam.create(sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.filtering.gaussian_freq_filter(src: ImageObj, p: GaussianFreqFilterParam = None, *, sigma: float = 0.5, f0: float = 1.0, ifft_result_type: Literal['real', 'abs'] = 'real') ImageObj[source]

Apply a Gaussian filter in the frequency domain.

Args:

src: Source image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter GaussianFreqFilterParam object:

    param = GaussianFreqFilterParam.create(sigma=..., f0=..., ifft_result_type=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=..., f0=..., ifft_result_type=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.filtering.moving_average(src: ImageObj, p: MovingAverageParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'REFLECT') ImageObj[source]

Compute moving average with scipy.ndimage.uniform_filter().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter MovingAverageParam object:

    param = MovingAverageParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.filtering.moving_median(src: ImageObj, p: MovingMedianParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'NEAREST') ImageObj[source]

Compute moving median with scipy.ndimage.median_filter().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter MovingMedianParam object:

    param = MovingMedianParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.filtering.wiener(src: ImageObj) ImageObj[source]

Compute Wiener filter with scipy.signal.wiener()

Parameters:

src – Input image object.

Returns:

Output image object.

Fourier#

Fourier computation module#

This module implements Fourier transform operations and related spectral analysis tools for images.

Main features include:

  • Forward and inverse Fast Fourier Transform (FFT)

  • Magnitude and phase spectrum calculation

  • Power spectral density (PSD) computation

Fourier analysis is commonly used for frequency-domain filtering and periodicity analysis in images.

sigima.proc.image.fourier.fft(src: ImageObj, p: FFTParam | None = None) ImageObj[source]

Compute FFT with sigima.tools.image.fft2d()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.fourier.ifft(src: ImageObj, p: FFTParam | None = None) ImageObj[source]

Compute inverse FFT with sigima.tools.image.ifft2d()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.fourier.magnitude_spectrum(src: ImageObj, p: SpectrumParam | None = None) ImageObj[source]

Compute magnitude spectrum with sigima.tools.image.magnitude_spectrum()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.fourier.phase_spectrum(src: ImageObj) ImageObj[source]

Compute phase spectrum with sigima.tools.image.phase_spectrum()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.fourier.psd(src: ImageObj, p: SpectrumParam | None = None) ImageObj[source]

Compute power spectral density with sigima.tools.image.psd()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Thresholding#

Threshold computation module#

This module provides various thresholding techniques for image segmentation. Thresholding is a simple yet effective method to separate objects from the background in an image by converting it into a binary image based on a specified threshold value.

class sigima.proc.image.threshold.ThresholdParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Histogram threshold parameters

sigima.proc.image.threshold.threshold(src: ImageObj, p: ThresholdParam = None, *, method: Literal['manual', 'isodata', 'li', 'mean', 'minimum', 'otsu', 'triangle', 'yen'] = 'manual', bins: int = 256, value: float = 0.0, operation: Literal['>', '<'] = '>') ImageObj[source]

Compute the threshold, using one of the available algorithms:

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ThresholdParam object:

    param = ThresholdParam.create(method=..., bins=..., value=..., operation=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., bins=..., value=..., operation=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.threshold.threshold_isodata(src: ImageObj) ImageObj[source]

Compute the threshold using the Isodata algorithm with default parameters, see skimage.filters.threshold_isodata()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold.threshold_li(src: ImageObj) ImageObj[source]

Compute the threshold using the Li algorithm with default parameters, see skimage.filters.threshold_li()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold.threshold_mean(src: ImageObj) ImageObj[source]

Compute the threshold using the Mean algorithm, see skimage.filters.threshold_mean()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold.threshold_minimum(src: ImageObj) ImageObj[source]

Compute the threshold using the Minimum algorithm with default parameters, see skimage.filters.threshold_minimum()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold.threshold_otsu(src: ImageObj) ImageObj[source]

Compute the threshold using the Otsu algorithm with default parameters, see skimage.filters.threshold_otsu()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold.threshold_triangle(src: ImageObj) ImageObj[source]

Compute the threshold using the Triangle algorithm with default parameters, see skimage.filters.threshold_triangle()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold.threshold_yen(src: ImageObj) ImageObj[source]

Compute the threshold using the Yen algorithm with default parameters, see skimage.filters.threshold_yen()

Parameters:

src – input image object

Returns:

Output image object

Exposure correction#

Exposure computation module#

This module provides tools for adjusting and analyzing image exposure and contrast.

Main features include:

  • Histogram computation and equalization

  • Contrast adjustment and normalization

  • Logarithmic and gamma correction

Exposure processing improves the visual quality and interpretability of images, especially under variable lighting conditions.

class sigima.proc.image.exposure.AdjustGammaParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Gamma adjustment parameters

class sigima.proc.image.exposure.AdjustLogParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Logarithmic adjustment parameters

class sigima.proc.image.exposure.AdjustSigmoidParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Sigmoid adjustment parameters

class sigima.proc.image.exposure.EqualizeAdaptHistParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Adaptive histogram equalization parameters

class sigima.proc.image.exposure.EqualizeHistParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Histogram equalization parameters

class sigima.proc.image.exposure.FlatFieldParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Flat-field parameters

class sigima.proc.image.exposure.RescaleIntensityParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Intensity rescaling parameters

sigima.proc.image.exposure.adjust_gamma(src: ImageObj, p: AdjustGammaParam = None, *, gamma: float = 1.0, gain: float = 1.0) ImageObj[source]

Gamma correction with skimage.exposure.adjust_gamma()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter AdjustGammaParam object:

    param = AdjustGammaParam.create(gamma=..., gain=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, gamma=..., gain=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.adjust_log(src: ImageObj, p: AdjustLogParam = None, *, gain: float = 1.0, inv: bool = False) ImageObj[source]

Compute log correction with skimage.exposure.adjust_log()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter AdjustLogParam object:

    param = AdjustLogParam.create(gain=..., inv=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, gain=..., inv=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.adjust_sigmoid(src: ImageObj, p: AdjustSigmoidParam = None, *, cutoff: float = 0.5, gain: float = 10.0, inv: bool = False) ImageObj[source]

Compute sigmoid correction with skimage.exposure.adjust_sigmoid()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter AdjustSigmoidParam object:

    param = AdjustSigmoidParam.create(cutoff=..., gain=..., inv=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, cutoff=..., gain=..., inv=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.clip(src: ImageObj, p: ClipParam = None, *, lower: float = None, upper: float = None) ImageObj[source]

Apply clipping with numpy.clip()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ClipParam object:

    param = ClipParam.create(lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, lower=..., upper=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.equalize_adapthist(src: ImageObj, p: EqualizeAdaptHistParam = None, *, nbins: int = 256, clip_limit: float = 0.01) ImageObj[source]
Adaptive histogram equalization

with skimage.exposure.equalize_adapthist()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter EqualizeAdaptHistParam object:

    param = EqualizeAdaptHistParam.create(nbins=..., clip_limit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, nbins=..., clip_limit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.equalize_hist(src: ImageObj, p: EqualizeHistParam = None, *, nbins: int = 256) ImageObj[source]

Histogram equalization with skimage.exposure.equalize_hist()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter EqualizeHistParam object:

    param = EqualizeHistParam.create(nbins=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, nbins=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.flatfield(src1: ImageObj, src2: ImageObj, p: FlatFieldParam = None, *, threshold: float = 0.0) ImageObj[source]

Compute flat field correction with sigima.tools.image.flatfield()

Args:

src1: raw data image object src2: flat field image object p: flat field parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter FlatFieldParam object:

    param = FlatFieldParam.create(threshold=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, threshold=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.histogram(src: ImageObj, p: HistogramParam = None, *, bins: int = 256, lower: float = None, upper: float = None) SignalObj[source]

Compute histogram of the image data, with numpy.histogram()

Args:

src: input image object p: parameters

Returns:

Signal object with the histogram

Note

This computation function can be called in two ways:

  1. With a parameter HistogramParam object:

    param = HistogramParam.create(bins=..., lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, bins=..., lower=..., upper=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.normalize(src: ImageObj, p: NormalizeParam = None, *, method: Literal['MAXIMUM', 'AMPLITUDE', 'AREA', 'ENERGY', 'RMS'] = 'MAXIMUM') ImageObj[source]

Normalize image data depending on its maximum, with sigima.tools.image.normalize()

Args:

src: input image object

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter NormalizeParam object:

    param = NormalizeParam.create(method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.offset_correction(src: ImageObj, p: ROI2DParam = None, *, title: str = '', geometry: Literal['rectangle', 'circle', 'polygon'] = 'rectangle', _tlcorner: type = None, x0: float = 0, y0: float = 0, _e_tlcorner: type = None, dx: float = 0, dy: float = 0, _cgroup: type = None, xc: float = 0, yc: float = 0, _e_cgroup: type = None, r: float = 0, points: ndarray = None, inverse: bool = False) ImageObj[source]

Apply offset correction

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ROI2DParam object:

    param = ROI2DParam.create(title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exposure.rescale_intensity(src: ImageObj, p: RescaleIntensityParam = None, *, in_range: Literal['image', 'dtype', 'float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'image', out_range: Literal['image', 'dtype', 'float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'dtype') ImageObj[source]
Rescale image intensity levels

with skimage.exposure.rescale_intensity()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter RescaleIntensityParam object:

    param = RescaleIntensityParam.create(in_range=..., out_range=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, in_range=..., out_range=...)
    

Both styles are fully supported and equivalent.

Preprocessing#

Image preprocessing functions.

This module consolidates preprocessing functions that were previously scattered across different modules (exposure, geometry, fourier). All functions in this module operate on high-level ImageObj objects and use parameter classes from the sigima.proc framework.

class sigima.proc.image.preprocessing.BinningParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Binning parameters.

class sigima.proc.image.preprocessing.ZeroPadding2DParam(*args, **kwargs)[source]

Zero padding parameters for 2D images

update_from_obj(obj: ImageObj) None[source]

Update parameters from image

choice_callback(item, value)[source]

Callback to update padding values

sigima.proc.image.preprocessing.binning(src: ImageObj, p: BinningParam = None, *, sx: int = 2, sy: int = 2, operation: Literal['SUM', 'AVERAGE', 'MEDIAN', 'MIN', 'MAX'] = 'SUM', dtype_str: Literal['dtype', 'float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'dtype', change_pixel_size: bool = True) ImageObj[source]

Binning: image pixel binning (or aggregation).

Depending on the algorithm, the input image may be cropped to fit an integer number of blocks.

Args:

src: source image p: parameters

Returns:

Output image

Raises:

ValueError: if source image has non-uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter BinningParam object:

    param = BinningParam.create(sx=..., sy=..., operation=..., dtype_str=..., change_pixel_size=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sx=..., sy=..., operation=..., dtype_str=..., change_pixel_size=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.preprocessing.zero_padding(src: ImageObj, p: ZeroPadding2DParam | None = None) ImageObj[source]

Zero-padding: add zeros to image borders.

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Restoration#

Restoration computation module#

This module provides image restoration techniques, such as denoising, inpainting, and deblurring. These methods aim to recover the original quality of images by removing artifacts, noise, or distortions.

class sigima.proc.image.restoration.DenoiseBilateralParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Bilateral filter denoising parameters

class sigima.proc.image.restoration.DenoiseTVParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Total Variation denoising parameters

class sigima.proc.image.restoration.DenoiseWaveletParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Wavelet denoising parameters

sigima.proc.image.restoration.denoise_bilateral(src: ImageObj, p: DenoiseBilateralParam = None, *, sigma_spatial: float = 1.0, mode: Literal['CONSTANT', 'EDGE', 'SYMMETRIC', 'REFLECT', 'WRAP'] = 'CONSTANT', cval: float = 0.0) ImageObj[source]
Compute bilateral filter denoising

with skimage.restoration.denoise_bilateral()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DenoiseBilateralParam object:

    param = DenoiseBilateralParam.create(sigma_spatial=..., mode=..., cval=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma_spatial=..., mode=..., cval=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.restoration.denoise_tophat(src: ImageObj, p: sigima.params.MorphologyParam) ImageObj[source]

Denoise using White Top-Hat with skimage.morphology.white_tophat()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.restoration.denoise_tv(src: ImageObj, p: DenoiseTVParam = None, *, weight: float = 0.1, eps: float = 0.0002, max_num_iter: int = 200) ImageObj[source]
Compute Total Variation denoising

with skimage.restoration.denoise_tv_chambolle()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DenoiseTVParam object:

    param = DenoiseTVParam.create(weight=..., eps=..., max_num_iter=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, weight=..., eps=..., max_num_iter=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.restoration.denoise_wavelet(src: ImageObj, p: DenoiseWaveletParam = None, *, wavelet: Literal['bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6', 'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9', 'bior4.4', 'bior5.5', 'bior6.8', 'cgau1', 'cgau2', 'cgau3', 'cgau4', 'cgau5', 'cgau6', 'cgau7', 'cgau8', 'cmor', 'coif1', 'coif2', 'coif3', 'coif4', 'coif5', 'coif6', 'coif7', 'coif8', 'coif9', 'coif10', 'coif11', 'coif12', 'coif13', 'coif14', 'coif15', 'coif16', 'coif17', 'db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8', 'db9', 'db10', 'db11', 'db12', 'db13', 'db14', 'db15', 'db16', 'db17', 'db18', 'db19', 'db20', 'db21', 'db22', 'db23', 'db24', 'db25', 'db26', 'db27', 'db28', 'db29', 'db30', 'db31', 'db32', 'db33', 'db34', 'db35', 'db36', 'db37', 'db38', 'dmey', 'fbsp', 'gaus1', 'gaus2', 'gaus3', 'gaus4', 'gaus5', 'gaus6', 'gaus7', 'gaus8', 'haar', 'mexh', 'morl', 'rbio1.1', 'rbio1.3', 'rbio1.5', 'rbio2.2', 'rbio2.4', 'rbio2.6', 'rbio2.8', 'rbio3.1', 'rbio3.3', 'rbio3.5', 'rbio3.7', 'rbio3.9', 'rbio4.4', 'rbio5.5', 'rbio6.8', 'shan', 'sym2', 'sym3', 'sym4', 'sym5', 'sym6', 'sym7', 'sym8', 'sym9', 'sym10', 'sym11', 'sym12', 'sym13', 'sym14', 'sym15', 'sym16', 'sym17', 'sym18', 'sym19', 'sym20'] = 'sym9', mode: Literal['SOFT', 'HARD'] = 'SOFT', method: Literal['BAYES_SHRINK', 'VISU_SHRINK'] = 'VISU_SHRINK') ImageObj[source]
Compute Wavelet denoising

with skimage.restoration.denoise_wavelet()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DenoiseWaveletParam object:

    param = DenoiseWaveletParam.create(wavelet=..., mode=..., method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, wavelet=..., mode=..., method=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.restoration.erase(src: ImageObj, p: ROI2DParam | list[ROI2DParam]) ImageObj[source]

Erase an area of the image using the mean value of the image.

Note

The erased area is defined by a region of interest (ROI) parameter set. This ROI must not be mistaken with the ROI of the image object. If the image object has a ROI, it is not used in this processing, except to restore the data outside the ROI (as in all other processing).

Parameters:
  • src – input image object

  • p – parameters defining the area to erase (region of interest)

Returns:

Output image object

Noise#

Noise addition computation module.#

sigima.proc.image.noise.add_gaussian_noise(src: ImageObj, p: NormalDistributionParam = None, *, seed: int = 1, mu: float = 0.1, sigma: float = 0.02) ImageObj[source]

Add Gaussian (normal) noise to the input image.

Args:

src: Source image. p: Parameters.

Returns:

Result image object.

Note

This computation function can be called in two ways:

  1. With a parameter NormalDistributionParam object:

    param = NormalDistributionParam.create(seed=..., mu=..., sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., mu=..., sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.noise.add_poisson_noise(src: ImageObj, p: PoissonDistributionParam = None, *, seed: int = 1, lam: float = 0.1) ImageObj[source]

Add Poisson noise to the input image.

Args:

src: Source image. p: Parameters.

Returns:

Result image object.

Note

This computation function can be called in two ways:

  1. With a parameter PoissonDistributionParam object:

    param = PoissonDistributionParam.create(seed=..., lam=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., lam=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.noise.add_uniform_noise(src: ImageObj, p: UniformDistributionParam = None, *, seed: int = 1, vmin: float = -0.5, vmax: float = 0.5) ImageObj[source]

Add uniform noise to the input image.

Args:

src: Source image. p: Parameters.

Returns:

Result image object.

Note

This computation function can be called in two ways:

  1. With a parameter UniformDistributionParam object:

    param = UniformDistributionParam.create(seed=..., vmin=..., vmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., vmin=..., vmax=...)
    

Both styles are fully supported and equivalent.

Morphology#

Morphology computation module#

This module provides morphological operations for image processing, such as dilation, erosion, opening, and closing. These operations are useful for removing noise, filling gaps, and extracting structures in binary and grayscale images.

class sigima.proc.image.morphology.MorphologyParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

White Top-Hat parameters

sigima.proc.image.morphology.black_tophat(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]

Compute Black Top-Hat with skimage.morphology.black_tophat()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.morphology.closing(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]

Compute morphological closing with skimage.morphology.closing()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.morphology.dilation(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]

Compute Dilation with skimage.morphology.dilation()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.morphology.erosion(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]

Compute Erosion with skimage.morphology.erosion()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.morphology.opening(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]

Compute morphological opening with skimage.morphology.opening()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.morphology.white_tophat(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]

Compute White Top-Hat with skimage.morphology.white_tophat()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

Edge detection#

Edge detection computation module.#

This module implements edge detection computation functions, enabling the identification of boundaries in an image. Edge detection may be used for image segmentation, shape analysis, and feature extraction. Methods rely on detection of significant transitions in pixel intensity.

Available filters (in alphabetical order):
  • canny: Canny edge detector

  • farid: Farid filter

  • farid_h: Horizontal Farid filter

  • farid_v: Vertical Farid filter

  • laplace: Laplace filter

  • prewitt: Prewitt filter

  • prewitt_h: Horizontal Prewitt filter

  • prewitt_v: Vertical Prewitt filter

  • roberts: Roberts filter

  • scharr: Scharr filter

  • scharr_h: Horizontal Scharr filter

  • scharr_v: Vertical Scharr filter

  • sobel: Sobel filter

  • sobel_h: Horizontal Sobel filter

  • sobel_v: Vertical Sobel filter

class sigima.proc.image.edges.CannyParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Canny filter parameters.

sigima.proc.image.edges.canny(src: ImageObj, p: CannyParam = None, *, sigma: float = 1.0, low_threshold: float = 0.1, high_threshold: float = 0.9, use_quantiles: bool = True, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'CONSTANT', cval: float = 0.0) ImageObj[source]

Compute Canny filter with skimage.feature.canny().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter CannyParam object:

    param = CannyParam.create(sigma=..., low_threshold=..., high_threshold=..., use_quantiles=..., mode=..., cval=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=..., low_threshold=..., high_threshold=..., use_quantiles=..., mode=..., cval=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.edges.farid(src: ImageObj) ImageObj[source]

Compute Farid filter with skimage.filters.farid().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.farid_h(src: ImageObj) ImageObj[source]

Compute horizontal Farid filter with skimage.filters.farid_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.farid_v(src: ImageObj) ImageObj[source]

Compute vertical Farid filter with skimage.filters.farid_v().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.laplace(src: ImageObj) ImageObj[source]

Compute Laplace filter with skimage.filters.laplace().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.prewitt(src: ImageObj) ImageObj[source]

Compute Prewitt filter with skimage.filters.prewitt().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.prewitt_h(src: ImageObj) ImageObj[source]

Compute horizontal Prewitt filter with skimage.filters.prewitt_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.prewitt_v(src: ImageObj) ImageObj[source]

Compute vertical Prewitt filter with skimage.filters.prewitt_v().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.roberts(src: ImageObj) ImageObj[source]

Compute Roberts filter with skimage.filters.roberts().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.scharr(src: ImageObj) ImageObj[source]

Compute Scharr filter with skimage.filters.scharr().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.scharr_h(src: ImageObj) ImageObj[source]

Compute horizontal Scharr filter with skimage.filters.scharr_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.scharr_v(src: ImageObj) ImageObj[source]

Compute vertical Scharr filter with skimage.filters.scharr_v().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.sobel(src: ImageObj) ImageObj[source]

Compute Sobel filter with skimage.filters.sobel().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.sobel_h(src: ImageObj) ImageObj[source]

Compute horizontal Sobel filter with skimage.filters.sobel_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.edges.sobel_v(src: ImageObj) ImageObj[source]

Compute vertical Sobel filter with skimage.filters.sobel_v().

Parameters:

src – Input image object.

Returns:

Output image object.

Detection#

Detection computation module#

This module provides algorithms for detecting objects or patterns in images, such as blobs, peaks, or custom structures.

Main features include:

  • Blob and peak detection algorithms

  • Support for object localization and counting

Detection algorithms are fundamental for many image analysis pipelines, enabling automated extraction of regions or features of interest.

class sigima.proc.image.detection.BaseBlobParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Base class for blob detection parameters

class sigima.proc.image.detection.BlobDOGParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Blob detection using Difference of Gaussian method

class sigima.proc.image.detection.BlobDOHParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Blob detection using Determinant of Hessian method

class sigima.proc.image.detection.BlobLOGParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Blob detection using Laplacian of Gaussian method

class sigima.proc.image.detection.BlobOpenCVParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Blob detection using OpenCV

class sigima.proc.image.detection.ContourShapeParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Contour shape parameters

class sigima.proc.image.detection.DetectionROIParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

ROI creation parameters for detection algorithms.

This class can be inherited by any detection parameter class to provide standardized ROI creation functionality.

class sigima.proc.image.detection.GenericDetectionParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Generic detection parameters

class sigima.proc.image.detection.HoughCircleParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Circle Hough transform parameters

class sigima.proc.image.detection.Peak2DDetectionParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Peak detection parameters

sigima.proc.image.detection.apply_detection_rois(obj: ImageObj, geometry: GeometryResult, force: bool = False, roi_geometry: DetectionROIGeometry | None = None) bool[source]

Apply ROI creation from detection geometry result.

This function checks if the geometry result contains ROI creation metadata and applies it to the image object by creating ROIs around detected features.

Parameters:
  • obj – Image object to modify

  • geometry – Geometry result from a detection function

  • force – If True, create ROIs even if not requested in the result attrs

  • roi_geometry – Override ROI geometry from attrs (if None, uses attrs value)

Returns:

True if ROIs were created, False otherwise

Example

>>> from sigima.proc.image import peak_detection, apply_detection_rois
>>> from sigima.params import Peak2DDetectionParam
>>> param = Peak2DDetectionParam()
>>> param.create_rois = True
>>> geometry = peak_detection(img, param)
>>> apply_detection_rois(img, geometry)  # Creates ROIs on img
sigima.proc.image.detection.blob_dog(image: ImageObj, p: BlobDOGParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_sigma: float = 10.0, max_sigma: float = 30.0, threshold_rel: float = 0.2, overlap: float = 0.5, exclude_border: bool = True) GeometryResult | None[source]
Compute blobs using Difference of Gaussian method

with sigima.tools.image.find_blobs_dog()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobDOGParam object:

    param = BlobDOGParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., exclude_border=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., exclude_border=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.detection.blob_doh(image: ImageObj, p: BlobDOHParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_sigma: float = 10.0, max_sigma: float = 30.0, threshold_rel: float = 0.2, overlap: float = 0.5, log_scale: bool = False) GeometryResult | None[source]
Compute blobs using Determinant of Hessian method

with sigima.tools.image.find_blobs_doh()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobDOHParam object:

    param = BlobDOHParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., log_scale=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., log_scale=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.detection.blob_log(image: ImageObj, p: BlobLOGParam = None, *, min_sigma: float = 10.0, max_sigma: float = 30.0, threshold_rel: float = 0.2, overlap: float = 0.5, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, log_scale: bool = False, exclude_border: bool = True) GeometryResult | None[source]
Compute blobs using Laplacian of Gaussian method

with sigima.tools.image.find_blobs_log()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobLOGParam object:

    param = BlobLOGParam.create(min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., log_scale=..., exclude_border=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., log_scale=..., exclude_border=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.detection.blob_opencv(image: ImageObj, p: BlobOpenCVParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_threshold: float = 10.0, max_threshold: float = 200.0, min_repeatability: int = 2, min_dist_between_blobs: float = 10.0, filter_by_color: bool = True, blob_color: int = 0, filter_by_area: bool = True, min_area: float = 25.0, max_area: float = 500.0, filter_by_circularity: bool = False, min_circularity: float = 0.8, max_circularity: float = 1.0, filter_by_inertia: bool = False, min_inertia_ratio: float = 0.6, max_inertia_ratio: float = 1.0, filter_by_convexity: bool = False, min_convexity: float = 0.8, max_convexity: float = 1.0) GeometryResult | None[source]
Compute blobs using OpenCV

with sigima.tools.image.find_blobs_opencv()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobOpenCVParam object:

    param = BlobOpenCVParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_threshold=..., max_threshold=..., min_repeatability=..., min_dist_between_blobs=..., filter_by_color=..., blob_color=..., filter_by_area=..., min_area=..., max_area=..., filter_by_circularity=..., min_circularity=..., max_circularity=..., filter_by_inertia=..., min_inertia_ratio=..., max_inertia_ratio=..., filter_by_convexity=..., min_convexity=..., max_convexity=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_threshold=..., max_threshold=..., min_repeatability=..., min_dist_between_blobs=..., filter_by_color=..., blob_color=..., filter_by_area=..., min_area=..., max_area=..., filter_by_circularity=..., min_circularity=..., max_circularity=..., filter_by_inertia=..., min_inertia_ratio=..., max_inertia_ratio=..., filter_by_convexity=..., min_convexity=..., max_convexity=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.detection.contour_shape(image: ImageObj, p: ContourShapeParam = None, *, threshold: float = 0.5, shape: Literal['ELLIPSE', 'CIRCLE', 'POLYGON'] = 'ELLIPSE') GeometryResult | None[source]

Compute contour shape with sigima.tools.image.get_contour_shapes(). .. note:

This computation function can be called in two ways:

1. With a parameter ``ContourShapeParam`` object:

   .. code-block:: python

      param = ContourShapeParam.create(threshold=..., shape=...)
      func(obj, param)

2. Or, with keyword arguments directly:

   .. code-block:: python

      func(obj, threshold=..., shape=...)

Both styles are fully supported and equivalent.
sigima.proc.image.detection.hough_circle_peaks(image: ImageObj, p: HoughCircleParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_radius: int = None, max_radius: int = None, min_distance: int = None) GeometryResult | None[source]
Compute Hough circles

with sigima.tools.image.get_hough_circle_peaks()

Args:

image: input image p: parameters

Returns:

Circle coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter HoughCircleParam object:

    param = HoughCircleParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_radius=..., max_radius=..., min_distance=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_radius=..., max_radius=..., min_distance=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.detection.peak_detection(obj: ImageObj, p: Peak2DDetectionParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, threshold: float = 0.5, size: int = None) GeometryResult | None[source]
Compute 2D peak detection

with sigima.tools.image.get_2d_peaks_coords()

Args:

obj: input image p: parameters

Returns:

Peak coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter Peak2DDetectionParam object:

    param = Peak2DDetectionParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., threshold=..., size=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., threshold=..., size=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.detection.store_roi_creation_metadata(geometry: GeometryResult | None, create_rois: bool, roi_geometry: DetectionROIGeometry | None = None) GeometryResult | None[source]

Store ROI creation metadata in geometry result attributes.

This function is called by computation functions to mark that ROI creation should be performed on the result. The actual ROI creation is done later via apply_detection_rois().

Parameters:
  • geometry – Geometry result from detection

  • create_rois – Whether to create ROIs

  • roi_geometry – ROI geometry type (if None, uses default RECTANGLE)

Returns:

The same geometry object (for chaining), or None if geometry is None

Example

>>> geometry = compute_geometry_from_obj(...)
>>> return store_roi_creation_metadata(geometry, p.create_rois, p.roi_geometry)

Geometry#

Geometry computation module#

This module implements geometric transformations and manipulations for images, such as rotations, flips, resizing, axis swapping, binning, and padding.

Main features include:

  • Rotation by arbitrary or fixed angles

  • Horizontal and vertical flipping

  • Resizing and binning of images

  • Axis swapping and zero padding

These functions are useful for preparing and augmenting image data.

class sigima.proc.image.geometry.Resampling2DParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Resample parameters for 2D images

update_from_obj(obj: ImageObj) None[source]

Update parameters from an image object.

class sigima.proc.image.geometry.ResizeParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Resize parameters

class sigima.proc.image.geometry.RotateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Rotate parameters

class sigima.proc.image.geometry.TranslateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Translate parameters

class sigima.proc.image.geometry.UniformCoordsParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Uniform coordinates parameters

update_from_obj(obj: ImageObj) None[source]

Update default values from image object’s non-uniform coordinates.

This method extracts uniform coordinate approximations from non-uniform coordinate arrays, handling numerical precision issues that may arise from arrays created using linspace.

Parameters:

obj – Image object with non-uniform coordinates

class sigima.proc.image.geometry.XYZCalibrateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]

Image polynomial calibration parameters

sigima.proc.image.geometry.calibration(src: ImageObj, p: XYZCalibrateParam = None, *, axis: Literal['x', 'y', 'z'] = 'z', a0: float = 0.0, a1: float = 1.0, a2: float = 0.0, a3: float = 0.0) ImageObj[source]

Compute polynomial calibration

Applies polynomial transformation: dst = a0 + a1*src + a2*src² + a3*src³

Args:

src: input image object p: calibration parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter XYZCalibrateParam object:

    param = XYZCalibrateParam.create(axis=..., a0=..., a1=..., a2=..., a3=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, axis=..., a0=..., a1=..., a2=..., a3=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.geometry.fliph(src: ImageObj) ImageObj[source]

Flip data horizontally with numpy.fliplr()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.geometry.flipv(src: ImageObj) ImageObj[source]

Flip data vertically with numpy.flipud()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.geometry.resampling(src: ImageObj, p: Resampling2DParam = None, *, xmin: float = None, xmax: float = None, ymin: float = None, ymax: float = None, mode: Literal['dxy', 'shape'] = 'shape', dx: float = None, dy: float = None, width: int = None, height: int = None, method: Literal['NEAREST', 'LINEAR', 'CUBIC'] = 'LINEAR', fill_value: float = None) ImageObj[source]

Resample image to new coordinate grid using interpolation

Args:

src: source image p: resampling parameters

Returns:

Resampled image object

Raises:

ValueError: if source image has non-uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter Resampling2DParam object:

    param = Resampling2DParam.create(xmin=..., xmax=..., ymin=..., ymax=..., mode=..., dx=..., dy=..., width=..., height=..., method=..., fill_value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, xmin=..., xmax=..., ymin=..., ymax=..., mode=..., dx=..., dy=..., width=..., height=..., method=..., fill_value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.geometry.resize(src: ImageObj, p: ResizeParam = None, *, zoom: float = 1.0, mode: Literal['CONSTANT', 'NEAREST', 'REFLECT', 'WRAP', 'MIRROR'] = 'CONSTANT', cval: float = 0.0, prefilter: bool = True, order: int = 3) ImageObj[source]

Zooming function with scipy.ndimage.zoom()

Args:

src: input image object p: parameters

Returns:

Output image object

Raises:

ValueError: if source image has non-uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter ResizeParam object:

    param = ResizeParam.create(zoom=..., mode=..., cval=..., prefilter=..., order=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, zoom=..., mode=..., cval=..., prefilter=..., order=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.geometry.rotate(src: ImageObj, p: RotateParam = None, *, angle: float = 0.0, mode: Literal['CONSTANT', 'NEAREST', 'REFLECT', 'WRAP', 'MIRROR'] = 'CONSTANT', cval: float = 0.0, reshape: bool = False, prefilter: bool = True, order: int = 3) ImageObj[source]

Rotate data with scipy.ndimage.rotate()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter RotateParam object:

    param = RotateParam.create(angle=..., mode=..., cval=..., reshape=..., prefilter=..., order=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, angle=..., mode=..., cval=..., reshape=..., prefilter=..., order=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.geometry.rotate90(src: ImageObj) ImageObj[source]

Rotate data 90° with numpy.rot90()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.geometry.rotate270(src: ImageObj) ImageObj[source]

Rotate data 270° with numpy.rot90()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.geometry.set_uniform_coords(src: ImageObj, p: UniformCoordsParam = None, *, x0: float = 0.0, y0: float = 0.0, dx: float = 1.0, dy: float = 1.0) ImageObj[source]

Convert image to uniform coordinate system

Args:

src: input image object p: uniform coordinates parameters

Returns:

Output image object with uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter UniformCoordsParam object:

    param = UniformCoordsParam.create(x0=..., y0=..., dx=..., dy=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, x0=..., y0=..., dx=..., dy=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.geometry.translate(src: ImageObj, p: TranslateParam = None, *, dx: float = 0.0, dy: float = 0.0) ImageObj[source]

Translate data with scipy.ndimage.shift()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter TranslateParam object:

    param = TranslateParam.create(dx=..., dy=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, dx=..., dy=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.geometry.transpose(src: ImageObj) ImageObj[source]

Transpose image with numpy.transpose().

Parameters:

src – Input image object.

Returns:

Output image object.

Transformation features#

Geometry transformations module#

This module provides a unified interface for applying geometric transformations to both geometry results (sigima.objects.GeometryResult) and ROI objects using the shape coordinate system (sigima.objects.shape).

class sigima.proc.image.transformations.GeometryTransformer[source]

Singleton class for applying transformations to geometry objects.

Provides a unified interface for transforming both GeometryResult and ROI objects using the shape coordinate system.

transform_geometry(geometry: GeometryResult, operation: str, **kwargs: Any) GeometryResult[source]

Transform a GeometryResult and return a new one.

Parameters:
  • geometry – The GeometryResult to transform.

  • operation – Operation name (‘rotate’, ‘translate’, ‘fliph’, ‘flipv’, ‘transpose’, ‘scale’).

  • **kwargs – Operation-specific parameters.

Returns:

New GeometryResult with transformed coordinates.

Raises:

ValueError – If operation is unknown or geometry kind is unsupported.

transform_single_roi(single_roi: RectangularROI | CircularROI | PolygonalROI, operation: str, **kwargs: Any) None[source]

Transform ROI coordinates inplace.

Parameters:
  • single_roi – ROI object with .coords attribute.

  • operation – Operation name.

  • **kwargs – Operation-specific parameters.

Raises:

ValueError – If ROI type is unsupported or operation is unknown.

transform_roi(image: ImageObj, operation: str, **kwargs: Any) None[source]

Transform all ROI coordinates in an ImageObj inplace.

Parameters:
  • image – Image object whose ROI coordinates will be transformed.

  • operation – Operation name.

  • **kwargs – Operation-specific parameters.

rotate(obj: GeometryResult | RectangularROI | CircularROI | PolygonalROI, angle: float, center: tuple[float, float]) GeometryResult | None[source]

Rotate geometry or ROI by given angle around center.

Parameters:
  • obj – GeometryResult or single ROI object.

  • angle – Rotation angle in radians.

  • center – Center of rotation (x, y).

Returns:

New GeometryResult if input was GeometryResult, None if ROI (inplace).

translate(obj: GeometryResult | RectangularROI | CircularROI | PolygonalROI, dx: float, dy: float) GeometryResult | None[source]

Translate geometry or ROI by given offset.

Parameters:
  • obj – GeometryResult or single ROI object.

  • dx – Translation in x direction.

  • dy – Translation in y direction.

Returns:

New GeometryResult if input was GeometryResult, None if ROI (inplace).

fliph(obj: GeometryResult | RectangularROI | CircularROI | PolygonalROI, cx: float) GeometryResult | None[source]

Flip geometry or ROI horizontally around given x-coordinate.

Parameters:
  • obj – GeometryResult or single ROI object.

  • cx – X-coordinate of flip axis.

Returns:

New GeometryResult if input was GeometryResult, None if ROI (inplace).

flipv(obj: GeometryResult | RectangularROI | CircularROI | PolygonalROI, cy: float) GeometryResult | None[source]

Flip geometry or ROI vertically around given y-coordinate.

Parameters:
  • obj – GeometryResult or single ROI object.

  • cy – Y-coordinate of flip axis.

Returns:

New GeometryResult if input was GeometryResult, None if ROI (inplace).

transpose(obj: GeometryResult | RectangularROI | CircularROI | PolygonalROI) GeometryResult | None[source]

Transpose geometry or ROI (swap x and y coordinates).

Parameters:

obj – GeometryResult or single ROI object.

Returns:

New GeometryResult if input was GeometryResult, None if ROI (inplace).

scale(obj: GeometryResult | RectangularROI | CircularROI | PolygonalROI, sx: float, sy: float, center: tuple[float, float]) GeometryResult | None[source]

Scale geometry or ROI by given factors around center.

Parameters:
  • obj – GeometryResult or single ROI object.

  • sx – Scale factor in x direction.

  • sy – Scale factor in y direction.

  • center – Center of scaling (x, y).

Returns:

New GeometryResult if input was GeometryResult, None if ROI (inplace).

sigima.proc.image.transformations.transformer = <sigima.proc.image.transformations.GeometryTransformer object>

Global singleton instance of GeometryTransformer for applying geometric transformations to geometry results and ROI objects.

class sigima.proc.image.AdjustGammaParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Gamma adjustment parameters

class sigima.proc.image.AdjustLogParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Logarithmic adjustment parameters

class sigima.proc.image.AdjustSigmoidParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Sigmoid adjustment parameters

class sigima.proc.image.AverageProfileParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Average horizontal or vertical profile parameters

class sigima.proc.image.BinningParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Binning parameters.

class sigima.proc.image.BlobDOGParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Blob detection using Difference of Gaussian method

class sigima.proc.image.BlobDOHParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Blob detection using Determinant of Hessian method

class sigima.proc.image.BlobLOGParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Blob detection using Laplacian of Gaussian method

class sigima.proc.image.BlobOpenCVParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Blob detection using OpenCV

class sigima.proc.image.ButterworthParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Butterworth filter parameters.

class sigima.proc.image.CannyParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Canny filter parameters.

class sigima.proc.image.ContourShapeParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Contour shape parameters

class sigima.proc.image.DataTypeIParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Convert image data type parameters

class sigima.proc.image.DenoiseBilateralParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Bilateral filter denoising parameters

class sigima.proc.image.DenoiseTVParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Total Variation denoising parameters

class sigima.proc.image.DenoiseWaveletParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Wavelet denoising parameters

class sigima.proc.image.Direction(value)[source]#

Direction choice

class sigima.proc.image.EqualizeAdaptHistParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Adaptive histogram equalization parameters

class sigima.proc.image.EqualizeHistParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Histogram equalization parameters

class sigima.proc.image.FlatFieldParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Flat-field parameters

class sigima.proc.image.GaussianFreqFilterParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Parameters for Gaussian filter applied in the frequency domain.

class sigima.proc.image.GridParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Grid parameters

class sigima.proc.image.HoughCircleParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Circle Hough transform parameters

class sigima.proc.image.LineProfileParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Horizontal or vertical profile parameters

class sigima.proc.image.Log10ZPlusNParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Log10(z+n) parameters

class sigima.proc.image.MorphologyParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

White Top-Hat parameters

class sigima.proc.image.NormalizeParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Normalize parameters

class sigima.proc.image.PadLocation2D(value)[source]#

Padding location for 2D image processing.

class sigima.proc.image.Peak2DDetectionParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Peak detection parameters

class sigima.proc.image.ROIGridParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

ROI Grid parameters

geometry_changed(item, value) None[source]#

Notify host (if any) that geometry changed.

class sigima.proc.image.RadialProfileParam(*args, **kwargs)[source]#

Radial profile parameters

update_from_obj(obj: ImageObj) None[source]#

Update parameters from image

choice_callback(item, value)[source]#

Callback for choice item

class sigima.proc.image.Resampling2DParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Resample parameters for 2D images

update_from_obj(obj: ImageObj) None[source]#

Update parameters from an image object.

class sigima.proc.image.RescaleIntensityParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Intensity rescaling parameters

class sigima.proc.image.ResizeParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Resize parameters

class sigima.proc.image.RotateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Rotate parameters

class sigima.proc.image.SegmentProfileParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Segment profile parameters

class sigima.proc.image.ThresholdParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Histogram threshold parameters

class sigima.proc.image.TranslateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Translate parameters

class sigima.proc.image.UniformCoordsParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Uniform coordinates parameters

update_from_obj(obj: ImageObj) None[source]#

Update default values from image object’s non-uniform coordinates.

This method extracts uniform coordinate approximations from non-uniform coordinate arrays, handling numerical precision issues that may arise from arrays created using linspace.

Parameters:

obj – Image object with non-uniform coordinates

class sigima.proc.image.Wrap1to1Func(func: Callable, *args: Any, **kwargs: Any)[source]#

Wrap a 1 array → 1 array function to produce a 1 image → 1 image function, which can be used as a Sigima computation function and inside DataLab’s infrastructure to perform computations with the Image Processor object.

This wrapping mechanism using a class is necessary for the resulted function to be pickable by the multiprocessing module.

The instance of this wrapper is callable and returns a sigima.objects.ImageObj object.

Example

>>> import numpy as np
>>> from sigima.proc.image import Wrap1to1Func
>>> import sigima.objects
>>> def add_noise(data):
...     return data + np.random.random(data.shape)
>>> compute_add_noise = Wrap1to1Func(add_noise)
>>> data= np.ones((100, 100))
>>> ima0 = sigima.objects.create_image("Example", data)
>>> ima1 = compute_add_noise(ima0)
Parameters:
  • func – 1 array → 1 array function

  • *args – Additional positional arguments to pass to the function

  • **kwargs – Additional keyword arguments to pass to the function

Note

If func_name is provided in the keyword arguments, it will be used as the function name instead of the default name derived from the function itself.

class sigima.proc.image.XYZCalibrateParam(title: str | None = None, comment: str | None = None, icon: str = '', readonly: bool = False, skip_defaults: bool = False)[source]#

Image polynomial calibration parameters

class sigima.proc.image.ZeroPadding2DParam(*args, **kwargs)[source]#

Zero padding parameters for 2D images

update_from_obj(obj: ImageObj) None[source]#

Update parameters from image

choice_callback(item, value)[source]#

Callback to update padding values

sigima.proc.image.absolute(src: ImageObj) ImageObj[source]#

Compute absolute value with numpy.absolute

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.add_gaussian_noise(src: ImageObj, p: NormalDistributionParam = None, *, seed: int = 1, mu: float = 0.1, sigma: float = 0.02) ImageObj[source]#

Add Gaussian (normal) noise to the input image.

Args:

src: Source image. p: Parameters.

Returns:

Result image object.

Note

This computation function can be called in two ways:

  1. With a parameter NormalDistributionParam object:

    param = NormalDistributionParam.create(seed=..., mu=..., sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., mu=..., sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.add_poisson_noise(src: ImageObj, p: PoissonDistributionParam = None, *, seed: int = 1, lam: float = 0.1) ImageObj[source]#

Add Poisson noise to the input image.

Args:

src: Source image. p: Parameters.

Returns:

Result image object.

Note

This computation function can be called in two ways:

  1. With a parameter PoissonDistributionParam object:

    param = PoissonDistributionParam.create(seed=..., lam=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., lam=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.add_uniform_noise(src: ImageObj, p: UniformDistributionParam = None, *, seed: int = 1, vmin: float = -0.5, vmax: float = 0.5) ImageObj[source]#

Add uniform noise to the input image.

Args:

src: Source image. p: Parameters.

Returns:

Result image object.

Note

This computation function can be called in two ways:

  1. With a parameter UniformDistributionParam object:

    param = UniformDistributionParam.create(seed=..., vmin=..., vmax=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, seed=..., vmin=..., vmax=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.addition(src_list: list[ImageObj]) ImageObj[source]#

Add images in the list and return the result image object

Parameters:

src_list – list of input image objects

Returns:

Output image object (modified in place)

sigima.proc.image.addition_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]#

Add dst and a constant value and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src + p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.adjust_gamma(src: ImageObj, p: AdjustGammaParam = None, *, gamma: float = 1.0, gain: float = 1.0) ImageObj[source]#

Gamma correction with skimage.exposure.adjust_gamma()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter AdjustGammaParam object:

    param = AdjustGammaParam.create(gamma=..., gain=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, gamma=..., gain=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.adjust_log(src: ImageObj, p: AdjustLogParam = None, *, gain: float = 1.0, inv: bool = False) ImageObj[source]#

Compute log correction with skimage.exposure.adjust_log()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter AdjustLogParam object:

    param = AdjustLogParam.create(gain=..., inv=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, gain=..., inv=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.adjust_sigmoid(src: ImageObj, p: AdjustSigmoidParam = None, *, cutoff: float = 0.5, gain: float = 10.0, inv: bool = False) ImageObj[source]#

Compute sigmoid correction with skimage.exposure.adjust_sigmoid()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter AdjustSigmoidParam object:

    param = AdjustSigmoidParam.create(cutoff=..., gain=..., inv=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, cutoff=..., gain=..., inv=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.apply_detection_rois(obj: ImageObj, geometry: GeometryResult, force: bool = False, roi_geometry: DetectionROIGeometry | None = None) bool[source]#

Apply ROI creation from detection geometry result.

This function checks if the geometry result contains ROI creation metadata and applies it to the image object by creating ROIs around detected features.

Parameters:
  • obj – Image object to modify

  • geometry – Geometry result from a detection function

  • force – If True, create ROIs even if not requested in the result attrs

  • roi_geometry – Override ROI geometry from attrs (if None, uses attrs value)

Returns:

True if ROIs were created, False otherwise

Example

>>> from sigima.proc.image import peak_detection, apply_detection_rois
>>> from sigima.params import Peak2DDetectionParam
>>> param = Peak2DDetectionParam()
>>> param.create_rois = True
>>> geometry = peak_detection(img, param)
>>> apply_detection_rois(img, geometry)  # Creates ROIs on img
sigima.proc.image.arithmetic(src1: ImageObj, src2: ImageObj, p: ArithmeticParam = None, *, operator: Literal['ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE'] = 'ADD', factor: float = 1.0, constant: float = 0.0, operation: str = '', restore_dtype: bool = True) ImageObj[source]#

Compute arithmetic operation on two images

Args:

src1: input image object src2: input image object p: arithmetic parameters

Returns:

Result image object

Note

This computation function can be called in two ways:

  1. With a parameter ArithmeticParam object:

    param = ArithmeticParam.create(operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, operator=..., factor=..., constant=..., operation=..., restore_dtype=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.astype(src: ImageObj, p: DataTypeIParam = None, *, dtype_str: Literal['float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'float32') ImageObj[source]#

Convert image data type with sigima.tools.datatypes.clip_astype()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DataTypeIParam object:

    param = DataTypeIParam.create(dtype_str=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, dtype_str=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.average(src_list: list[ImageObj]) ImageObj[source]#

Compute the average of images in the list and return the result image object

Parameters:

src_list – list of input image objects

Returns:

Output image object (modified in place)

sigima.proc.image.average_profile(src: ImageObj, p: AverageProfileParam = None, *, direction: Literal['horizontal', 'vertical'] = 'horizontal', _hgroup_begin: type = None, row1: int = 0, row2: int = -1, col1: int = 0, col2: int = -1, _hgroup_end: type = None) SignalObj[source]#

Compute horizontal or vertical average profile

Args:

src: input image object p: parameters

Returns:

Signal object with the average profile

Note

This computation function can be called in two ways:

  1. With a parameter AverageProfileParam object:

    param = AverageProfileParam.create(direction=..., _hgroup_begin=..., row1=..., row2=..., col1=..., col2=..., _hgroup_end=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, direction=..., _hgroup_begin=..., row1=..., row2=..., col1=..., col2=..., _hgroup_end=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.binning(src: ImageObj, p: BinningParam = None, *, sx: int = 2, sy: int = 2, operation: Literal['SUM', 'AVERAGE', 'MEDIAN', 'MIN', 'MAX'] = 'SUM', dtype_str: Literal['dtype', 'float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'dtype', change_pixel_size: bool = True) ImageObj[source]#

Binning: image pixel binning (or aggregation).

Depending on the algorithm, the input image may be cropped to fit an integer number of blocks.

Args:

src: source image p: parameters

Returns:

Output image

Raises:

ValueError: if source image has non-uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter BinningParam object:

    param = BinningParam.create(sx=..., sy=..., operation=..., dtype_str=..., change_pixel_size=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sx=..., sy=..., operation=..., dtype_str=..., change_pixel_size=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.black_tophat(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]#

Compute Black Top-Hat with skimage.morphology.black_tophat()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.blob_dog(image: ImageObj, p: BlobDOGParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_sigma: float = 10.0, max_sigma: float = 30.0, threshold_rel: float = 0.2, overlap: float = 0.5, exclude_border: bool = True) GeometryResult | None[source]#
Compute blobs using Difference of Gaussian method

with sigima.tools.image.find_blobs_dog()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobDOGParam object:

    param = BlobDOGParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., exclude_border=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., exclude_border=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.blob_doh(image: ImageObj, p: BlobDOHParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_sigma: float = 10.0, max_sigma: float = 30.0, threshold_rel: float = 0.2, overlap: float = 0.5, log_scale: bool = False) GeometryResult | None[source]#
Compute blobs using Determinant of Hessian method

with sigima.tools.image.find_blobs_doh()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobDOHParam object:

    param = BlobDOHParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., log_scale=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., log_scale=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.blob_log(image: ImageObj, p: BlobLOGParam = None, *, min_sigma: float = 10.0, max_sigma: float = 30.0, threshold_rel: float = 0.2, overlap: float = 0.5, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, log_scale: bool = False, exclude_border: bool = True) GeometryResult | None[source]#
Compute blobs using Laplacian of Gaussian method

with sigima.tools.image.find_blobs_log()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobLOGParam object:

    param = BlobLOGParam.create(min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., log_scale=..., exclude_border=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, min_sigma=..., max_sigma=..., threshold_rel=..., overlap=..., _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., log_scale=..., exclude_border=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.blob_opencv(image: ImageObj, p: BlobOpenCVParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_threshold: float = 10.0, max_threshold: float = 200.0, min_repeatability: int = 2, min_dist_between_blobs: float = 10.0, filter_by_color: bool = True, blob_color: int = 0, filter_by_area: bool = True, min_area: float = 25.0, max_area: float = 500.0, filter_by_circularity: bool = False, min_circularity: float = 0.8, max_circularity: float = 1.0, filter_by_inertia: bool = False, min_inertia_ratio: float = 0.6, max_inertia_ratio: float = 1.0, filter_by_convexity: bool = False, min_convexity: float = 0.8, max_convexity: float = 1.0) GeometryResult | None[source]#
Compute blobs using OpenCV

with sigima.tools.image.find_blobs_opencv()

Args:

imageOutput: input image p: parameters

Returns:

Blobs coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter BlobOpenCVParam object:

    param = BlobOpenCVParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_threshold=..., max_threshold=..., min_repeatability=..., min_dist_between_blobs=..., filter_by_color=..., blob_color=..., filter_by_area=..., min_area=..., max_area=..., filter_by_circularity=..., min_circularity=..., max_circularity=..., filter_by_inertia=..., min_inertia_ratio=..., max_inertia_ratio=..., filter_by_convexity=..., min_convexity=..., max_convexity=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_threshold=..., max_threshold=..., min_repeatability=..., min_dist_between_blobs=..., filter_by_color=..., blob_color=..., filter_by_area=..., min_area=..., max_area=..., filter_by_circularity=..., min_circularity=..., max_circularity=..., filter_by_inertia=..., min_inertia_ratio=..., max_inertia_ratio=..., filter_by_convexity=..., min_convexity=..., max_convexity=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.butterworth(src: ImageObj, p: ButterworthParam = None, *, cut_off: float = 0.005, high_pass: bool = False, order: int = 2) ImageObj[source]#

Compute Butterworth filter with skimage.filters.butterworth().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter ButterworthParam object:

    param = ButterworthParam.create(cut_off=..., high_pass=..., order=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, cut_off=..., high_pass=..., order=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.calibration(src: ImageObj, p: XYZCalibrateParam = None, *, axis: Literal['x', 'y', 'z'] = 'z', a0: float = 0.0, a1: float = 1.0, a2: float = 0.0, a3: float = 0.0) ImageObj[source]#

Compute polynomial calibration

Applies polynomial transformation: dst = a0 + a1*src + a2*src² + a3*src³

Args:

src: input image object p: calibration parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter XYZCalibrateParam object:

    param = XYZCalibrateParam.create(axis=..., a0=..., a1=..., a2=..., a3=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, axis=..., a0=..., a1=..., a2=..., a3=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.canny(src: ImageObj, p: CannyParam = None, *, sigma: float = 1.0, low_threshold: float = 0.1, high_threshold: float = 0.9, use_quantiles: bool = True, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'CONSTANT', cval: float = 0.0) ImageObj[source]#

Compute Canny filter with skimage.feature.canny().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter CannyParam object:

    param = CannyParam.create(sigma=..., low_threshold=..., high_threshold=..., use_quantiles=..., mode=..., cval=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=..., low_threshold=..., high_threshold=..., use_quantiles=..., mode=..., cval=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.centroid(image: ImageObj) GeometryResult | None[source]#

Compute centroid with sigima.tools.image.get_centroid_fourier()

Parameters:

image – input image

Returns:

Centroid coordinates

sigima.proc.image.clip(src: ImageObj, p: ClipParam = None, *, lower: float = None, upper: float = None) ImageObj[source]#

Apply clipping with numpy.clip()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ClipParam object:

    param = ClipParam.create(lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, lower=..., upper=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.closing(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]#

Compute morphological closing with skimage.morphology.closing()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.complex_from_magnitude_phase(src1: ImageObj, src2: ImageObj, p: AngleUnitParam = None, *, unit: Literal['RADIAN', 'DEGREE'] = 'RADIAN') ImageObj[source]#

Combine magnitude and phase images into a complex image.

Warning

This function assumes that the input images have the same dimensions.

Args:

src1: Magnitude (module) image. src2: Phase (argument) image. p: Parameters (provides unit for the phase).

Returns:

Image object with complex-valued z.

Note

This computation function can be called in two ways:

  1. With a parameter AngleUnitParam object:

    param = AngleUnitParam.create(unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.complex_from_real_imag(src1: ImageObj, src2: ImageObj) ImageObj[source]#

Combine two real images into a complex image using real + i * imag.

Warning

This function assumes that the input images have the same dimensions and are properly aligned.

Parameters:
  • src1 – Real part image.

  • src2 – Imaginary part image.

Returns:

Image object with complex-valued z.

Raises:

ValueError – If the x or y coordinates of the two images are not the same.

sigima.proc.image.compute_geometry_from_obj(title: str, shape: KindShape, obj: ImageObj, func: Callable, *args: Any) GeometryResult | None[source]#

Compute a geometry shape from an image object by executing a computation function on the data of the image object, for each ROI (Region Of Interest) in the image.

Parameters:
  • title – result title

  • shape – result shape kind

  • obj – input image object

  • func – computation function

  • *args – computation function arguments

Returns:

A geometry result object or None if no result is found.

Important

Coordinate Conversion: This function automatically converts coordinates from pixel units (image indices) to physical units using the image object’s calibration information.

  • Input: Computation function returns coordinates in pixel units

  • Output: GeometryResult with coordinates in physical units (e.g., mm, µm)

The conversion is performed using the image’s calibration parameters: physical_x = obj.dx * pixel_x + obj.x0 and physical_y = obj.dy * pixel_y + obj.y0

Warning

The computation function must take either a single argument (the data) or multiple arguments (the data followed by the computation parameters).

Moreover, the computation function must return a single value or a NumPy array containing the result of the computation. This array contains the coordinates of points, polygons, circles or ellipses in the form [[x, y], …], or [[x0, y0, x1, y1, …], …], or [[x0, y0, r], …], or [[x0, y0, a, b, theta], …].

Example

>>> # func returns pixel coordinates like [[10, 20], [30, 40]]
>>> result = compute_geometry_from_obj(
...     "Points", KindShape.POINT, image_obj, func
... )
>>> # result.coords now contains physical coordinates like [[0.5, 1.0],
>>> # [1.5, 2.0]]

See also

GeometryResult: The result object that stores physical coordinates.

sigima.proc.image.contour_shape(image: ImageObj, p: ContourShapeParam = None, *, threshold: float = 0.5, shape: Literal['ELLIPSE', 'CIRCLE', 'POLYGON'] = 'ELLIPSE') GeometryResult | None[source]#

Compute contour shape with sigima.tools.image.get_contour_shapes(). .. note:

This computation function can be called in two ways:

1. With a parameter ``ContourShapeParam`` object:

   .. code-block:: python

      param = ContourShapeParam.create(threshold=..., shape=...)
      func(obj, param)

2. Or, with keyword arguments directly:

   .. code-block:: python

      func(obj, threshold=..., shape=...)

Both styles are fully supported and equivalent.
sigima.proc.image.convolution(src: ImageObj, kernel: ImageObj) ImageObj[source]#

Convolve an image with a kernel.

The kernel should ideally be smaller than the input image and centered.

Parameters:
  • src – Input image object.

  • kernel – Kernel image object.

Returns:

Output image object.

Notes

The behavior of kernel normalization is controlled by the global configuration option sigima.config.options.auto_normalize_kernel.

sigima.proc.image.deconvolution(src: ImageObj, kernel: ImageObj) ImageObj[source]#

Deconvolve a kernel from an image using Fast Fourier Transform (FFT).

Parameters:
  • src – Input image object.

  • kernel – Kernel image object.

Returns:

Output image object.

Notes

The behavior of kernel normalization is controlled by the global configuration option sigima.config.options.auto_normalize_kernel.

sigima.proc.image.denoise_bilateral(src: ImageObj, p: DenoiseBilateralParam = None, *, sigma_spatial: float = 1.0, mode: Literal['CONSTANT', 'EDGE', 'SYMMETRIC', 'REFLECT', 'WRAP'] = 'CONSTANT', cval: float = 0.0) ImageObj[source]#
Compute bilateral filter denoising

with skimage.restoration.denoise_bilateral()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DenoiseBilateralParam object:

    param = DenoiseBilateralParam.create(sigma_spatial=..., mode=..., cval=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma_spatial=..., mode=..., cval=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.denoise_tophat(src: ImageObj, p: sigima.params.MorphologyParam) ImageObj[source]#

Denoise using White Top-Hat with skimage.morphology.white_tophat()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.denoise_tv(src: ImageObj, p: DenoiseTVParam = None, *, weight: float = 0.1, eps: float = 0.0002, max_num_iter: int = 200) ImageObj[source]#
Compute Total Variation denoising

with skimage.restoration.denoise_tv_chambolle()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DenoiseTVParam object:

    param = DenoiseTVParam.create(weight=..., eps=..., max_num_iter=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, weight=..., eps=..., max_num_iter=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.denoise_wavelet(src: ImageObj, p: DenoiseWaveletParam = None, *, wavelet: Literal['bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6', 'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9', 'bior4.4', 'bior5.5', 'bior6.8', 'cgau1', 'cgau2', 'cgau3', 'cgau4', 'cgau5', 'cgau6', 'cgau7', 'cgau8', 'cmor', 'coif1', 'coif2', 'coif3', 'coif4', 'coif5', 'coif6', 'coif7', 'coif8', 'coif9', 'coif10', 'coif11', 'coif12', 'coif13', 'coif14', 'coif15', 'coif16', 'coif17', 'db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8', 'db9', 'db10', 'db11', 'db12', 'db13', 'db14', 'db15', 'db16', 'db17', 'db18', 'db19', 'db20', 'db21', 'db22', 'db23', 'db24', 'db25', 'db26', 'db27', 'db28', 'db29', 'db30', 'db31', 'db32', 'db33', 'db34', 'db35', 'db36', 'db37', 'db38', 'dmey', 'fbsp', 'gaus1', 'gaus2', 'gaus3', 'gaus4', 'gaus5', 'gaus6', 'gaus7', 'gaus8', 'haar', 'mexh', 'morl', 'rbio1.1', 'rbio1.3', 'rbio1.5', 'rbio2.2', 'rbio2.4', 'rbio2.6', 'rbio2.8', 'rbio3.1', 'rbio3.3', 'rbio3.5', 'rbio3.7', 'rbio3.9', 'rbio4.4', 'rbio5.5', 'rbio6.8', 'shan', 'sym2', 'sym3', 'sym4', 'sym5', 'sym6', 'sym7', 'sym8', 'sym9', 'sym10', 'sym11', 'sym12', 'sym13', 'sym14', 'sym15', 'sym16', 'sym17', 'sym18', 'sym19', 'sym20'] = 'sym9', mode: Literal['SOFT', 'HARD'] = 'SOFT', method: Literal['BAYES_SHRINK', 'VISU_SHRINK'] = 'VISU_SHRINK') ImageObj[source]#
Compute Wavelet denoising

with skimage.restoration.denoise_wavelet()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter DenoiseWaveletParam object:

    param = DenoiseWaveletParam.create(wavelet=..., mode=..., method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, wavelet=..., mode=..., method=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.difference(src1: ImageObj, src2: ImageObj) ImageObj[source]#

Compute difference between two images

Parameters:
  • src1 – input image object

  • src2 – input image object

Returns:

Result image object src1 - src2 (new object)

sigima.proc.image.difference_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]#

Subtract a constant value from an image and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src - p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.dilation(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]#

Compute Dilation with skimage.morphology.dilation()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.division(src1: ImageObj, src2: ImageObj) ImageObj[source]#

Compute division between two images

Parameters:
  • src1 – input image object

  • src2 – input image object

Returns:

Result image object src1 / src2 (new object)

sigima.proc.image.division_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]#

Divide an image by a constant value and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src / p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.dst_1_to_1_signal(src: ImageObj, name: str, suffix: str | None = None) SignalObj[source]#

Create a result signal object, for processing functions that take a single image object as input and return a single signal object (1-to-1-signal).

Parameters:
  • src – input image object

  • name – name of the processing function

Returns:

Output signal object

sigima.proc.image.enclosing_circle(image: ImageObj) GeometryResult | None[source]#

Compute minimum enclosing circle with sigima.tools.image.get_enclosing_circle()

Parameters:

image – input image

Returns:

Diameter coords

sigima.proc.image.equalize_adapthist(src: ImageObj, p: EqualizeAdaptHistParam = None, *, nbins: int = 256, clip_limit: float = 0.01) ImageObj[source]#
Adaptive histogram equalization

with skimage.exposure.equalize_adapthist()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter EqualizeAdaptHistParam object:

    param = EqualizeAdaptHistParam.create(nbins=..., clip_limit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, nbins=..., clip_limit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.equalize_hist(src: ImageObj, p: EqualizeHistParam = None, *, nbins: int = 256) ImageObj[source]#

Histogram equalization with skimage.exposure.equalize_hist()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter EqualizeHistParam object:

    param = EqualizeHistParam.create(nbins=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, nbins=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.erase(src: ImageObj, p: ROI2DParam | list[ROI2DParam]) ImageObj[source]#

Erase an area of the image using the mean value of the image.

Note

The erased area is defined by a region of interest (ROI) parameter set. This ROI must not be mistaken with the ROI of the image object. If the image object has a ROI, it is not used in this processing, except to restore the data outside the ROI (as in all other processing).

Parameters:
  • src – input image object

  • p – parameters defining the area to erase (region of interest)

Returns:

Output image object

sigima.proc.image.erosion(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]#

Compute Erosion with skimage.morphology.erosion()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.exp(src: ImageObj) ImageObj[source]#

Compute exponential with numpy.exp

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.extract_roi(src: ImageObj, p: ROI2DParam = None, *, title: str = '', geometry: Literal['rectangle', 'circle', 'polygon'] = 'rectangle', _tlcorner: type = None, x0: float = 0, y0: float = 0, _e_tlcorner: type = None, dx: float = 0, dy: float = 0, _cgroup: type = None, xc: float = 0, yc: float = 0, _e_cgroup: type = None, r: float = 0, points: ndarray = None, inverse: bool = False) ImageObj[source]#

Extract single ROI

Args:

src: input image object p: ROI parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ROI2DParam object:

    param = ROI2DParam.create(title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.extract_rois(src: ImageObj, params: list[ROI2DParam]) ImageObj[source]#

Extract multiple regions of interest from data

Parameters:
  • src – input image object

  • params – list of ROI parameters

Returns:

Output image object

sigima.proc.image.farid(src: ImageObj) ImageObj[source]#

Compute Farid filter with skimage.filters.farid().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.farid_h(src: ImageObj) ImageObj[source]#

Compute horizontal Farid filter with skimage.filters.farid_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.farid_v(src: ImageObj) ImageObj[source]#

Compute vertical Farid filter with skimage.filters.farid_v().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.fft(src: ImageObj, p: FFTParam | None = None) ImageObj[source]#

Compute FFT with sigima.tools.image.fft2d()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.flatfield(src1: ImageObj, src2: ImageObj, p: FlatFieldParam = None, *, threshold: float = 0.0) ImageObj[source]#

Compute flat field correction with sigima.tools.image.flatfield()

Args:

src1: raw data image object src2: flat field image object p: flat field parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter FlatFieldParam object:

    param = FlatFieldParam.create(threshold=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, threshold=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.fliph(src: ImageObj) ImageObj[source]#

Flip data horizontally with numpy.fliplr()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.flipv(src: ImageObj) ImageObj[source]#

Flip data vertically with numpy.flipud()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.gaussian_filter(src: ImageObj, p: GaussianParam = None, *, sigma: float = 1.0) ImageObj[source]#

Compute gaussian filter with scipy.ndimage.gaussian_filter().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter GaussianParam object:

    param = GaussianParam.create(sigma=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.gaussian_freq_filter(src: ImageObj, p: GaussianFreqFilterParam = None, *, sigma: float = 0.5, f0: float = 1.0, ifft_result_type: Literal['real', 'abs'] = 'real') ImageObj[source]#

Apply a Gaussian filter in the frequency domain.

Args:

src: Source image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter GaussianFreqFilterParam object:

    param = GaussianFreqFilterParam.create(sigma=..., f0=..., ifft_result_type=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, sigma=..., f0=..., ifft_result_type=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.generate_image_grid_roi(src: ImageObj, p: ROIGridParam) ImageROI[source]#

Create a grid of rectangular ROIs from an image object.

Parameters:
  • obj – The image object to create the ROI for.

  • p – ROIGridParam object containing the grid parameters.

Returns:

The created ROI object.

sigima.proc.image.histogram(src: ImageObj, p: HistogramParam = None, *, bins: int = 256, lower: float = None, upper: float = None) SignalObj[source]#

Compute histogram of the image data, with numpy.histogram()

Args:

src: input image object p: parameters

Returns:

Signal object with the histogram

Note

This computation function can be called in two ways:

  1. With a parameter HistogramParam object:

    param = HistogramParam.create(bins=..., lower=..., upper=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, bins=..., lower=..., upper=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.horizontal_projection(image: ImageObj) SignalObj[source]#

Compute the sum of pixel intensities along each col. (projection on the x-axis).

Parameters:

image – Input image object.

Returns:

Signal object containing the profile.

sigima.proc.image.hough_circle_peaks(image: ImageObj, p: HoughCircleParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, min_radius: int = None, max_radius: int = None, min_distance: int = None) GeometryResult | None[source]#
Compute Hough circles

with sigima.tools.image.get_hough_circle_peaks()

Args:

image: input image p: parameters

Returns:

Circle coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter HoughCircleParam object:

    param = HoughCircleParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_radius=..., max_radius=..., min_distance=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., min_radius=..., max_radius=..., min_distance=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.ifft(src: ImageObj, p: FFTParam | None = None) ImageObj[source]#

Compute inverse FFT with sigima.tools.image.ifft2d()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.imag(src: ImageObj) ImageObj[source]#

Compute imaginary part with numpy.imag()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.inverse(src: ImageObj) ImageObj[source]#

Compute the inverse of an image and return the new result image object

Parameters:

src – input image object

Returns:

Result image object 1 / src (new object)

sigima.proc.image.laplace(src: ImageObj) ImageObj[source]#

Compute Laplace filter with skimage.filters.laplace().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.line_profile(src: ImageObj, p: LineProfileParam = None, *, direction: Literal['horizontal', 'vertical'] = 'horizontal', row: int = 0, col: int = 0) SignalObj[source]#

Compute horizontal or vertical profile

Args:

src: input image object p: parameters

Returns:

Signal object with the profile

Note

This computation function can be called in two ways:

  1. With a parameter LineProfileParam object:

    param = LineProfileParam.create(direction=..., row=..., col=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, direction=..., row=..., col=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.log10(src: ImageObj) ImageObj[source]#

Compute log10 with numpy.log10

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.log10_z_plus_n(src: ImageObj, p: Log10ZPlusNParam = None, *, n: float = None) ImageObj[source]#

Compute log10(z+n) with numpy.log10

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter Log10ZPlusNParam object:

    param = Log10ZPlusNParam.create(n=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.magnitude_spectrum(src: ImageObj, p: SpectrumParam | None = None) ImageObj[source]#

Compute magnitude spectrum with sigima.tools.image.magnitude_spectrum()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.moving_average(src: ImageObj, p: MovingAverageParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'REFLECT') ImageObj[source]#

Compute moving average with scipy.ndimage.uniform_filter().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter MovingAverageParam object:

    param = MovingAverageParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.moving_median(src: ImageObj, p: MovingMedianParam = None, *, n: int = 3, mode: Literal['REFLECT', 'CONSTANT', 'NEAREST', 'MIRROR', 'WRAP'] = 'NEAREST') ImageObj[source]#

Compute moving median with scipy.ndimage.median_filter().

Args:

src: Input image object. p: Parameters.

Returns:

Output image object.

Note

This computation function can be called in two ways:

  1. With a parameter MovingMedianParam object:

    param = MovingMedianParam.create(n=..., mode=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, n=..., mode=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.normalize(src: ImageObj, p: NormalizeParam = None, *, method: Literal['MAXIMUM', 'AMPLITUDE', 'AREA', 'ENERGY', 'RMS'] = 'MAXIMUM') ImageObj[source]#

Normalize image data depending on its maximum, with sigima.tools.image.normalize()

Args:

src: input image object

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter NormalizeParam object:

    param = NormalizeParam.create(method=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.offset_correction(src: ImageObj, p: ROI2DParam = None, *, title: str = '', geometry: Literal['rectangle', 'circle', 'polygon'] = 'rectangle', _tlcorner: type = None, x0: float = 0, y0: float = 0, _e_tlcorner: type = None, dx: float = 0, dy: float = 0, _cgroup: type = None, xc: float = 0, yc: float = 0, _e_cgroup: type = None, r: float = 0, points: ndarray = None, inverse: bool = False) ImageObj[source]#

Apply offset correction

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ROI2DParam object:

    param = ROI2DParam.create(title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, title=..., geometry=..., _tlcorner=..., x0=..., y0=..., _e_tlcorner=..., dx=..., dy=..., _cgroup=..., xc=..., yc=..., _e_cgroup=..., r=..., points=..., inverse=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.opening(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]#

Compute morphological opening with skimage.morphology.opening()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.peak_detection(obj: ImageObj, p: Peak2DDetectionParam = None, *, _roi_g: type = None, create_rois: bool = False, roi_geometry: Literal['CIRCLE', 'RECTANGLE'] = 'RECTANGLE', _roi_g_e: type = None, threshold: float = 0.5, size: int = None) GeometryResult | None[source]#
Compute 2D peak detection

with sigima.tools.image.get_2d_peaks_coords()

Args:

obj: input image p: parameters

Returns:

Peak coordinates (with ROI creation info in attrs if requested)

Note

This computation function can be called in two ways:

  1. With a parameter Peak2DDetectionParam object:

    param = Peak2DDetectionParam.create(_roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., threshold=..., size=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, _roi_g=..., create_rois=..., roi_geometry=..., _roi_g_e=..., threshold=..., size=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.phase(src: ImageObj, p: PhaseParam = None, *, unwrap: bool = True, unit: Literal['RADIAN', 'DEGREE'] = 'DEGREE') ImageObj[source]#

Compute the phase (argument) of a complex image.

The function uses numpy.angle() to compute the argument and numpy.unwrap() to unwrap it.

Args:

src: Input image object. p: Phase parameters.

Returns:

Image object containing the phase, optionally unwrapped.

Note

This computation function can be called in two ways:

  1. With a parameter PhaseParam object:

    param = PhaseParam.create(unwrap=..., unit=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, unwrap=..., unit=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.phase_spectrum(src: ImageObj) ImageObj[source]#

Compute phase spectrum with sigima.tools.image.phase_spectrum()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.prewitt(src: ImageObj) ImageObj[source]#

Compute Prewitt filter with skimage.filters.prewitt().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.prewitt_h(src: ImageObj) ImageObj[source]#

Compute horizontal Prewitt filter with skimage.filters.prewitt_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.prewitt_v(src: ImageObj) ImageObj[source]#

Compute vertical Prewitt filter with skimage.filters.prewitt_v().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.product(src_list: list[ImageObj]) ImageObj[source]#

Multiply images in the list and return the result image object

Parameters:

src_list – list of input image objects

Returns:

Output image object (modified in place)

sigima.proc.image.product_constant(src: ImageObj, p: ConstantParam = None, *, value: float = None) ImageObj[source]#

Multiply dst by a constant value and return the new result image object

Args:

src: input image object p: constant value

Returns:

Result image object src * p.value (new object)

Note

This computation function can be called in two ways:

  1. With a parameter ConstantParam object:

    param = ConstantParam.create(value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.psd(src: ImageObj, p: SpectrumParam | None = None) ImageObj[source]#

Compute power spectral density with sigima.tools.image.psd()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

sigima.proc.image.quadratic_difference(src1: ImageObj, src2: ImageObj) ImageObj[source]#

Compute quadratic difference between two images

Parameters:
  • src1 – input image object

  • src2 – input image object

Returns:

Result image object (src1 - src2) / sqrt(2.0) (new object)

sigima.proc.image.radial_profile(src: ImageObj, p: RadialProfileParam = None, *, center: Literal['centroid', 'center', 'user'] = 'centroid', x0: float = 0.0, y0: float = 0.0) SignalObj[source]#
Compute radial profile around the centroid

with sigima.tools.image.get_radial_profile()

Args:

src: input image object p: parameters

Returns:

Signal object with the radial profile

Note

This computation function can be called in two ways:

  1. With a parameter RadialProfileParam object:

    param = RadialProfileParam.create(center=..., x0=..., y0=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, center=..., x0=..., y0=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.real(src: ImageObj) ImageObj[source]#

Compute real part with numpy.real()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.resampling(src: ImageObj, p: Resampling2DParam = None, *, xmin: float = None, xmax: float = None, ymin: float = None, ymax: float = None, mode: Literal['dxy', 'shape'] = 'shape', dx: float = None, dy: float = None, width: int = None, height: int = None, method: Literal['NEAREST', 'LINEAR', 'CUBIC'] = 'LINEAR', fill_value: float = None) ImageObj[source]#

Resample image to new coordinate grid using interpolation

Args:

src: source image p: resampling parameters

Returns:

Resampled image object

Raises:

ValueError: if source image has non-uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter Resampling2DParam object:

    param = Resampling2DParam.create(xmin=..., xmax=..., ymin=..., ymax=..., mode=..., dx=..., dy=..., width=..., height=..., method=..., fill_value=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, xmin=..., xmax=..., ymin=..., ymax=..., mode=..., dx=..., dy=..., width=..., height=..., method=..., fill_value=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.rescale_intensity(src: ImageObj, p: RescaleIntensityParam = None, *, in_range: Literal['image', 'dtype', 'float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'image', out_range: Literal['image', 'dtype', 'float32', 'float64', 'complex128', 'uint8', 'int16', 'uint16', 'int32'] = 'dtype') ImageObj[source]#
Rescale image intensity levels

with skimage.exposure.rescale_intensity()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter RescaleIntensityParam object:

    param = RescaleIntensityParam.create(in_range=..., out_range=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, in_range=..., out_range=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.resize(src: ImageObj, p: ResizeParam = None, *, zoom: float = 1.0, mode: Literal['CONSTANT', 'NEAREST', 'REFLECT', 'WRAP', 'MIRROR'] = 'CONSTANT', cval: float = 0.0, prefilter: bool = True, order: int = 3) ImageObj[source]#

Zooming function with scipy.ndimage.zoom()

Args:

src: input image object p: parameters

Returns:

Output image object

Raises:

ValueError: if source image has non-uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter ResizeParam object:

    param = ResizeParam.create(zoom=..., mode=..., cval=..., prefilter=..., order=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, zoom=..., mode=..., cval=..., prefilter=..., order=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.restore_data_outside_roi(dst: ImageObj, src: ImageObj) None[source]#

Restore data outside the Region Of Interest (ROI) of the input image after a computation, only if the input image has a ROI, and if the output image has the same ROI as the input image, and if the data types are compatible, and if the shapes are the same. Otherwise, do nothing.

Parameters:
  • dst – output image object

  • src – input image object

sigima.proc.image.roberts(src: ImageObj) ImageObj[source]#

Compute Roberts filter with skimage.filters.roberts().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.rotate(src: ImageObj, p: RotateParam = None, *, angle: float = 0.0, mode: Literal['CONSTANT', 'NEAREST', 'REFLECT', 'WRAP', 'MIRROR'] = 'CONSTANT', cval: float = 0.0, reshape: bool = False, prefilter: bool = True, order: int = 3) ImageObj[source]#

Rotate data with scipy.ndimage.rotate()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter RotateParam object:

    param = RotateParam.create(angle=..., mode=..., cval=..., reshape=..., prefilter=..., order=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, angle=..., mode=..., cval=..., reshape=..., prefilter=..., order=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.rotate90(src: ImageObj) ImageObj[source]#

Rotate data 90° with numpy.rot90()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.rotate270(src: ImageObj) ImageObj[source]#

Rotate data 270° with numpy.rot90()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.scharr(src: ImageObj) ImageObj[source]#

Compute Scharr filter with skimage.filters.scharr().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.scharr_h(src: ImageObj) ImageObj[source]#

Compute horizontal Scharr filter with skimage.filters.scharr_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.scharr_v(src: ImageObj) ImageObj[source]#

Compute vertical Scharr filter with skimage.filters.scharr_v().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.segment_profile(src: ImageObj, p: SegmentProfileParam = None, *, row1: int = 0, col1: int = 0, row2: int = 0, col2: int = 0) SignalObj[source]#

Compute segment profile

Args:

src: input image object p: parameters

Returns:

Signal object with the segment profile

Note

This computation function can be called in two ways:

  1. With a parameter SegmentProfileParam object:

    param = SegmentProfileParam.create(row1=..., col1=..., row2=..., col2=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, row1=..., col1=..., row2=..., col2=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.set_uniform_coords(src: ImageObj, p: UniformCoordsParam = None, *, x0: float = 0.0, y0: float = 0.0, dx: float = 1.0, dy: float = 1.0) ImageObj[source]#

Convert image to uniform coordinate system

Args:

src: input image object p: uniform coordinates parameters

Returns:

Output image object with uniform coordinates

Note

This computation function can be called in two ways:

  1. With a parameter UniformCoordsParam object:

    param = UniformCoordsParam.create(x0=..., y0=..., dx=..., dy=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, x0=..., y0=..., dx=..., dy=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.sobel(src: ImageObj) ImageObj[source]#

Compute Sobel filter with skimage.filters.sobel().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.sobel_h(src: ImageObj) ImageObj[source]#

Compute horizontal Sobel filter with skimage.filters.sobel_h().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.sobel_v(src: ImageObj) ImageObj[source]#

Compute vertical Sobel filter with skimage.filters.sobel_v().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.standard_deviation(src_list: list[ImageObj]) ImageObj[source]#

Compute the element-wise standard deviation of multiple images.

The first image in the list defines the “base” image. All other images are used to compute the element-wise standard deviation with the base image.

Note

If all images share the same region of interest (ROI), the standard deviation is computed only within the ROI.

Warning

It is assumed that all images have the same size and x-coordinates.

Parameters:

src_list – List of source images.

Returns:

Image object representing the standard deviation of the source images.

sigima.proc.image.stats(obj: ImageObj) TableResult[source]#

Compute statistics on an image

Parameters:

obj – input image object

Returns:

Result properties

sigima.proc.image.threshold(src: ImageObj, p: ThresholdParam = None, *, method: Literal['manual', 'isodata', 'li', 'mean', 'minimum', 'otsu', 'triangle', 'yen'] = 'manual', bins: int = 256, value: float = 0.0, operation: Literal['>', '<'] = '>') ImageObj[source]#

Compute the threshold, using one of the available algorithms:

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter ThresholdParam object:

    param = ThresholdParam.create(method=..., bins=..., value=..., operation=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, method=..., bins=..., value=..., operation=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.threshold_isodata(src: ImageObj) ImageObj[source]#

Compute the threshold using the Isodata algorithm with default parameters, see skimage.filters.threshold_isodata()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold_li(src: ImageObj) ImageObj[source]#

Compute the threshold using the Li algorithm with default parameters, see skimage.filters.threshold_li()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold_mean(src: ImageObj) ImageObj[source]#

Compute the threshold using the Mean algorithm, see skimage.filters.threshold_mean()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold_minimum(src: ImageObj) ImageObj[source]#

Compute the threshold using the Minimum algorithm with default parameters, see skimage.filters.threshold_minimum()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold_otsu(src: ImageObj) ImageObj[source]#

Compute the threshold using the Otsu algorithm with default parameters, see skimage.filters.threshold_otsu()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold_triangle(src: ImageObj) ImageObj[source]#

Compute the threshold using the Triangle algorithm with default parameters, see skimage.filters.threshold_triangle()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.threshold_yen(src: ImageObj) ImageObj[source]#

Compute the threshold using the Yen algorithm with default parameters, see skimage.filters.threshold_yen()

Parameters:

src – input image object

Returns:

Output image object

sigima.proc.image.translate(src: ImageObj, p: TranslateParam = None, *, dx: float = 0.0, dy: float = 0.0) ImageObj[source]#

Translate data with scipy.ndimage.shift()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter TranslateParam object:

    param = TranslateParam.create(dx=..., dy=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, dx=..., dy=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.transpose(src: ImageObj) ImageObj[source]#

Transpose image with numpy.transpose().

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.vertical_projection(image: ImageObj) SignalObj[source]#

Compute the sum of pixel intensities along each row (projection on the y-axis).

Parameters:

image – Input image object.

Returns:

Signal object containing the profile.

sigima.proc.image.white_tophat(src: ImageObj, p: MorphologyParam = None, *, radius: int = 1) ImageObj[source]#

Compute White Top-Hat with skimage.morphology.white_tophat()

Args:

src: input image object p: parameters

Returns:

Output image object

Note

This computation function can be called in two ways:

  1. With a parameter MorphologyParam object:

    param = MorphologyParam.create(radius=...)
    func(obj, param)
    
  2. Or, with keyword arguments directly:

    func(obj, radius=...)
    

Both styles are fully supported and equivalent.

sigima.proc.image.wiener(src: ImageObj) ImageObj[source]#

Compute Wiener filter with scipy.signal.wiener()

Parameters:

src – Input image object.

Returns:

Output image object.

sigima.proc.image.zero_padding(src: ImageObj, p: ZeroPadding2DParam | None = None) ImageObj[source]#

Zero-padding: add zeros to image borders.

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Decorators and utilities#

This package also provides some utility functions to help with the creation and introspection of computation functions:

sigima.proc.decorator.computation_function(*, name: str | None = None, description: str | None = None) Callable[[Callable[[P], R]], Callable[[P], R]][source]#

Decorator to mark a function as a Sigima computation function.

This decorator enables two calling conventions:
  1. With a guidata DataSet object as a parameter (classic style).

  2. With the DataSet items passed as individual keyword arguments (expanded style).

The decorator ensures:
  • An explicit and informative function signature (including all DataSet items as keyword arguments).

  • A Sphinx-friendly docstring documenting both call styles.

  • Pickle-compatibility (crucial for multiprocessing).

  • Conflict detection if both DataSet instance and expanded keyword arguments are used simultaneously.

Parameters:
  • name – Optional custom name for metadata.

  • description – Optional custom description or docstring.

Returns:

The decorated, enhanced computation function.

sigima.proc.decorator.is_computation_function(function: Callable) bool[source]#

Check if a function is a Sigima computation function.

Parameters:

function – The function to check.

Returns:

True if the function is a Sigima computation function, False otherwise.

sigima.proc.decorator.get_computation_metadata(function: Callable) ComputationMetadata[source]#

Get the metadata of a Sigima computation function.

Parameters:

function – The function to get metadata from.

Returns:

Computation function metadata.

Raises:

ValueError – If the function is not a Sigima computation function.

sigima.proc.decorator.find_computation_functions() list[tuple[str, Callable]][source]#

Find all computation functions in the sigima.proc package.

This function uses introspection to locate all functions decorated with @computation_function in the sigima.proc package and its subpackages.

Parameters:

module – Optional module to search in. If None, the current module is used.

Returns:

A list of tuples, each containing the function name and the function object.

Title Formatting System#

The title formatting system provides configurable title generation for computation results, enabling different applications (Sigima standalone vs DataLab integration) to use different title formatting strategies:

Title formatting system for computation results#

This module provides a configurable title formatting system for computation results. It allows different applications (Sigima vs DataLab) to use different title formatting strategies while maintaining compatibility.

class sigima.proc.title_formatting.PlaceholderTitleFormatter[source]#

Placeholder-based title formatter compatible with DataLab.

Creates titles with placeholders that can be resolved later by DataLab’s patch_title_with_ids() function.

format_1_to_1_title(name: str, suffix: str | None = None) str[source]#

Format title for 1-to-1 computation with placeholder.

format_n_to_1_title(name: str, n_inputs: int, suffix: str | None = None) str[source]#

Format title for n-to-1 computation with placeholders.

format_2_to_1_title(name: str, suffix: str | None = None) str[source]#

Format title for 2-to-1 computation with placeholders.

class sigima.proc.title_formatting.SimpleTitleFormatter[source]#

Simple descriptive title formatter for Sigima-only usage.

Creates human-readable titles without placeholders, suitable for standalone Sigima usage where object relationships are less critical.

format_1_to_1_title(name: str, suffix: str | None = None) str[source]#

Format title for 1-to-1 computation.

format_n_to_1_title(name: str, n_inputs: int, suffix: str | None = None) str[source]#

Format title for n-to-1 computation.

format_2_to_1_title(name: str, suffix: str | None = None) str[source]#

Format title for 2-to-1 computation.

class sigima.proc.title_formatting.TitleFormatter(*args, **kwargs)[source]#

Protocol for title formatting strategies used in computation functions.

This protocol allows different title formatting approaches: - Simple descriptive titles for Sigima-only usage - Placeholder-based titles for DataLab integration - Custom formatting for specific use cases

format_1_to_1_title(name: str, suffix: str | None = None) str[source]#

Format title for 1-to-1 computation (single input → single output).

Parameters:
  • name – Name of the computation function

  • suffix – Optional suffix to add to the title

Returns:

Formatted title string

format_n_to_1_title(name: str, n_inputs: int, suffix: str | None = None) str[source]#

Format title for n-to-1 computation (multiple inputs → single output).

Parameters:
  • name – Name of the computation function

  • n_inputs – Number of input objects

  • suffix – Optional suffix to add to the title

Returns:

Formatted title string

format_2_to_1_title(name: str, suffix: str | None = None) str[source]#

Format title for 2-to-1 computation (two inputs → single output).

Parameters:
  • name – Name of the computation function

  • suffix – Optional suffix to add to the title

Returns:

Formatted title string

sigima.proc.title_formatting.get_default_title_formatter() TitleFormatter[source]#

Get the current default title formatter.

Returns:

Current default title formatter

sigima.proc.title_formatting.set_default_title_formatter(formatter: TitleFormatter) None[source]#

Set the default title formatter.

Parameters:

formatter – Title formatter to use as default