Computation (cdl.computation)#

This package contains the computation functions used by the DataLab project. Those functions operate directly on DataLab objects (i.e. cdl.obj.SignalObj and cdl.obj.ImageObj) and are designed to be used in the DataLab pipeline, but can be used independently as well.

See also

The cdl.computation package is the main entry point for the DataLab computation functions when manipulating DataLab objects. See the cdl.algorithms package for 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 DataLab object (e.g. cdl.obj.SignalObj) and a parameter object (e.g. cdl.param.MovingAverageParam) as input and return a DataLab 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 DataLab overall architecture, the purpose of this package is to provide the computation functions that are used by the cdl.core.gui.processor module, based on the algorithms defined in the cdl.algorithms module and on the data model defined in the cdl.obj (or cdl.core.model) module.

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

Common processing features#

class cdl.computation.base.ArithmeticParam[source]#

Arithmetic parameters

operator#

Single choice from: ‘+’, ‘-’, ‘×’, ‘/’. Default: ‘+’.

Type:

guidata.dataset.dataitems.ChoiceItem

factor#

Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

constant#

Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

operation#

Default: ‘’.

Type:

guidata.dataset.dataitems.StringItem

restore_dtype#

Result. Default: True.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(operator: str, factor: float, constant: float, operation: str, restore_dtype: bool) cdl.computation.base.ArithmeticParam#

Returns a new instance of ArithmeticParam with the fields set to the given values.

Parameters:
  • operator (str) – Single choice from: ‘+’, ‘-’, ‘×’, ‘/’. Default: ‘+’.

  • factor (float) – Default: 1.0.

  • constant (float) – Default: 0.0.

  • operation (str) – Default: ‘’.

  • restore_dtype (bool) – Result. Default: True.

Returns:

New instance of ArithmeticParam.

get_operation() str[source]#

Return the operation string

update_operation(_item, _value)[source]#

Update the operation item

class cdl.computation.base.GaussianParam[source]#

Gaussian filter parameters

sigma#

σ. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(sigma: float) cdl.computation.base.GaussianParam#

Returns a new instance of GaussianParam with the fields set to the given values.

Parameters:

sigma (float) – σ. Default: 1.0.

Returns:

New instance of GaussianParam.

class cdl.computation.base.MovingAverageParam[source]#

Moving average parameters

n#

Size of the moving window. Integer higher than 1. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

mode#

Mode of the filter: - ‘reflect’: reflect the data at the boundary - ‘constant’: pad with a constant value - ‘nearest’: pad with the nearest value - ‘mirror’: reflect the data at the boundary with the data itself - ‘wrap’: circular boundary. Single choice from: ‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’. Default: ‘reflect’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(n: int, mode: str) cdl.computation.base.MovingAverageParam#

Returns a new instance of MovingAverageParam with the fields set to the given values.

Parameters:
  • n (int) – Size of the moving window. Integer higher than 1. Default: 3.

  • mode (str) – Mode of the filter: - ‘reflect’: reflect the data at the boundary - ‘constant’: pad with a constant value - ‘nearest’: pad with the nearest value - ‘mirror’: reflect the data at the boundary with the data itself - ‘wrap’: circular boundary. Single choice from: ‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’. Default: ‘reflect’.

Returns:

New instance of MovingAverageParam.

class cdl.computation.base.MovingMedianParam[source]#

Moving median parameters

n#

Size of the moving window. Integer higher than 1, odd. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

mode#

Mode of the filter: - ‘reflect’: reflect the data at the boundary - ‘constant’: pad with a constant value - ‘nearest’: pad with the nearest value - ‘mirror’: reflect the data at the boundary with the data itself - ‘wrap’: circular boundary. Single choice from: ‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’. Default: ‘nearest’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(n: int, mode: str) cdl.computation.base.MovingMedianParam#

Returns a new instance of MovingMedianParam with the fields set to the given values.

Parameters:
  • n (int) – Size of the moving window. Integer higher than 1, odd. Default: 3.

  • mode (str) – Mode of the filter: - ‘reflect’: reflect the data at the boundary - ‘constant’: pad with a constant value - ‘nearest’: pad with the nearest value - ‘mirror’: reflect the data at the boundary with the data itself - ‘wrap’: circular boundary. Single choice from: ‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’. Default: ‘nearest’.

Returns:

New instance of MovingMedianParam.

class cdl.computation.base.ClipParam[source]#

Data clipping parameters

lower#

Lower clipping value. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

upper#

Upper clipping value. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(lower: float, upper: float) cdl.computation.base.ClipParam#

Returns a new instance of ClipParam with the fields set to the given values.

Parameters:
  • lower (float) – Lower clipping value. Default: None.

  • upper (float) – Upper clipping value. Default: None.

Returns:

New instance of ClipParam.

class cdl.computation.base.NormalizeParam[source]#

Normalize parameters

method#

Normalize with respect to. Single choice from: ‘maximum’, ‘amplitude’, ‘area’, ‘energy’, ‘rms’. Default: ‘maximum’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(method: str) cdl.computation.base.NormalizeParam#

Returns a new instance of NormalizeParam with the fields set to the given values.

Parameters:

method (str) – Normalize with respect to. Single choice from: ‘maximum’, ‘amplitude’, ‘area’, ‘energy’, ‘rms’. Default: ‘maximum’.

Returns:

New instance of NormalizeParam.

class cdl.computation.base.HistogramParam[source]#

Histogram parameters

bins#

Number of bins. Integer higher than 1. Default: 256.

Type:

guidata.dataset.dataitems.IntItem

lower#

Lower limit. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

upper#

Upper limit. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(bins: int, lower: float, upper: float) cdl.computation.base.HistogramParam#

Returns a new instance of HistogramParam with the fields set to the given values.

Parameters:
  • bins (int) – Number of bins. Integer higher than 1. Default: 256.

  • lower (float) – Lower limit. Default: None.

  • upper (float) – Upper limit. Default: None.

Returns:

New instance of HistogramParam.

get_suffix(data: ndarray) str[source]#

Return suffix for the histogram computation

Parameters:

data – data array

class cdl.computation.base.FFTParam[source]#

FFT parameters

shift#

Shift zero frequency to center. Default: None.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(shift: bool) cdl.computation.base.FFTParam#

Returns a new instance of FFTParam with the fields set to the given values.

Parameters:

shift (bool) – Shift zero frequency to center. Default: None.

Returns:

New instance of FFTParam.

class cdl.computation.base.SpectrumParam[source]#

Spectrum parameters

log#

Default: False.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(log: bool) cdl.computation.base.SpectrumParam#

Returns a new instance of SpectrumParam with the fields set to the given values.

Parameters:

log (bool) – Default: False.

Returns:

New instance of SpectrumParam.

class cdl.computation.base.ConstantParam[source]#

Parameter used to set a constant value to used in operations

value#

Constant value. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(value: float) cdl.computation.base.ConstantParam#

Returns a new instance of ConstantParam with the fields set to the given values.

Parameters:

value (float) – Constant value. Default: None.

Returns:

New instance of ConstantParam.

cdl.computation.base.dst_11(src: SignalObj | ImageObj, name: str, suffix: str | None = None) SignalObj | ImageObj[source]#

Create a result object, as returned by the callback function of the cdl.core.gui.processor.base.BaseProcessor.compute_11() method

Parameters:
  • src – source signal or image object

  • name – name of the function. If provided, the title of the result object will be {name}({src.short_id})|{suffix}), unless the name is a single character, in which case the title will be {src.short_id}{name}{suffix} where name is an operator and suffix is the other term of the operation.

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

Returns:

Result signal or image object

cdl.computation.base.dst_n1n(src1: SignalObj | ImageObj, src2: SignalObj | ImageObj, name: str, suffix: str | None = None) SignalObj | ImageObj[source]#

Create a result object, as returned by the callback function of the cdl.core.gui.processor.base.BaseProcessor.compute_n1n() method

Parameters:
  • src1 – input signal or image object

  • src2 – input signal or image object

  • name – name of the processing function

Returns:

Output signal or image object

cdl.computation.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_11 function

As opposed to the dst_11 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

  • suffix – suffix to add to the title

  • units – units of the output signal

  • labels – labels of the output signal

Returns:

Output signal object

cdl.computation.base.calc_resultproperties(title: str, obj: SignalObj | ImageObj, labeledfuncs: dict[str, Callable]) ResultProperties[source]#

Calculate result properties by executing a computation function on a signal/image object.

Parameters:
  • title – title of the result properties

  • obj – signal or image object

  • labeledfuncs – dictionary of labeled computation functions. The keys are the labels of the computation functions and the values are the functions themselves (each function must take a single argument - which is the data of the ROI or the whole signal/image - and return a float)

Returns:

Result properties object

Signal processing features#

cdl.computation.signal.restore_data_outside_roi(dst: SignalObj, src: SignalObj) None[source]#

Restore data outside the region of interest, after a computation, only if the source signal has a ROI, 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

class cdl.computation.signal.Wrap11Func(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 inside DataLab’s infrastructure to perform computations with cdl.core.gui.processor.signal.SignalProcessor.

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 cdl.obj.SignalObj object.

Example

>>> import numpy as np
>>> from cdl.computation.signal import Wrap11Func
>>> import cdl.obj
>>> def square(y):
...     return y**2
>>> compute_square = Wrap11Func(square)
>>> x = np.linspace(0, 10, 100)
>>> y = np.sin(x)
>>> sig0 = cdl.obj.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

cdl.computation.signal.compute_addition(dst: SignalObj, src: SignalObj) SignalObj[source]#

Add dst and src signals and return dst signal modified in place

Parameters:
  • dst – destination signal

  • src – source signal

Returns:

Modified dst signal (modified in place)

cdl.computation.signal.compute_product(dst: SignalObj, src: SignalObj) SignalObj[source]#

Multiply dst and src signals and return dst signal modified in place

Parameters:
  • dst – destination signal

  • src – source signal

Returns:

Modified dst signal (modified in place)

cdl.computation.signal.compute_addition_constant(src: SignalObj, p: ConstantParam) SignalObj[source]#

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

Parameters:
  • src – input signal object

  • p – constant value

Returns:

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

cdl.computation.signal.compute_difference_constant(src: SignalObj, p: ConstantParam) SignalObj[source]#

Subtract a constant value from a signal

Parameters:
  • src – input signal object

  • p – constant value

Returns:

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

cdl.computation.signal.compute_product_constant(src: SignalObj, p: ConstantParam) SignalObj[source]#

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

Parameters:
  • src – input signal object

  • p – constant value

Returns:

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

cdl.computation.signal.compute_division_constant(src: SignalObj, p: ConstantParam) SignalObj[source]#

Divide a signal by a constant value

Parameters:
  • src – input signal object

  • p – constant value

Returns:

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

cdl.computation.signal.compute_arithmetic(src1: SignalObj, src2: SignalObj, p: ArithmeticParam) SignalObj[source]#

Perform arithmetic operation on two signals

Parameters:
  • src1 – source signal 1

  • src2 – source signal 2

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_difference(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute difference between two signals

Note

If uncertainty is available, it is propagated.

Parameters:
  • src1 – source signal 1

  • src2 – source signal 2

Returns:

Result signal object src1 - src2

cdl.computation.signal.compute_quadratic_difference(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute quadratic difference between two signals

Note

If uncertainty is available, it is propagated.

Parameters:
  • src1 – source signal 1

  • src2 – source signal 2

Returns:

Result signal object (src1 - src2) / sqrt(2.0)

cdl.computation.signal.compute_division(src1: SignalObj, src2: SignalObj) SignalObj[source]#

Compute division between two signals

Parameters:
  • src1 – source signal 1

  • src2 – source signal 2

Returns:

Result signal object src1 / src2

cdl.computation.signal.extract_multiple_roi(src: SignalObj, group: DataSetGroup) SignalObj[source]#

Extract multiple regions of interest from data

Parameters:
  • src – source signal

  • group – group of parameters

Returns:

Signal with multiple regions of interest

cdl.computation.signal.extract_single_roi(src: SignalObj, p: ROI1DParam) SignalObj[source]#

Extract single region of interest from data

Parameters:
  • src – source signal

  • p – ROI parameters

Returns:

Signal with single region of interest

cdl.computation.signal.compute_swap_axes(src: SignalObj) SignalObj[source]#

Swap axes

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_abs(src: SignalObj) SignalObj[source]#

Compute absolute value with numpy.absolute

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_re(src: SignalObj) SignalObj[source]#

Compute real part with numpy.real()

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_im(src: SignalObj) SignalObj[source]#

Compute imaginary part with numpy.imag()

Parameters:

src – source signal

Returns:

Result signal object

class cdl.computation.signal.DataTypeSParam[source]#

Convert signal data type parameters

dtype_str#

Destination data type. Output image data type. Single choice from: ‘float32’, ‘float64’, ‘complex128’. Default: ‘float32’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(dtype_str: str) cdl.computation.signal.DataTypeSParam#

Returns a new instance of DataTypeSParam with the fields set to the given values.

Parameters:

dtype_str (str) – Destination data type. Output image data type. Single choice from: ‘float32’, ‘float64’, ‘complex128’. Default: ‘float32’.

Returns:

New instance of DataTypeSParam.

cdl.computation.signal.compute_astype(src: SignalObj, p: DataTypeSParam) SignalObj[source]#

Convert data type with numpy.astype()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_log10(src: SignalObj) SignalObj[source]#

Compute Log10 with numpy.log10

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_exp(src: SignalObj) SignalObj[source]#

Compute exponential with numpy.exp

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_sqrt(src: SignalObj) SignalObj[source]#

Compute square root with numpy.sqrt

Parameters:

src – source signal

Returns:

Result signal object

class cdl.computation.signal.PowerParam[source]#

Power parameters

power#

Default: 2.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(power: float) cdl.computation.signal.PowerParam#

Returns a new instance of PowerParam with the fields set to the given values.

Parameters:

power (float) – Default: 2.0.

Returns:

New instance of PowerParam.

cdl.computation.signal.compute_power(src: SignalObj, p: PowerParam) SignalObj[source]#

Compute power with numpy.power

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.PeakDetectionParam[source]#

Peak detection parameters

threshold#

Integer between 0 and 100, unit: %. Default: 30.

Type:

guidata.dataset.dataitems.IntItem

min_dist#

Minimum distance. Integer higher than 1, unit: points. Default: 1.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(threshold: int, min_dist: int) cdl.computation.signal.PeakDetectionParam#

Returns a new instance of PeakDetectionParam with the fields set to the given values.

Parameters:
  • threshold (int) – Integer between 0 and 100, unit: %. Default: 30.

  • min_dist (int) – Minimum distance. Integer higher than 1, unit: points. Default: 1.

Returns:

New instance of PeakDetectionParam.

cdl.computation.signal.compute_peak_detection(src: SignalObj, p: PeakDetectionParam) SignalObj[source]#

Peak detection with cdl.algorithms.signal.peak_indices()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_normalize(src: SignalObj, p: NormalizeParam) SignalObj[source]#

Normalize data with cdl.algorithms.signal.normalize()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_derivative(src: SignalObj) SignalObj[source]#

Compute derivative with numpy.gradient()

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_integral(src: SignalObj) SignalObj[source]#

Compute integral with scipy.integrate.cumulative_trapezoid()

Parameters:

src – source signal

Returns:

Result signal object

class cdl.computation.signal.XYCalibrateParam[source]#

Signal calibration parameters

axis#

Calibrate. Single choice from: ‘x’, ‘y’. Default: ‘y’.

Type:

guidata.dataset.dataitems.ChoiceItem

a#

Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

b#

Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(axis: str, a: float, b: float) cdl.computation.signal.XYCalibrateParam#

Returns a new instance of XYCalibrateParam with the fields set to the given values.

Parameters:
  • axis (str) – Calibrate. Single choice from: ‘x’, ‘y’. Default: ‘y’.

  • a (float) – Default: 1.0.

  • b (float) – Default: 0.0.

Returns:

New instance of XYCalibrateParam.

cdl.computation.signal.compute_calibration(src: SignalObj, p: XYCalibrateParam) SignalObj[source]#

Compute linear calibration

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_clip(src: SignalObj, p: ClipParam) SignalObj[source]#

Compute maximum data clipping with numpy.clip()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_offset_correction(src: SignalObj, p: ROI1DParam) SignalObj[source]#

Correct offset: subtract the mean value of the signal in the specified range (baseline correction)

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_gaussian_filter(src: SignalObj, p: GaussianParam) SignalObj[source]#

Compute gaussian filter with scipy.ndimage.gaussian_filter()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_moving_average(src: SignalObj, p: MovingAverageParam) SignalObj[source]#

Compute moving average with scipy.ndimage.uniform_filter()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_moving_median(src: SignalObj, p: MovingMedianParam) SignalObj[source]#

Compute moving median with scipy.ndimage.median_filter()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_wiener(src: SignalObj) SignalObj[source]#

Compute Wiener filter with scipy.signal.wiener()

Parameters:

src – source signal

Returns:

Result signal object

class cdl.computation.signal.FilterType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Filter types

class cdl.computation.signal.BaseHighLowBandParam[source]#

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

method#

Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

Type:

guidata.dataset.dataitems.ChoiceItem

order#

Filter order. Integer higher than 1. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

f_cut0#

Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

f_cut1#

High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

rp#

Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

rs#

Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, order: int, f_cut0: float, f_cut1: float, rp: float, rs: float) cdl.computation.signal.BaseHighLowBandParam#

Returns a new instance of BaseHighLowBandParam with the fields set to the given values.

Parameters:
  • method (str) – Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

  • order (int) – Filter order. Integer higher than 1. Default: 3.

  • f_cut0 (float) – Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • f_cut1 (float) – High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • rp (float) – Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

  • rs (float) – Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Returns:

New instance of BaseHighLowBandParam.

static get_nyquist_frequency(obj: SignalObj) float[source]#

Return the Nyquist frequency of a signal object

Parameters:

obj – signal object

update_from_signal(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 cdl.computation.signal.LowPassFilterParam[source]#

Low-pass filter parameters

method#

Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

Type:

guidata.dataset.dataitems.ChoiceItem

order#

Filter order. Integer higher than 1. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

f_cut0#

Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

f_cut1#

High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

rp#

Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

rs#

Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, order: int, f_cut0: float, f_cut1: float, rp: float, rs: float) cdl.computation.signal.LowPassFilterParam#

Returns a new instance of LowPassFilterParam with the fields set to the given values.

Parameters:
  • method (str) – Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

  • order (int) – Filter order. Integer higher than 1. Default: 3.

  • f_cut0 (float) – Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • f_cut1 (float) – High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • rp (float) – Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

  • rs (float) – Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Returns:

New instance of LowPassFilterParam.

class cdl.computation.signal.HighPassFilterParam[source]#

High-pass filter parameters

method#

Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

Type:

guidata.dataset.dataitems.ChoiceItem

order#

Filter order. Integer higher than 1. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

f_cut0#

Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

f_cut1#

High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

rp#

Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

rs#

Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, order: int, f_cut0: float, f_cut1: float, rp: float, rs: float) cdl.computation.signal.HighPassFilterParam#

Returns a new instance of HighPassFilterParam with the fields set to the given values.

Parameters:
  • method (str) – Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

  • order (int) – Filter order. Integer higher than 1. Default: 3.

  • f_cut0 (float) – Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • f_cut1 (float) – High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • rp (float) – Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

  • rs (float) – Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Returns:

New instance of HighPassFilterParam.

class cdl.computation.signal.BandPassFilterParam[source]#

Band-pass filter parameters

method#

Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

Type:

guidata.dataset.dataitems.ChoiceItem

order#

Filter order. Integer higher than 1. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

f_cut0#

Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

f_cut1#

High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

rp#

Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

rs#

Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, order: int, f_cut0: float, f_cut1: float, rp: float, rs: float) cdl.computation.signal.BandPassFilterParam#

Returns a new instance of BandPassFilterParam with the fields set to the given values.

Parameters:
  • method (str) – Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

  • order (int) – Filter order. Integer higher than 1. Default: 3.

  • f_cut0 (float) – Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • f_cut1 (float) – High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • rp (float) – Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

  • rs (float) – Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Returns:

New instance of BandPassFilterParam.

class cdl.computation.signal.BandStopFilterParam[source]#

Band-stop filter parameters

method#

Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

Type:

guidata.dataset.dataitems.ChoiceItem

order#

Filter order. Integer higher than 1. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

f_cut0#

Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

f_cut1#

High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

rp#

Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

rs#

Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, order: int, f_cut0: float, f_cut1: float, rp: float, rs: float) cdl.computation.signal.BandStopFilterParam#

Returns a new instance of BandStopFilterParam with the fields set to the given values.

Parameters:
  • method (str) – Filter method. Single choice from: ‘bessel’, ‘butter’, ‘cheby1’, ‘cheby2’, ‘ellip’. Default: ‘bessel’.

  • order (int) – Filter order. Integer higher than 1. Default: 3.

  • f_cut0 (float) – Low cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • f_cut1 (float) – High cutoff frequency. Float higher than 0, non zero, unit: hz. Default: None.

  • rp (float) – Passband ripple. Float higher than 0, non zero, unit: db. Default: 1.

  • rs (float) – Stopband attenuation. Float higher than 0, non zero, unit: db. Default: 1.

Returns:

New instance of BandStopFilterParam.

cdl.computation.signal.compute_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

cdl.computation.signal.compute_fft(src: SignalObj, p: FFTParam | None = None) SignalObj[source]#

Compute FFT with cdl.algorithms.signal.fft1d()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_ifft(src: SignalObj, p: FFTParam | None = None) SignalObj[source]#

Compute iFFT with cdl.algorithms.signal.ifft1d()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_magnitude_spectrum(src: SignalObj, p: SpectrumParam | None = None) SignalObj[source]#

Compute magnitude spectrum with cdl.algorithms.signal.magnitude_spectrum()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_phase_spectrum(src: SignalObj) SignalObj[source]#

Compute phase spectrum with cdl.algorithms.signal.phase_spectrum()

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_psd(src: SignalObj, p: SpectrumParam | None = None) SignalObj[source]#

Compute power spectral density with cdl.algorithms.signal.psd()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.PolynomialFitParam[source]#

Polynomial fitting parameters

degree#

Integer between 1 and 10. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(degree: int) cdl.computation.signal.PolynomialFitParam#

Returns a new instance of PolynomialFitParam with the fields set to the given values.

Parameters:

degree (int) – Integer between 1 and 10. Default: 3.

Returns:

New instance of PolynomialFitParam.

cdl.computation.signal.compute_histogram(src: SignalObj, p: HistogramParam) SignalObj[source]#

Compute histogram with numpy.histogram()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.InterpolationParam[source]#

Interpolation parameters

method#

Interpolation method. Single choice from: ‘linear’, ‘spline’, ‘quadratic’, ‘cubic’, ‘barycentric’, ‘pchip’. Default: ‘linear’.

Type:

guidata.dataset.dataitems.ChoiceItem

fill_value#

Value to use for points outside the interpolation domain (used only with linear, cubic and pchip methods). Default: None.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, fill_value: float) cdl.computation.signal.InterpolationParam#

Returns a new instance of InterpolationParam with the fields set to the given values.

Parameters:
  • method (str) – Interpolation method. Single choice from: ‘linear’, ‘spline’, ‘quadratic’, ‘cubic’, ‘barycentric’, ‘pchip’. Default: ‘linear’.

  • fill_value (float) – Value to use for points outside the interpolation domain (used only with linear, cubic and pchip methods). Default: None.

Returns:

New instance of InterpolationParam.

cdl.computation.signal.compute_interpolation(src1: SignalObj, src2: SignalObj, p: InterpolationParam) SignalObj[source]#

Interpolate data with cdl.algorithms.signal.interpolate()

Parameters:
  • src1 – source signal 1

  • src2 – source signal 2

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.ResamplingParam[source]#

Resample parameters

method#

Interpolation method. Single choice from: ‘linear’, ‘spline’, ‘quadratic’, ‘cubic’, ‘barycentric’, ‘pchip’. Default: ‘linear’.

Type:

guidata.dataset.dataitems.ChoiceItem

fill_value#

Value to use for points outside the interpolation domain (used only with linear, cubic and pchip methods). Default: None.

Type:

guidata.dataset.dataitems.FloatItem

xmin#

Xmin. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

xmax#

Xmax. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

mode#

Single choice from: ‘dx’, ‘nbpts’. Default: ‘nbpts’.

Type:

guidata.dataset.dataitems.ChoiceItem

dx#

ΔX. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

nbpts#

Number of points. Default: None.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(method: str, fill_value: float, xmin: float, xmax: float, mode: str, dx: float, nbpts: int) cdl.computation.signal.ResamplingParam#

Returns a new instance of ResamplingParam with the fields set to the given values.

Parameters:
  • method (str) – Interpolation method. Single choice from: ‘linear’, ‘spline’, ‘quadratic’, ‘cubic’, ‘barycentric’, ‘pchip’. Default: ‘linear’.

  • fill_value (float) – Value to use for points outside the interpolation domain (used only with linear, cubic and pchip methods). Default: None.

  • xmin (float) – Xmin. Default: None.

  • xmax (float) – Xmax. Default: None.

  • mode (str) – Single choice from: ‘dx’, ‘nbpts’. Default: ‘nbpts’.

  • dx (float) – ΔX. Default: None.

  • nbpts (int) – Number of points. Default: None.

Returns:

New instance of ResamplingParam.

cdl.computation.signal.compute_resampling(src: SignalObj, p: ResamplingParam) SignalObj[source]#

Resample data with cdl.algorithms.signal.interpolate()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.DetrendingParam[source]#

Detrending parameters

method#

Detrending method. Single choice from: ‘linear’, ‘constant’. Default: ‘linear’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(method: str) cdl.computation.signal.DetrendingParam#

Returns a new instance of DetrendingParam with the fields set to the given values.

Parameters:

method (str) – Detrending method. Single choice from: ‘linear’, ‘constant’. Default: ‘linear’.

Returns:

New instance of DetrendingParam.

cdl.computation.signal.compute_detrending(src: SignalObj, p: DetrendingParam) SignalObj[source]#

Detrend data with scipy.signal.detrend()

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_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 object

class cdl.computation.signal.WindowingParam[source]#

Windowing parameters

method#

Single choice from: ‘barthann’, ‘bartlett’, ‘blackman’, ‘blackman-harris’, ‘bohman’, ‘boxcar’, ‘cosine’, ‘exponential’, ‘flat-top’, ‘gaussian’, ‘hamming’, ‘hanning’, ‘kaiser’, ‘lanczos’, ‘nuttall’, ‘parzen’, ‘rectangular’, ‘taylor’, ‘tukey’. Default: ‘hamming’.

Type:

guidata.dataset.dataitems.ChoiceItem

alpha#

Shape parameter of the tukey windowing function. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

beta#

Shape parameter of the kaiser windowing function. Default: 14.0.

Type:

guidata.dataset.dataitems.FloatItem

sigma#

Shape parameter of the gaussian windowing function. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, alpha: float, beta: float, sigma: float) cdl.computation.signal.WindowingParam#

Returns a new instance of WindowingParam with the fields set to the given values.

Parameters:
  • method (str) – Single choice from: ‘barthann’, ‘bartlett’, ‘blackman’, ‘blackman-harris’, ‘bohman’, ‘boxcar’, ‘cosine’, ‘exponential’, ‘flat-top’, ‘gaussian’, ‘hamming’, ‘hanning’, ‘kaiser’, ‘lanczos’, ‘nuttall’, ‘parzen’, ‘rectangular’, ‘taylor’, ‘tukey’. Default: ‘hamming’.

  • alpha (float) – Shape parameter of the tukey windowing function. Default: 0.5.

  • beta (float) – Shape parameter of the kaiser windowing function. Default: 14.0.

  • sigma (float) – Shape parameter of the gaussian windowing function. Default: 0.5.

Returns:

New instance of WindowingParam.

cdl.computation.signal.compute_windowing(src: SignalObj, p: WindowingParam) SignalObj[source]#

Compute windowing (available methods: hamming, hanning, bartlett, blackman, tukey, rectangular) with cdl.algorithms.signal.windowing()

Parameters:
  • dst – destination signal

  • src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_reverse_x(src: SignalObj) SignalObj[source]#

Reverse x-axis

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.calc_resultshape(title: str, shape: Literal['rectangle', 'circle', 'ellipse', 'segment', 'marker', 'point', 'polygon'], obj: SignalObj, func: Callable, *args: Any, add_label: bool = False) ResultShape | None[source]#

Calculate result shape by executing a computation function on a signal object, taking into account the signal ROIs.

Parameters:
  • title – result title

  • shape – result shape kind

  • obj – input image object

  • func – computation function

  • *args – computation function arguments

  • add_label – if True, add a label item (and the geometrical shape) to plot (default to False)

Returns:

Result shape object or None if no result is found

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 1D NumPy array (or a list, or a tuple) containing the result of the computation.

class cdl.computation.signal.FWHMParam[source]#

FWHM parameters

method#

Single choice from: ‘zero-crossing’, ‘gauss’, ‘lorentz’, ‘voigt’. Default: ‘zero-crossing’.

Type:

guidata.dataset.dataitems.ChoiceItem

xmin#

XMIN. Lower x boundary (empty for no limit, i.e. Start of the signal). Default: None.

Type:

guidata.dataset.dataitems.FloatItem

xmax#

XMAX. Upper x boundary (empty for no limit, i.e. End of the signal). Default: None.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(method: str, xmin: float, xmax: float) cdl.computation.signal.FWHMParam#

Returns a new instance of FWHMParam with the fields set to the given values.

Parameters:
  • method (str) – Single choice from: ‘zero-crossing’, ‘gauss’, ‘lorentz’, ‘voigt’. Default: ‘zero-crossing’.

  • xmin (float) – XMIN. Lower x boundary (empty for no limit, i.e. Start of the signal). Default: None.

  • xmax (float) – XMAX. Upper x boundary (empty for no limit, i.e. End of the signal). Default: None.

Returns:

New instance of FWHMParam.

cdl.computation.signal.compute_fwhm(obj: SignalObj, param: FWHMParam) ResultShape | None[source]#

Compute FWHM with cdl.algorithms.signal.fwhm()

Parameters:
  • obj – source signal

  • param – parameters

Returns:

Segment coordinates

cdl.computation.signal.compute_fw1e2(obj: SignalObj) ResultShape | None[source]#

Compute FW at 1/e² with cdl.algorithms.signal.fw1e2()

Parameters:

obj – source signal

Returns:

Segment coordinates

cdl.computation.signal.compute_stats(obj: SignalObj) ResultProperties[source]#

Compute statistics on a signal

Parameters:

obj – source signal

Returns:

Result properties object

cdl.computation.signal.compute_bandwidth_3db(obj: SignalObj) ResultProperties[source]#

Compute bandwidth at -3 dB with cdl.algorithms.signal.bandwidth()

Parameters:

obj – source signal

Returns:

Result properties with bandwidth

class cdl.computation.signal.DynamicParam[source]#

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

full_scale#

Float higher than 0.0, unit: v. Default: 0.16.

Type:

guidata.dataset.dataitems.FloatItem

unit#

Unit for sinad. Single choice from: ‘dBc’, ‘dBFS’. Default: ‘dBc’.

Type:

guidata.dataset.dataitems.ChoiceItem

nb_harm#

Number of harmonics. Number of harmonics to consider for thd. Integer higher than 1. Default: 5.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(full_scale: float, unit: str, nb_harm: int) cdl.computation.signal.DynamicParam#

Returns a new instance of DynamicParam with the fields set to the given values.

Parameters:
  • full_scale (float) – Float higher than 0.0, unit: v. Default: 0.16.

  • unit (str) – Unit for sinad. Single choice from: ‘dBc’, ‘dBFS’. Default: ‘dBc’.

  • nb_harm (int) – Number of harmonics. Number of harmonics to consider for thd. Integer higher than 1. Default: 5.

Returns:

New instance of DynamicParam.

cdl.computation.signal.compute_dynamic_parameters(src: SignalObj, p: DynamicParam) ResultProperties[source]#

Compute Dynamic parameters using the following functions:

Parameters:
  • src – source signal

  • p – parameters

Returns:

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

cdl.computation.signal.compute_sampling_rate_period(obj: SignalObj) ResultProperties[source]#

Compute sampling rate and period using the following functions:

Parameters:

obj – source signal

Returns:

Result properties with sampling rate and period

cdl.computation.signal.compute_contrast(obj: SignalObj) ResultProperties[source]#

Compute contrast with cdl.algorithms.signal.contrast()

cdl.computation.signal.compute_x_at_minmax(obj: SignalObj) ResultProperties[source]#

Compute x at min/max

Image processing features#

Base image processing features#

cdl.computation.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, 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

class cdl.computation.image.Wrap11Func(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 inside DataLab’s infrastructure to perform computations with cdl.core.gui.processor.image.ImageProcessor.

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 cdl.obj.ImageObj object.

Example

>>> import numpy as np
>>> from cdl.computation.image import Wrap11Func
>>> import cdl.obj
>>> def add_noise(data):
...     return data + np.random.random(data.shape)
>>> compute_add_noise = Wrap11Func(add_noise)
>>> data= np.ones((100, 100))
>>> ima0 = cdl.obj.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

cdl.computation.image.dst_11_signal(src: ImageObj, name: str, suffix: str | None = None) SignalObj[source]#

Create a result signal object, as returned by the callback function of the cdl.core.gui.processor.base.BaseProcessor.compute_11() method

Parameters:
  • src – input image object

  • name – name of the processing function

Returns:

Output signal object

cdl.computation.image.compute_addition(dst: ImageObj, src: ImageObj) ImageObj[source]#

Add dst and src images and return dst image modified in place

Parameters:
  • dst – output image object

  • src – input image object

Returns:

Output image object (modified in place)

cdl.computation.image.compute_product(dst: ImageObj, src: ImageObj) ImageObj[source]#

Multiply dst and src images and return dst image modified in place

Parameters:
  • dst – output image object

  • src – input image object

Returns:

Output image object (modified in place)

cdl.computation.image.compute_addition_constant(src: ImageObj, p: ConstantParam) ImageObj[source]#

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

Parameters:
  • src – input image object

  • p – constant value

Returns:

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

cdl.computation.image.compute_difference_constant(src: ImageObj, p: ConstantParam) ImageObj[source]#

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

Parameters:
  • src – input image object

  • p – constant value

Returns:

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

cdl.computation.image.compute_product_constant(src: ImageObj, p: ConstantParam) ImageObj[source]#

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

Parameters:
  • src – input image object

  • p – constant value

Returns:

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

cdl.computation.image.compute_division_constant(src: ImageObj, p: ConstantParam) ImageObj[source]#

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

Parameters:
  • src – input image object

  • p – constant value

Returns:

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

cdl.computation.image.compute_arithmetic(src1: ImageObj, src2: ImageObj, p: ArithmeticParam) ImageObj[source]#

Compute arithmetic operation on two images

Parameters:
  • src1 – input image object

  • src2 – input image object

  • p – arithmetic parameters

Returns:

Result image object

cdl.computation.image.compute_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)

cdl.computation.image.compute_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)

cdl.computation.image.compute_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)

class cdl.computation.image.FlatFieldParam[source]#

Flat-field parameters

threshold#

Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(threshold: float) cdl.computation.image.FlatFieldParam#

Returns a new instance of FlatFieldParam with the fields set to the given values.

Parameters:

threshold (float) – Default: 0.0.

Returns:

New instance of FlatFieldParam.

cdl.computation.image.compute_flatfield(src1: ImageObj, src2: ImageObj, p: FlatFieldParam) ImageObj[source]#

Compute flat field correction with cdl.algorithms.image.flatfield()

Parameters:
  • src1 – raw data image object

  • src2 – flat field image object

  • p – flat field parameters

Returns:

Output image object

cdl.computation.image.compute_normalize(src: ImageObj, p: NormalizeParam) ImageObj[source]#

Normalize image data depending on its maximum, with cdl.algorithms.image.normalize()

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.LogP1Param[source]#

Log10 parameters

n#

Default: None.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(n: float) cdl.computation.image.LogP1Param#

Returns a new instance of LogP1Param with the fields set to the given values.

Parameters:

n (float) – Default: None.

Returns:

New instance of LogP1Param.

cdl.computation.image.compute_logp1(src: ImageObj, p: LogP1Param) ImageObj[source]#

Compute log10(z+n) with numpy.log10

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.RotateParam[source]#

Rotate parameters

angle#

Angle (°). Default: None.

Type:

guidata.dataset.dataitems.FloatItem

mode#

Single choice from: ‘constant’, ‘nearest’, ‘reflect’, ‘wrap’. Default: ‘constant’.

Type:

guidata.dataset.dataitems.ChoiceItem

cval#

Value used for points outside the boundaries of the input if mode is ‘constant’. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

reshape#

Reshape the output array so that the input array is contained completely in the output. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

prefilter#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

order#

Spline interpolation order. Integer between 0 and 5. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(angle: float, mode: str, cval: float, reshape: bool, prefilter: bool, order: int) cdl.computation.image.RotateParam#

Returns a new instance of RotateParam with the fields set to the given values.

Parameters:
  • angle (float) – Angle (°). Default: None.

  • mode (str) – Single choice from: ‘constant’, ‘nearest’, ‘reflect’, ‘wrap’. Default: ‘constant’.

  • cval (float) – Value used for points outside the boundaries of the input if mode is ‘constant’. Default: 0.0.

  • reshape (bool) – Reshape the output array so that the input array is contained completely in the output. Default: False.

  • prefilter (bool) – Default: True.

  • order (int) – Spline interpolation order. Integer between 0 and 5. Default: 3.

Returns:

New instance of RotateParam.

cdl.computation.image.rotate_obj_coords(angle: float, obj: ImageObj, orig: ImageObj, coords: ndarray) None[source]#

Apply rotation to coords associated to image obj

Parameters:
  • angle – rotation angle (in degrees)

  • obj – image object

  • orig – original image object

  • coords – coordinates to rotate

Returns:

Output data

cdl.computation.image.rotate_obj_alpha(obj: ImageObj, orig: ImageObj, coords: ndarray, p: RotateParam) None[source]#

Apply rotation to coords associated to image obj

cdl.computation.image.compute_rotate(src: ImageObj, p: RotateParam) ImageObj[source]#

Rotate data with scipy.ndimage.rotate()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.rotate_obj_90(dst: ImageObj, src: ImageObj, coords: ndarray) None[source]#

Apply rotation to coords associated to image obj

cdl.computation.image.compute_rotate90(src: ImageObj) ImageObj[source]#

Rotate data 90° with numpy.rot90()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.rotate_obj_270(dst: ImageObj, src: ImageObj, coords: ndarray) None[source]#

Apply rotation to coords associated to image obj

cdl.computation.image.compute_rotate270(src: ImageObj) ImageObj[source]#

Rotate data 270° with numpy.rot90()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.hflip_coords(dst: ImageObj, src: ImageObj, coords: ndarray) None[source]#

Apply HFlip to coords

cdl.computation.image.compute_fliph(src: ImageObj) ImageObj[source]#

Flip data horizontally with numpy.fliplr()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.vflip_coords(dst: ImageObj, src: ImageObj, coords: ndarray) None[source]#

Apply VFlip to coords

cdl.computation.image.compute_flipv(src: ImageObj) ImageObj[source]#

Flip data vertically with numpy.flipud()

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.GridParam[source]#

Grid parameters

direction#

Distribute over. Single choice from: ‘col’, ‘row’. Default: ‘col’.

Type:

guidata.dataset.dataitems.ChoiceItem

cols#

Columns. Integer, non zero. Default: 1.

Type:

guidata.dataset.dataitems.IntItem

rows#

Integer, non zero. Default: 1.

Type:

guidata.dataset.dataitems.IntItem

colspac#

Column spacing. Float higher than 0.0. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

rowspac#

Row spacing. Float higher than 0.0. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(direction: str, cols: int, rows: int, colspac: float, rowspac: float) cdl.computation.image.GridParam#

Returns a new instance of GridParam with the fields set to the given values.

Parameters:
  • direction (str) – Distribute over. Single choice from: ‘col’, ‘row’. Default: ‘col’.

  • cols (int) – Columns. Integer, non zero. Default: 1.

  • rows (int) – Integer, non zero. Default: 1.

  • colspac (float) – Column spacing. Float higher than 0.0. Default: 0.0.

  • rowspac (float) – Row spacing. Float higher than 0.0. Default: 0.0.

Returns:

New instance of GridParam.

class cdl.computation.image.ResizeParam[source]#

Resize parameters

zoom#

Default: None.

Type:

guidata.dataset.dataitems.FloatItem

mode#

Single choice from: ‘constant’, ‘nearest’, ‘reflect’, ‘wrap’. Default: ‘constant’.

Type:

guidata.dataset.dataitems.ChoiceItem

cval#

Value used for points outside the boundaries of the input if mode is ‘constant’. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

prefilter#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

order#

Spline interpolation order. Integer between 0 and 5. Default: 3.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(zoom: float, mode: str, cval: float, prefilter: bool, order: int) cdl.computation.image.ResizeParam#

Returns a new instance of ResizeParam with the fields set to the given values.

Parameters:
  • zoom (float) – Default: None.

  • mode (str) – Single choice from: ‘constant’, ‘nearest’, ‘reflect’, ‘wrap’. Default: ‘constant’.

  • cval (float) – Value used for points outside the boundaries of the input if mode is ‘constant’. Default: 0.0.

  • prefilter (bool) – Default: True.

  • order (int) – Spline interpolation order. Integer between 0 and 5. Default: 3.

Returns:

New instance of ResizeParam.

cdl.computation.image.compute_resize(src: ImageObj, p: ResizeParam) ImageObj[source]#

Zooming function with scipy.ndimage.zoom()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.BinningParam[source]#

Binning parameters

sx#

Cluster size (X). Number of adjacent pixels to be combined together along x-axis. Integer higher than 2. Default: 2.

Type:

guidata.dataset.dataitems.IntItem

sy#

Cluster size (Y). Number of adjacent pixels to be combined together along y-axis. Integer higher than 2. Default: 2.

Type:

guidata.dataset.dataitems.IntItem

operation#

Single choice from: ‘sum’, ‘average’, ‘median’, ‘min’, ‘max’. Default: ‘sum’.

Type:

guidata.dataset.dataitems.ChoiceItem

dtype_str#

Data type. Output image data type. Single choice from: ‘dtype’, ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘dtype’.

Type:

guidata.dataset.dataitems.ChoiceItem

change_pixel_size#

Change pixel size so that overall image size remains the same. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(sx: int, sy: int, operation: str, dtype_str: str, change_pixel_size: bool) cdl.computation.image.BinningParam#

Returns a new instance of BinningParam with the fields set to the given values.

Parameters:
  • sx (int) – Cluster size (X). Number of adjacent pixels to be combined together along x-axis. Integer higher than 2. Default: 2.

  • sy (int) – Cluster size (Y). Number of adjacent pixels to be combined together along y-axis. Integer higher than 2. Default: 2.

  • operation (str) – Single choice from: ‘sum’, ‘average’, ‘median’, ‘min’, ‘max’. Default: ‘sum’.

  • dtype_str (str) – Data type. Output image data type. Single choice from: ‘dtype’, ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘dtype’.

  • change_pixel_size (bool) – Change pixel size so that overall image size remains the same. Default: False.

Returns:

New instance of BinningParam.

cdl.computation.image.compute_binning(src: ImageObj, param: BinningParam) ImageObj[source]#

Binning function on data with cdl.algorithms.image.binning()

Parameters:
  • src – input image object

  • param – parameters

Returns:

Output image object

cdl.computation.image.extract_multiple_roi(src: ImageObj, group: DataSetGroup) ImageObj[source]#

Extract multiple regions of interest from data

Parameters:
  • src – input image object

  • group – parameters defining the regions of interest

Returns:

Output image object

cdl.computation.image.extract_single_roi(src: ImageObj, p: ROI2DParam) ImageObj[source]#

Extract single ROI

Parameters:
  • src – input image object

  • p – ROI parameters

Returns:

Output image object

class cdl.computation.image.LineProfileParam[source]#

Horizontal or vertical profile parameters

direction#

Single choice from: ‘horizontal’, ‘vertical’. Default: ‘horizontal’.

Type:

guidata.dataset.dataitems.ChoiceItem

row#

Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

col#

Column. Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(direction: str, row: int, col: int) cdl.computation.image.LineProfileParam#

Returns a new instance of LineProfileParam with the fields set to the given values.

Parameters:
  • direction (str) – Single choice from: ‘horizontal’, ‘vertical’. Default: ‘horizontal’.

  • row (int) – Integer higher than 0. Default: 0.

  • col (int) – Column. Integer higher than 0. Default: 0.

Returns:

New instance of LineProfileParam.

cdl.computation.image.compute_line_profile(src: ImageObj, p: LineProfileParam) ImageObj[source]#

Compute horizontal or vertical profile

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.SegmentProfileParam[source]#

Segment profile parameters

row1#

Start row. Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

col1#

Start column. Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

row2#

End row. Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

col2#

End column. Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(row1: int, col1: int, row2: int, col2: int) cdl.computation.image.SegmentProfileParam#

Returns a new instance of SegmentProfileParam with the fields set to the given values.

Parameters:
  • row1 (int) – Start row. Integer higher than 0. Default: 0.

  • col1 (int) – Start column. Integer higher than 0. Default: 0.

  • row2 (int) – End row. Integer higher than 0. Default: 0.

  • col2 (int) – End column. Integer higher than 0. Default: 0.

Returns:

New instance of SegmentProfileParam.

cdl.computation.image.compute_segment_profile(src: ImageObj, p: SegmentProfileParam) ImageObj[source]#

Compute segment profile

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.AverageProfileParam[source]#

Average horizontal or vertical profile parameters

direction#

Single choice from: ‘horizontal’, ‘vertical’. Default: ‘horizontal’.

Type:

guidata.dataset.dataitems.ChoiceItem

row1#

Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

row2#

Integer higher than -1. Default: -1.

Type:

guidata.dataset.dataitems.IntItem

col1#

Column 1. Integer higher than 0. Default: 0.

Type:

guidata.dataset.dataitems.IntItem

col2#

Column 2. Integer higher than -1. Default: -1.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(direction: str, row1: int, row2: int, col1: int, col2: int) cdl.computation.image.AverageProfileParam#

Returns a new instance of AverageProfileParam with the fields set to the given values.

Parameters:
  • direction (str) – Single choice from: ‘horizontal’, ‘vertical’. Default: ‘horizontal’.

  • row1 (int) – Integer higher than 0. Default: 0.

  • row2 (int) – Integer higher than -1. Default: -1.

  • col1 (int) – Column 1. Integer higher than 0. Default: 0.

  • col2 (int) – Column 2. Integer higher than -1. Default: -1.

Returns:

New instance of AverageProfileParam.

cdl.computation.image.compute_average_profile(src: ImageObj, p: AverageProfileParam) ImageObj[source]#

Compute horizontal or vertical average profile

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.RadialProfileParam[source]#

Radial profile parameters

center#

Center position. Single choice from: ‘centroid’, ‘center’, ‘user’. Default: ‘centroid’.

Type:

guidata.dataset.dataitems.ChoiceItem

x0#

XCenter. Float, unit: pixel. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

y0#

XCenter. Float, unit: pixel. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(center: str, x0: float, y0: float) cdl.computation.image.RadialProfileParam#

Returns a new instance of RadialProfileParam with the fields set to the given values.

Parameters:
  • center (str) – Center position. Single choice from: ‘centroid’, ‘center’, ‘user’. Default: ‘centroid’.

  • x0 (float) – XCenter. Float, unit: pixel. Default: None.

  • y0 (float) – XCenter. Float, unit: pixel. Default: None.

Returns:

New instance of RadialProfileParam.

update_from_image(obj: ImageObj) None[source]#

Update parameters from image

choice_callback(item, value)[source]#

Callback for choice item

cdl.computation.image.compute_radial_profile(src: ImageObj, p: RadialProfileParam) SignalObj[source]#

Compute radial profile around the centroid with cdl.algorithms.image.get_radial_profile()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_histogram(src: ImageObj, p: HistogramParam) SignalObj[source]#

Compute histogram of the image data, with numpy.histogram()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output signal object

cdl.computation.image.compute_swap_axes(src: ImageObj) ImageObj[source]#

Swap image axes with numpy.transpose()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_abs(src: ImageObj) ImageObj[source]#

Compute absolute value with numpy.absolute

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_re(src: ImageObj) ImageObj[source]#

Compute real part with numpy.real()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_im(src: ImageObj) ImageObj[source]#

Compute imaginary part with numpy.imag()

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.DataTypeIParam[source]#

Convert image data type parameters

dtype_str#

Destination data type. Output image data type. Single choice from: ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘float32’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(dtype_str: str) cdl.computation.image.DataTypeIParam#

Returns a new instance of DataTypeIParam with the fields set to the given values.

Parameters:

dtype_str (str) – Destination data type. Output image data type. Single choice from: ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘float32’.

Returns:

New instance of DataTypeIParam.

cdl.computation.image.compute_astype(src: ImageObj, p: DataTypeIParam) ImageObj[source]#

Convert image data type with cdl.algorithms.datatypes.clip_astype()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_log10(src: ImageObj) ImageObj[source]#

Compute log10 with numpy.log10

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_exp(src: ImageObj) ImageObj[source]#

Compute exponential with numpy.exp

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.ZCalibrateParam[source]#

Image linear calibration parameters

a#

Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

b#

Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(a: float, b: float) cdl.computation.image.ZCalibrateParam#

Returns a new instance of ZCalibrateParam with the fields set to the given values.

Parameters:
  • a (float) – Default: 1.0.

  • b (float) – Default: 0.0.

Returns:

New instance of ZCalibrateParam.

cdl.computation.image.compute_calibration(src: ImageObj, p: ZCalibrateParam) ImageObj[source]#

Compute linear calibration

Parameters:
  • src – input image object

  • p – calibration parameters

Returns:

Output image object

cdl.computation.image.compute_clip(src: ImageObj, p: ClipParam) ImageObj[source]#

Apply clipping with numpy.clip()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_offset_correction(src: ImageObj, p: ROI2DParam) ImageObj[source]#

Apply offset correction

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_gaussian_filter(src: ImageObj, p: GaussianParam) ImageObj[source]#

Compute gaussian filter with scipy.ndimage.gaussian_filter()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_moving_average(src: ImageObj, p: MovingAverageParam) ImageObj[source]#

Compute moving average with scipy.ndimage.uniform_filter()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_moving_median(src: ImageObj, p: MovingMedianParam) ImageObj[source]#

Compute moving median with scipy.ndimage.median_filter()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_wiener(src: ImageObj) ImageObj[source]#

Compute Wiener filter with scipy.signal.wiener()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_fft(src: ImageObj, p: FFTParam | None = None) ImageObj[source]#

Compute FFT with cdl.algorithms.image.fft2d()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_ifft(src: ImageObj, p: FFTParam | None = None) ImageObj[source]#

Compute inverse FFT with cdl.algorithms.image.ifft2d()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_magnitude_spectrum(src: ImageObj, p: SpectrumParam | None = None) ImageObj[source]#

Compute magnitude spectrum with cdl.algorithms.image.magnitude_spectrum()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_phase_spectrum(src: ImageObj) ImageObj[source]#

Compute phase spectrum with cdl.algorithms.image.phase_spectrum()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_psd(src: ImageObj, p: SpectrumParam | None = None) ImageObj[source]#

Compute power spectral density with cdl.algorithms.image.psd()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.ButterworthParam[source]#

Butterworth filter parameters

cut_off#

Cut-off frequency ratio. Cut-off frequency ratio. Float between 0.0 and 0.5. Default: 0.005.

Type:

guidata.dataset.dataitems.FloatItem

high_pass#

If true, apply high-pass filter instead of low-pass. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

order#

Order of the butterworth filter. Integer higher than 1. Default: 2.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(cut_off: float, high_pass: bool, order: int) cdl.computation.image.ButterworthParam#

Returns a new instance of ButterworthParam with the fields set to the given values.

Parameters:
  • cut_off (float) – Cut-off frequency ratio. Cut-off frequency ratio. Float between 0.0 and 0.5. Default: 0.005.

  • high_pass (bool) – If true, apply high-pass filter instead of low-pass. Default: False.

  • order (int) – Order of the butterworth filter. Integer higher than 1. Default: 2.

Returns:

New instance of ButterworthParam.

cdl.computation.image.compute_butterworth(src: ImageObj, p: ButterworthParam) ImageObj[source]#

Compute Butterworth filter with skimage.filters.butterworth()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.calc_resultshape(title: str, shape: Literal['rectangle', 'circle', 'ellipse', 'segment', 'marker', 'point', 'polygon'], obj: ImageObj, func: Callable, *args: Any, add_label: bool = False) ResultShape | None[source]#

Calculate result shape by executing a computation function on an image object, taking into account the image origin (x0, y0), scale (dx, dy) and ROIs.

Parameters:
  • title – result title

  • shape – result shape kind

  • obj – input image object

  • func – computation function

  • *args – computation function arguments

  • add_label – if True, add a label item (and the geometrical shape) to plot (default to False)

Returns:

Result shape object or None if no result is found

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], …].

cdl.computation.image.get_centroid_coords(data: ndarray) ndarray[source]#

Return centroid coordinates with cdl.algorithms.image.get_centroid_fourier()

Parameters:

data – input data

Returns:

Centroid coordinates

cdl.computation.image.compute_centroid(image: ImageObj) ResultShape | None[source]#

Compute centroid with cdl.algorithms.image.get_centroid_fourier()

Parameters:

image – input image

Returns:

Centroid coordinates

cdl.computation.image.get_enclosing_circle_coords(data: ndarray) ndarray[source]#

Return diameter coords for the circle contour enclosing image values above threshold (FWHM)

Parameters:

data – input data

Returns:

Diameter coords

cdl.computation.image.compute_enclosing_circle(image: ImageObj) ResultShape | None[source]#

Compute minimum enclosing circle with cdl.algorithms.image.get_enclosing_circle()

Parameters:

image – input image

Returns:

Diameter coords

class cdl.computation.image.HoughCircleParam[source]#

Circle Hough transform parameters

min_radius#

Radiusmin. Integer higher than 0, non zero, unit: pixels. Default: None.

Type:

guidata.dataset.dataitems.IntItem

max_radius#

Radiusmax. Integer higher than 0, non zero, unit: pixels. Default: None.

Type:

guidata.dataset.dataitems.IntItem

min_distance#

Minimal distance. Integer higher than 0. Default: None.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(min_radius: int, max_radius: int, min_distance: int) cdl.computation.image.HoughCircleParam#

Returns a new instance of HoughCircleParam with the fields set to the given values.

Parameters:
  • min_radius (int) – Radiusmin. Integer higher than 0, non zero, unit: pixels. Default: None.

  • max_radius (int) – Radiusmax. Integer higher than 0, non zero, unit: pixels. Default: None.

  • min_distance (int) – Minimal distance. Integer higher than 0. Default: None.

Returns:

New instance of HoughCircleParam.

cdl.computation.image.compute_hough_circle_peaks(image: ImageObj, p: HoughCircleParam) ResultShape | None[source]#

Compute Hough circles with cdl.algorithms.image.get_hough_circle_peaks()

Parameters:
  • image – input image

  • p – parameters

Returns:

Circle coordinates

cdl.computation.image.compute_stats(obj: ImageObj) ResultProperties[source]#

Compute statistics on an image

Parameters:

obj – input image object

Returns:

Result properties

Threshold features#

Threshold computation module#

class cdl.computation.image.threshold.ThresholdParam[source]#

Histogram threshold parameters

method#

Threshold method. Single choice from: ‘manual’, ‘isodata’, ‘li’, ‘mean’, ‘minimum’, ‘otsu’, ‘triangle’, ‘yen’. Default: ‘manual’.

Type:

guidata.dataset.dataitems.ChoiceItem

bins#

Number of bins. Integer higher than 1. Default: 256.

Type:

guidata.dataset.dataitems.IntItem

value#

Threshold value. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

operation#

Single choice from: ‘>’, ‘<’. Default: ‘>’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(method: str, bins: int, value: float, operation: str) cdl.computation.image.threshold.ThresholdParam#

Returns a new instance of ThresholdParam with the fields set to the given values.

Parameters:
  • method (str) – Threshold method. Single choice from: ‘manual’, ‘isodata’, ‘li’, ‘mean’, ‘minimum’, ‘otsu’, ‘triangle’, ‘yen’. Default: ‘manual’.

  • bins (int) – Number of bins. Integer higher than 1. Default: 256.

  • value (float) – Threshold value. Default: 0.0.

  • operation (str) – Single choice from: ‘>’, ‘<’. Default: ‘>’.

Returns:

New instance of ThresholdParam.

cdl.computation.image.threshold.compute_threshold(src: ImageObj, p: ThresholdParam) ImageObj[source]#

Compute the threshold, using one of the available algorithms:

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.threshold.compute_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

cdl.computation.image.threshold.compute_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

cdl.computation.image.threshold.compute_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

cdl.computation.image.threshold.compute_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

cdl.computation.image.threshold.compute_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

cdl.computation.image.threshold.compute_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

cdl.computation.image.threshold.compute_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 features#

Exposure computation module#

class cdl.computation.image.exposure.AdjustGammaParam[source]#

Gamma adjustment parameters

gamma#

Gamma correction factor (higher values give more contrast). Float higher than 0.0. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

gain#

Gain factor (higher values give more contrast). Float higher than 0.0. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(gamma: float, gain: float) cdl.computation.image.exposure.AdjustGammaParam#

Returns a new instance of AdjustGammaParam with the fields set to the given values.

Parameters:
  • gamma (float) – Gamma correction factor (higher values give more contrast). Float higher than 0.0. Default: 1.0.

  • gain (float) – Gain factor (higher values give more contrast). Float higher than 0.0. Default: 1.0.

Returns:

New instance of AdjustGammaParam.

cdl.computation.image.exposure.compute_adjust_gamma(src: ImageObj, p: AdjustGammaParam) ImageObj[source]#

Gamma correction with skimage.exposure.adjust_gamma()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.AdjustLogParam[source]#

Logarithmic adjustment parameters

gain#

Gain factor (higher values give more contrast). Float higher than 0.0. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

inv#

If true, apply inverse logarithmic transformation. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(gain: float, inv: bool) cdl.computation.image.exposure.AdjustLogParam#

Returns a new instance of AdjustLogParam with the fields set to the given values.

Parameters:
  • gain (float) – Gain factor (higher values give more contrast). Float higher than 0.0. Default: 1.0.

  • inv (bool) – If true, apply inverse logarithmic transformation. Default: False.

Returns:

New instance of AdjustLogParam.

cdl.computation.image.exposure.compute_adjust_log(src: ImageObj, p: AdjustLogParam) ImageObj[source]#

Compute log correction with skimage.exposure.adjust_log()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.AdjustSigmoidParam[source]#

Sigmoid adjustment parameters

cutoff#

Cutoff value (higher values give more contrast). Float between 0.0 and 1.0. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

gain#

Gain factor (higher values give more contrast). Float higher than 0.0. Default: 10.0.

Type:

guidata.dataset.dataitems.FloatItem

inv#

If true, apply inverse sigmoid transformation. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(cutoff: float, gain: float, inv: bool) cdl.computation.image.exposure.AdjustSigmoidParam#

Returns a new instance of AdjustSigmoidParam with the fields set to the given values.

Parameters:
  • cutoff (float) – Cutoff value (higher values give more contrast). Float between 0.0 and 1.0. Default: 0.5.

  • gain (float) – Gain factor (higher values give more contrast). Float higher than 0.0. Default: 10.0.

  • inv (bool) – If true, apply inverse sigmoid transformation. Default: False.

Returns:

New instance of AdjustSigmoidParam.

cdl.computation.image.exposure.compute_adjust_sigmoid(src: ImageObj, p: AdjustSigmoidParam) ImageObj[source]#

Compute sigmoid correction with skimage.exposure.adjust_sigmoid()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.RescaleIntensityParam[source]#

Intensity rescaling parameters

in_range#

Input range. Min and max intensity values of input image (‘image’ refers to input image min/max levels, ‘dtype’ refers to input image data type range). Single choice from: ‘image’, ‘dtype’, ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘image’.

Type:

guidata.dataset.dataitems.ChoiceItem

out_range#

Output range. Min and max intensity values of output image (‘image’ refers to input image min/max levels, ‘dtype’ refers to input image data type range).. Single choice from: ‘image’, ‘dtype’, ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘dtype’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(in_range: str, out_range: str) cdl.computation.image.exposure.RescaleIntensityParam#

Returns a new instance of RescaleIntensityParam with the fields set to the given values.

Parameters:
  • in_range (str) – Input range. Min and max intensity values of input image (‘image’ refers to input image min/max levels, ‘dtype’ refers to input image data type range). Single choice from: ‘image’, ‘dtype’, ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘image’.

  • out_range (str) – Output range. Min and max intensity values of output image (‘image’ refers to input image min/max levels, ‘dtype’ refers to input image data type range).. Single choice from: ‘image’, ‘dtype’, ‘float32’, ‘float64’, ‘complex128’, ‘uint8’, ‘int16’, ‘uint16’, ‘int32’. Default: ‘dtype’.

Returns:

New instance of RescaleIntensityParam.

cdl.computation.image.exposure.compute_rescale_intensity(src: ImageObj, p: RescaleIntensityParam) ImageObj[source]#

Rescale image intensity levels with skimage.exposure.rescale_intensity()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.EqualizeHistParam[source]#

Histogram equalization parameters

nbins#

Number of bins. Number of bins for image histogram. Integer higher than 1. Default: 256.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(nbins: int) cdl.computation.image.exposure.EqualizeHistParam#

Returns a new instance of EqualizeHistParam with the fields set to the given values.

Parameters:

nbins (int) – Number of bins. Number of bins for image histogram. Integer higher than 1. Default: 256.

Returns:

New instance of EqualizeHistParam.

cdl.computation.image.exposure.compute_equalize_hist(src: ImageObj, p: EqualizeHistParam) ImageObj[source]#

Histogram equalization with skimage.exposure.equalize_hist()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.EqualizeAdaptHistParam[source]#

Adaptive histogram equalization parameters

nbins#

Number of bins. Number of bins for image histogram. Integer higher than 1. Default: 256.

Type:

guidata.dataset.dataitems.IntItem

clip_limit#

Clipping limit. Clipping limit (higher values give more contrast). Float between 0.0 and 1.0. Default: 0.01.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(nbins: int, clip_limit: float) cdl.computation.image.exposure.EqualizeAdaptHistParam#

Returns a new instance of EqualizeAdaptHistParam with the fields set to the given values.

Parameters:
  • nbins (int) – Number of bins. Number of bins for image histogram. Integer higher than 1. Default: 256.

  • clip_limit (float) – Clipping limit. Clipping limit (higher values give more contrast). Float between 0.0 and 1.0. Default: 0.01.

Returns:

New instance of EqualizeAdaptHistParam.

cdl.computation.image.exposure.compute_equalize_adapthist(src: ImageObj, p: EqualizeAdaptHistParam) ImageObj[source]#

Adaptive histogram equalization with skimage.exposure.equalize_adapthist()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Restoration features#

Restoration computation module#

class cdl.computation.image.restoration.DenoiseTVParam[source]#

Total Variation denoising parameters

weight#

Denoising weight. The greater weight, the more denoising (at the expense of fidelity to input). Float higher than 0, non zero. Default: 0.1.

Type:

guidata.dataset.dataitems.FloatItem

eps#

Epsilon. Relative difference of the value of the cost function that determines the stop criterion. The algorithm stops when: (e_(n-1) - e_n) < eps * e_0. Float higher than 0, non zero. Default: 0.0002.

Type:

guidata.dataset.dataitems.FloatItem

max_num_iter#

Max. iterations. Maximal number of iterations used for the optimization. Integer higher than 0, non zero. Default: 200.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(weight: float, eps: float, max_num_iter: int) cdl.computation.image.restoration.DenoiseTVParam#

Returns a new instance of DenoiseTVParam with the fields set to the given values.

Parameters:
  • weight (float) – Denoising weight. The greater weight, the more denoising (at the expense of fidelity to input). Float higher than 0, non zero. Default: 0.1.

  • eps (float) – Epsilon. Relative difference of the value of the cost function that determines the stop criterion. The algorithm stops when: (e_(n-1) - e_n) < eps * e_0. Float higher than 0, non zero. Default: 0.0002.

  • max_num_iter (int) – Max. iterations. Maximal number of iterations used for the optimization. Integer higher than 0, non zero. Default: 200.

Returns:

New instance of DenoiseTVParam.

cdl.computation.image.restoration.compute_denoise_tv(src: ImageObj, p: DenoiseTVParam) ImageObj[source]#

Compute Total Variation denoising with skimage.restoration.denoise_tv_chambolle()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.restoration.DenoiseBilateralParam[source]#

Bilateral filter denoising parameters

sigma_spatial#

σspatial. Standard deviation for range distance. A larger value results in averaging of pixels with larger spatial differences. Float higher than 0, non zero, unit: pixels. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

mode#

Single choice from: ‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’. Default: ‘constant’.

Type:

guidata.dataset.dataitems.ChoiceItem

cval#

Used in conjunction with mode ‘constant’, the value outside the image boundaries. Default: 0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(sigma_spatial: float, mode: str, cval: float) cdl.computation.image.restoration.DenoiseBilateralParam#

Returns a new instance of DenoiseBilateralParam with the fields set to the given values.

Parameters:
  • sigma_spatial (float) – σspatial. Standard deviation for range distance. A larger value results in averaging of pixels with larger spatial differences. Float higher than 0, non zero, unit: pixels. Default: 1.0.

  • mode (str) – Single choice from: ‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’. Default: ‘constant’.

  • cval (float) – Used in conjunction with mode ‘constant’, the value outside the image boundaries. Default: 0.

Returns:

New instance of DenoiseBilateralParam.

cdl.computation.image.restoration.compute_denoise_bilateral(src: ImageObj, p: DenoiseBilateralParam) ImageObj[source]#

Compute bilateral filter denoising with skimage.restoration.denoise_bilateral()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.restoration.DenoiseWaveletParam[source]#

Wavelet denoising parameters

wavelet#

Single choice from: ‘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’. Default: ‘sym9’.

Type:

guidata.dataset.dataitems.ChoiceItem

mode#

Single choice from: ‘soft’, ‘hard’. Default: ‘soft’.

Type:

guidata.dataset.dataitems.ChoiceItem

method#

Single choice from: ‘BayesShrink’, ‘VisuShrink’. Default: ‘VisuShrink’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(wavelet: str, mode: str, method: str) cdl.computation.image.restoration.DenoiseWaveletParam#

Returns a new instance of DenoiseWaveletParam with the fields set to the given values.

Parameters:
  • wavelet (str) – Single choice from: ‘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’. Default: ‘sym9’.

  • mode (str) – Single choice from: ‘soft’, ‘hard’. Default: ‘soft’.

  • method (str) – Single choice from: ‘BayesShrink’, ‘VisuShrink’. Default: ‘VisuShrink’.

Returns:

New instance of DenoiseWaveletParam.

cdl.computation.image.restoration.compute_denoise_wavelet(src: ImageObj, p: DenoiseWaveletParam) ImageObj[source]#

Compute Wavelet denoising with skimage.restoration.denoise_wavelet()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.restoration.compute_denoise_tophat(src: ImageObj, p: MorphologyParam) ImageObj[source]#

Denoise using White Top-Hat with skimage.morphology.white_tophat()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Morphological features#

Morphology computation module#

class cdl.computation.image.morphology.MorphologyParam[source]#

White Top-Hat parameters

radius#

Footprint (disk) radius. Integer higher than 1. Default: 1.

Type:

guidata.dataset.dataitems.IntItem

classmethod create(radius: int) cdl.computation.image.morphology.MorphologyParam#

Returns a new instance of MorphologyParam with the fields set to the given values.

Parameters:

radius (int) – Footprint (disk) radius. Integer higher than 1. Default: 1.

Returns:

New instance of MorphologyParam.

cdl.computation.image.morphology.compute_white_tophat(src: ImageObj, p: MorphologyParam) ImageObj[source]#

Compute White Top-Hat with skimage.morphology.white_tophat()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.morphology.compute_black_tophat(src: ImageObj, p: MorphologyParam) ImageObj[source]#

Compute Black Top-Hat with skimage.morphology.black_tophat()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.morphology.compute_erosion(src: ImageObj, p: MorphologyParam) ImageObj[source]#

Compute Erosion with skimage.morphology.erosion()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.morphology.compute_dilation(src: ImageObj, p: MorphologyParam) ImageObj[source]#

Compute Dilation with skimage.morphology.dilation()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.morphology.compute_opening(src: ImageObj, p: MorphologyParam) ImageObj[source]#

Compute morphological opening with skimage.morphology.opening()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.morphology.compute_closing(src: ImageObj, p: MorphologyParam) ImageObj[source]#

Compute morphological closing with skimage.morphology.closing()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Edge detection features#

Edges computation module#

class cdl.computation.image.edges.CannyParam[source]#

Canny filter parameters

sigma#

Standard deviation of the gaussian filter. Float higher than 0, non zero, unit: pixels. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

low_threshold#

Lower bound for hysteresis thresholding (linking edges). Float higher than 0. Default: 0.1.

Type:

guidata.dataset.dataitems.FloatItem

high_threshold#

Upper bound for hysteresis thresholding (linking edges). Float higher than 0. Default: 0.9.

Type:

guidata.dataset.dataitems.FloatItem

use_quantiles#

If true then treat low_threshold and high_threshold as quantiles of the edge magnitude image, rather than absolute edge magnitude values. If true then the thresholds must be in the range [0, 1]. Default: True.

Type:

guidata.dataset.dataitems.BoolItem

mode#

Single choice from: ‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’. Default: ‘constant’.

Type:

guidata.dataset.dataitems.ChoiceItem

cval#

Value to fill past edges of input if mode is constant. Default: 0.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(sigma: float, low_threshold: float, high_threshold: float, use_quantiles: bool, mode: str, cval: float) cdl.computation.image.edges.CannyParam#

Returns a new instance of CannyParam with the fields set to the given values.

Parameters:
  • sigma (float) – Standard deviation of the gaussian filter. Float higher than 0, non zero, unit: pixels. Default: 1.0.

  • low_threshold (float) – Lower bound for hysteresis thresholding (linking edges). Float higher than 0. Default: 0.1.

  • high_threshold (float) – Upper bound for hysteresis thresholding (linking edges). Float higher than 0. Default: 0.9.

  • use_quantiles (bool) – If true then treat low_threshold and high_threshold as quantiles of the edge magnitude image, rather than absolute edge magnitude values. If true then the thresholds must be in the range [0, 1]. Default: True.

  • mode (str) – Single choice from: ‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’. Default: ‘constant’.

  • cval (float) – Value to fill past edges of input if mode is constant. Default: 0.0.

Returns:

New instance of CannyParam.

cdl.computation.image.edges.compute_canny(src: ImageObj, p: CannyParam) ImageObj[source]#

Compute Canny filter with skimage.feature.canny()

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.edges.compute_roberts(src: ImageObj) ImageObj[source]#

Compute Roberts filter with skimage.filters.roberts()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_prewitt(src: ImageObj) ImageObj[source]#

Compute Prewitt filter with skimage.filters.prewitt()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_prewitt_h(src: ImageObj) ImageObj[source]#

Compute horizontal Prewitt filter with skimage.filters.prewitt_h()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_prewitt_v(src: ImageObj) ImageObj[source]#

Compute vertical Prewitt filter with skimage.filters.prewitt_v()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_sobel(src: ImageObj) ImageObj[source]#

Compute Sobel filter with skimage.filters.sobel()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_sobel_h(src: ImageObj) ImageObj[source]#

Compute horizontal Sobel filter with skimage.filters.sobel_h()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_sobel_v(src: ImageObj) ImageObj[source]#

Compute vertical Sobel filter with skimage.filters.sobel_v()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_scharr(src: ImageObj) ImageObj[source]#

Compute Scharr filter with skimage.filters.scharr()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_scharr_h(src: ImageObj) ImageObj[source]#

Compute horizontal Scharr filter with skimage.filters.scharr_h()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_scharr_v(src: ImageObj) ImageObj[source]#

Compute vertical Scharr filter with skimage.filters.scharr_v()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_farid(src: ImageObj) ImageObj[source]#

Compute Farid filter with skimage.filters.farid()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_farid_h(src: ImageObj) ImageObj[source]#

Compute horizontal Farid filter with skimage.filters.farid_h()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_farid_v(src: ImageObj) ImageObj[source]#

Compute vertical Farid filter with skimage.filters.farid_v()

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.edges.compute_laplace(src: ImageObj) ImageObj[source]#

Compute Laplace filter with skimage.filters.laplace()

Parameters:

src – input image object

Returns:

Output image object

Detection features#

Blob detection computation module#

class cdl.computation.image.detection.GenericDetectionParam[source]#

Generic detection parameters

threshold#

Relative threshold. Detection threshold, relative to difference between data maximum and minimum. Float between 0.1 and 0.9. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(threshold: float) cdl.computation.image.detection.GenericDetectionParam#

Returns a new instance of GenericDetectionParam with the fields set to the given values.

Parameters:

threshold (float) – Relative threshold. Detection threshold, relative to difference between data maximum and minimum. Float between 0.1 and 0.9. Default: 0.5.

Returns:

New instance of GenericDetectionParam.

class cdl.computation.image.detection.Peak2DDetectionParam[source]#

Peak detection parameters

threshold#

Relative threshold. Detection threshold, relative to difference between data maximum and minimum. Float between 0.1 and 0.9. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

size#

Neighborhoods size. Size of the sliding window used in maximum/minimum filtering algorithm. Integer higher than 1, unit: pixels. Default: 10.

Type:

guidata.dataset.dataitems.IntItem

create_rois#

Default: True.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(threshold: float, size: int, create_rois: bool) cdl.computation.image.detection.Peak2DDetectionParam#

Returns a new instance of Peak2DDetectionParam with the fields set to the given values.

Parameters:
  • threshold (float) – Relative threshold. Detection threshold, relative to difference between data maximum and minimum. Float between 0.1 and 0.9. Default: 0.5.

  • size (int) – Neighborhoods size. Size of the sliding window used in maximum/minimum filtering algorithm. Integer higher than 1, unit: pixels. Default: 10.

  • create_rois (bool) – Default: True.

Returns:

New instance of Peak2DDetectionParam.

cdl.computation.image.detection.compute_peak_detection(image: ImageObj, p: Peak2DDetectionParam) ResultShape | None[source]#

Compute 2D peak detection with cdl.algorithms.image.get_2d_peaks_coords()

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Peak coordinates

class cdl.computation.image.detection.ContourShapeParam[source]#

Contour shape parameters

threshold#

Relative threshold. Detection threshold, relative to difference between data maximum and minimum. Float between 0.1 and 0.9. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

shape#

Single choice from: ‘ellipse’, ‘circle’, ‘polygon’. Default: ‘ellipse’.

Type:

guidata.dataset.dataitems.ChoiceItem

classmethod create(threshold: float, shape: str) cdl.computation.image.detection.ContourShapeParam#

Returns a new instance of ContourShapeParam with the fields set to the given values.

Parameters:
  • threshold (float) – Relative threshold. Detection threshold, relative to difference between data maximum and minimum. Float between 0.1 and 0.9. Default: 0.5.

  • shape (str) – Single choice from: ‘ellipse’, ‘circle’, ‘polygon’. Default: ‘ellipse’.

Returns:

New instance of ContourShapeParam.

cdl.computation.image.detection.compute_contour_shape(image: ImageObj, p: ContourShapeParam) ResultShape | None[source]#

Compute contour shape fit with cdl.algorithms.image.get_contour_shapes()

class cdl.computation.image.detection.BaseBlobParam[source]#

Base class for blob detection parameters

min_sigma#

σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

max_sigma#

σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

Type:

guidata.dataset.dataitems.FloatItem

threshold_rel#

Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

Type:

guidata.dataset.dataitems.FloatItem

overlap#

If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(min_sigma: float, max_sigma: float, threshold_rel: float, overlap: float) cdl.computation.image.detection.BaseBlobParam#

Returns a new instance of BaseBlobParam with the fields set to the given values.

Parameters:
  • min_sigma (float) – σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

  • max_sigma (float) – σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

  • threshold_rel (float) – Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

  • overlap (float) – If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

Returns:

New instance of BaseBlobParam.

class cdl.computation.image.detection.BlobDOGParam[source]#

Blob detection using Difference of Gaussian method

min_sigma#

σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

max_sigma#

σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

Type:

guidata.dataset.dataitems.FloatItem

threshold_rel#

Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

Type:

guidata.dataset.dataitems.FloatItem

overlap#

If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

exclude_border#

If true, exclude blobs from the border of the image. Default: True.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(min_sigma: float, max_sigma: float, threshold_rel: float, overlap: float, exclude_border: bool) cdl.computation.image.detection.BlobDOGParam#

Returns a new instance of BlobDOGParam with the fields set to the given values.

Parameters:
  • min_sigma (float) – σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

  • max_sigma (float) – σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

  • threshold_rel (float) – Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

  • overlap (float) – If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

  • exclude_border (bool) – If true, exclude blobs from the border of the image. Default: True.

Returns:

New instance of BlobDOGParam.

cdl.computation.image.detection.compute_blob_dog(image: ImageObj, p: BlobDOGParam) ResultShape | None[source]#

Compute blobs using Difference of Gaussian method with cdl.algorithms.image.find_blobs_dog()

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates

class cdl.computation.image.detection.BlobDOHParam[source]#

Blob detection using Determinant of Hessian method

min_sigma#

σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

max_sigma#

σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

Type:

guidata.dataset.dataitems.FloatItem

threshold_rel#

Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

Type:

guidata.dataset.dataitems.FloatItem

overlap#

If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

log_scale#

If set intermediate values of standard deviations are interpolated using a logarithmic scale to the base 10. If not, linear interpolation is used. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(min_sigma: float, max_sigma: float, threshold_rel: float, overlap: float, log_scale: bool) cdl.computation.image.detection.BlobDOHParam#

Returns a new instance of BlobDOHParam with the fields set to the given values.

Parameters:
  • min_sigma (float) – σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

  • max_sigma (float) – σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

  • threshold_rel (float) – Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

  • overlap (float) – If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

  • log_scale (bool) – If set intermediate values of standard deviations are interpolated using a logarithmic scale to the base 10. If not, linear interpolation is used. Default: False.

Returns:

New instance of BlobDOHParam.

cdl.computation.image.detection.compute_blob_doh(image: ImageObj, p: BlobDOHParam) ResultShape | None[source]#

Compute blobs using Determinant of Hessian method with cdl.algorithms.image.find_blobs_doh()

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates

class cdl.computation.image.detection.BlobLOGParam[source]#

Blob detection using Laplacian of Gaussian method

min_sigma#

σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

max_sigma#

σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

Type:

guidata.dataset.dataitems.FloatItem

threshold_rel#

Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

Type:

guidata.dataset.dataitems.FloatItem

overlap#

If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

Type:

guidata.dataset.dataitems.FloatItem

log_scale#

If set intermediate values of standard deviations are interpolated using a logarithmic scale to the base 10. If not, linear interpolation is used. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

exclude_border#

If true, exclude blobs from the border of the image. Default: True.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(min_sigma: float, max_sigma: float, threshold_rel: float, overlap: float, log_scale: bool, exclude_border: bool) cdl.computation.image.detection.BlobLOGParam#

Returns a new instance of BlobLOGParam with the fields set to the given values.

Parameters:
  • min_sigma (float) – σmin. The minimum standard deviation for gaussian kernel. Keep this low to detect smaller blobs. Float higher than 0, non zero, unit: pixels. Default: 1.0.

  • max_sigma (float) – σmax. The maximum standard deviation for gaussian kernel. Keep this high to detect larger blobs. Float higher than 0, non zero, unit: pixels. Default: 30.0.

  • threshold_rel (float) – Relative threshold. Minimum intensity of blobs. Float between 0.0 and 1.0. Default: 0.2.

  • overlap (float) – If two blobs overlap by a fraction greater than this value, the smaller blob is eliminated. Float between 0.0 and 1.0. Default: 0.5.

  • log_scale (bool) – If set intermediate values of standard deviations are interpolated using a logarithmic scale to the base 10. If not, linear interpolation is used. Default: False.

  • exclude_border (bool) – If true, exclude blobs from the border of the image. Default: True.

Returns:

New instance of BlobLOGParam.

cdl.computation.image.detection.compute_blob_log(image: ImageObj, p: BlobLOGParam) ResultShape | None[source]#

Compute blobs using Laplacian of Gaussian method with cdl.algorithms.image.find_blobs_log()

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates

class cdl.computation.image.detection.BlobOpenCVParam[source]#

Blob detection using OpenCV

min_threshold#

Min. threshold. The minimum threshold between local maxima and minima. This parameter does not affect the quality of the blobs, only the quantity. Lower thresholds result in larger numbers of blobs. Float higher than 0.0. Default: 10.0.

Type:

guidata.dataset.dataitems.FloatItem

max_threshold#

Max. threshold. The maximum threshold between local maxima and minima. This parameter does not affect the quality of the blobs, only the quantity. Lower thresholds result in larger numbers of blobs. Float higher than 0.0. Default: 200.0.

Type:

guidata.dataset.dataitems.FloatItem

min_repeatability#

Min. repeatability. The minimum number of times a blob needs to be detected in a sequence of images to be considered valid. Integer higher than 1. Default: 2.

Type:

guidata.dataset.dataitems.IntItem

min_dist_between_blobs#

Min. distance between blobs. The minimum distance between two blobs. If blobs are found closer together than this distance, the smaller blob is removed. Float higher than 0.0, non zero. Default: 10.0.

Type:

guidata.dataset.dataitems.FloatItem

filter_by_color#

If true, the image is filtered by color instead of intensity. Default: True.

Type:

guidata.dataset.dataitems.BoolItem

blob_color#

The color of the blobs to detect (0 for dark blobs, 255 for light blobs). Default: 0.

Type:

guidata.dataset.dataitems.IntItem

filter_by_area#

If true, the image is filtered by blob area. Default: True.

Type:

guidata.dataset.dataitems.BoolItem

min_area#

Min. area. The minimum blob area. Float higher than 0.0. Default: 25.0.

Type:

guidata.dataset.dataitems.FloatItem

max_area#

Max. area. The maximum blob area. Float higher than 0.0. Default: 500.0.

Type:

guidata.dataset.dataitems.FloatItem

filter_by_circularity#

If true, the image is filtered by blob circularity. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

min_circularity#

Min. circularity. The minimum circularity of the blobs. Float between 0.0 and 1.0. Default: 0.8.

Type:

guidata.dataset.dataitems.FloatItem

max_circularity#

Max. circularity. The maximum circularity of the blobs. Float between 0.0 and 1.0. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

filter_by_inertia#

If true, the image is filtered by blob inertia. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

min_inertia_ratio#

Min. inertia ratio. The minimum inertia ratio of the blobs. Float between 0.0 and 1.0. Default: 0.6.

Type:

guidata.dataset.dataitems.FloatItem

max_inertia_ratio#

Max. inertia ratio. The maximum inertia ratio of the blobs. Float between 0.0 and 1.0. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

filter_by_convexity#

If true, the image is filtered by blob convexity. Default: False.

Type:

guidata.dataset.dataitems.BoolItem

min_convexity#

Min. convexity. The minimum convexity of the blobs. Float between 0.0 and 1.0. Default: 0.8.

Type:

guidata.dataset.dataitems.FloatItem

max_convexity#

Max. convexity. The maximum convexity of the blobs. Float between 0.0 and 1.0. Default: 1.0.

Type:

guidata.dataset.dataitems.FloatItem

classmethod create(min_threshold: float, max_threshold: float, min_repeatability: int, min_dist_between_blobs: float, filter_by_color: bool, blob_color: int, filter_by_area: bool, min_area: float, max_area: float, filter_by_circularity: bool, min_circularity: float, max_circularity: float, filter_by_inertia: bool, min_inertia_ratio: float, max_inertia_ratio: float, filter_by_convexity: bool, min_convexity: float, max_convexity: float) cdl.computation.image.detection.BlobOpenCVParam#

Returns a new instance of BlobOpenCVParam with the fields set to the given values.

Parameters:
  • min_threshold (float) – Min. threshold. The minimum threshold between local maxima and minima. This parameter does not affect the quality of the blobs, only the quantity. Lower thresholds result in larger numbers of blobs. Float higher than 0.0. Default: 10.0.

  • max_threshold (float) – Max. threshold. The maximum threshold between local maxima and minima. This parameter does not affect the quality of the blobs, only the quantity. Lower thresholds result in larger numbers of blobs. Float higher than 0.0. Default: 200.0.

  • min_repeatability (int) – Min. repeatability. The minimum number of times a blob needs to be detected in a sequence of images to be considered valid. Integer higher than 1. Default: 2.

  • min_dist_between_blobs (float) – Min. distance between blobs. The minimum distance between two blobs. If blobs are found closer together than this distance, the smaller blob is removed. Float higher than 0.0, non zero. Default: 10.0.

  • filter_by_color (bool) – If true, the image is filtered by color instead of intensity. Default: True.

  • blob_color (int) – The color of the blobs to detect (0 for dark blobs, 255 for light blobs). Default: 0.

  • filter_by_area (bool) – If true, the image is filtered by blob area. Default: True.

  • min_area (float) – Min. area. The minimum blob area. Float higher than 0.0. Default: 25.0.

  • max_area (float) – Max. area. The maximum blob area. Float higher than 0.0. Default: 500.0.

  • filter_by_circularity (bool) – If true, the image is filtered by blob circularity. Default: False.

  • min_circularity (float) – Min. circularity. The minimum circularity of the blobs. Float between 0.0 and 1.0. Default: 0.8.

  • max_circularity (float) – Max. circularity. The maximum circularity of the blobs. Float between 0.0 and 1.0. Default: 1.0.

  • filter_by_inertia (bool) – If true, the image is filtered by blob inertia. Default: False.

  • min_inertia_ratio (float) – Min. inertia ratio. The minimum inertia ratio of the blobs. Float between 0.0 and 1.0. Default: 0.6.

  • max_inertia_ratio (float) – Max. inertia ratio. The maximum inertia ratio of the blobs. Float between 0.0 and 1.0. Default: 1.0.

  • filter_by_convexity (bool) – If true, the image is filtered by blob convexity. Default: False.

  • min_convexity (float) – Min. convexity. The minimum convexity of the blobs. Float between 0.0 and 1.0. Default: 0.8.

  • max_convexity (float) – Max. convexity. The maximum convexity of the blobs. Float between 0.0 and 1.0. Default: 1.0.

Returns:

New instance of BlobOpenCVParam.

cdl.computation.image.detection.compute_blob_opencv(image: ImageObj, p: BlobOpenCVParam) ResultShape | None[source]#

Compute blobs using OpenCV with cdl.algorithms.image.find_blobs_opencv()

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates