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.GaussianParam#

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#

Moving average parameters

n#

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

Type:

guidata.dataset.dataitems.IntItem

classmethod create(n: int) 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.

Returns:

New instance of MovingAverageParam.

class cdl.computation.base.MovingMedianParam#

Moving median parameters

n#

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

Type:

guidata.dataset.dataitems.IntItem

classmethod create(n: int) 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.

Returns:

New instance of MovingMedianParam.

class cdl.computation.base.ClipParam#

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#

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#

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#

Return suffix for the histogram computation

Parameters:

data – data array

class cdl.computation.base.ROIDataParam#

ROI Editor data

roidata#

For convenience, this item accepts a 2d numpy array, a list of list of numbers, or none. In the end, the data is converted to a 2d numpy array of integers (if not none). Default: None.

Type:

guidata.dataset.dataitems.FloatArrayItem

singleobj#

Whether to extract the roi as a single object or not. Default: None.

Type:

guidata.dataset.dataitems.BoolItem

classmethod create(roidata: numpy.ndarray, singleobj: bool) cdl.computation.base.ROIDataParam#

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

Parameters:
  • roidata (numpy.ndarray) – For convenience, this item accepts a 2d numpy array, a list of list of numbers, or none. In the end, the data is converted to a 2d numpy array of integers (if not none). Default: None.

  • singleobj (bool) – Whether to extract the roi as a single object or not. Default: None.

Returns:

New instance of ROIDataParam.

property is_empty: bool#

Return True if there is no ROI

class cdl.computation.base.FFTParam#

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#

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.ConstantOperationParam#
Parameter used to set a constant value to used in operations (sum,

multiplication, …)

value#

Constant value. Default: None.

Type:

guidata.dataset.dataitems.FloatItem

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

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

Parameters:

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

Returns:

New instance of ConstantOperationParam.

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

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#

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#

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#

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#

class cdl.computation.signal.Wrap11Func(func: Callable, *args: Any, **kwargs: Any)#

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#

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#

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: ConstantOperationParam) SignalObj#

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: ConstantOperationParam) SignalObj#

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: ConstantOperationParam) SignalObj#

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: ConstantOperationParam) SignalObj#

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_difference(src1: SignalObj, src2: SignalObj) SignalObj#

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#

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#

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#

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#

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#

Swap axes

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_abs(src: SignalObj) SignalObj#

Compute absolute value

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_re(src: SignalObj) SignalObj#

Compute real part

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_im(src: SignalObj) SignalObj#

Compute imaginary part

Parameters:

src – source signal

Returns:

Result signal object

class cdl.computation.signal.DataTypeSParam#

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#

Convert data type

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_log10(src: SignalObj) SignalObj#

Compute Log10

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_exp(src: SignalObj) SignalObj#

Compute exponential

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_sqrt(src: SignalObj) SignalObj#

Compute square root

Parameters:

src – source signal

Returns:

Result signal object

class cdl.computation.signal.PowerParam#

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#

Compute power

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.PeakDetectionParam#

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#

Peak detection

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

Normalize data

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_derivative(src: SignalObj) SignalObj#

Compute derivative

Parameters:

src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_integral(src: SignalObj) SignalObj#

Compute integral

Parameters:

src – source signal

Returns:

Result signal object

class cdl.computation.signal.XYCalibrateParam#

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#

Compute linear calibration

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

Compute maximum data clipping

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

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#

Compute gaussian filter

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

Compute moving average

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

Compute moving median

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_wiener(src: SignalObj) SignalObj#

Compute Wiener filter

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)#

Filter types

class cdl.computation.signal.BaseHighLowBandParam#

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#

Return the Nyquist frequency of a signal object

Parameters:

obj – signal object

update_from_signal(obj: SignalObj) None#

Update the filter parameters from a signal object

Parameters:

obj – signal object

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

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#

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#

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#

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#

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#

Compute frequency filter (low-pass, high-pass, band-pass, band-stop)

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

Compute FFT

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

Compute iFFT

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

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

Compute magnitude spectrum

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_phase_spectrum(src: SignalObj) SignalObj#

Compute phase spectrum

Parameters:

src – source signal

Returns:

Result signal object

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

Compute power spectral density

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.PolynomialFitParam#

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#

Compute histogram

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.InterpolationParam#

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#

Interpolate data

Parameters:
  • src1 – source signal 1

  • src2 – source signal 2

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.ResamplingParam#

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#

Resample data

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

class cdl.computation.signal.DetrendingParam#

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#

Detrend data

Parameters:
  • src – source signal

  • p – parameters

Returns:

Result signal object

cdl.computation.signal.compute_convolution(src1: SignalObj, src2: SignalObj) SignalObj#

Compute convolution of two signals

Parameters:
  • src1 – source signal 1

  • src2 – source signal 2

Returns:

Result signal object

class cdl.computation.signal.WindowingParam#

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#

Compute windowing (available methods: hamming, hanning, bartlett, blackman, tukey, rectangular)

Parameters:
  • dst – destination signal

  • src – source signal

Returns:

Result signal object

cdl.computation.signal.compute_reverse_x(src: SignalObj) SignalObj#

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#

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#

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#

Compute FWHM

Parameters:
  • obj – source signal

  • param – parameters

Returns:

Segment coordinates

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

Compute FW at 1/e²

Parameters:

obj – source signal

Returns:

Segment coordinates

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

Compute statistics on a signal

Parameters:

obj – source signal

Returns:

Result properties object

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

Compute bandwidth

Parameters:

obj – source signal

Returns:

Result properties with bandwidth

class cdl.computation.signal.DynamicParam#

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#

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

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#

Compute sampling rate and period

Parameters:

obj – source signal

Returns:

Result properties with sampling rate and period

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

Compute contrast

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

Compute x at min/max

Image processing features#

Base image processing features#

class cdl.computation.image.Wrap11Func(func: Callable, *args: Any, **kwargs: Any)#

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.signal.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.signal 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#

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#

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#

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: ConstantOperationParam) ImageObj#

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: ConstantOperationParam) ImageObj#

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: ConstantOperationParam) ImageObj#

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: ConstantOperationParam) ImageObj#

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_difference(src1: ImageObj, src2: ImageObj) ImageObj#

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#

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#

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#

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#

Compute flat field correction

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#

Normalize image data depending on its maximum.

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.LogP1Param#

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#

Compute log10(z+n)

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.RotateParam#

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#

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#

Apply rotation to coords associated to image obj

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

Rotate data

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Apply rotation to coords associated to image obj

cdl.computation.image.compute_rotate90(src: ImageObj) ImageObj#

Rotate data 90°

Parameters:

src – input image object

Returns:

Output image object

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

Apply rotation to coords associated to image obj

cdl.computation.image.compute_rotate270(src: ImageObj) ImageObj#

Rotate data 270°

Parameters:

src – input image object

Returns:

Output image object

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

Apply HFlip to coords

cdl.computation.image.compute_fliph(src: ImageObj) ImageObj#

Flip data horizontally

Parameters:

src – input image object

Returns:

Output image object

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

Apply VFlip to coords

cdl.computation.image.compute_flipv(src: ImageObj) ImageObj#

Flip data vertically

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.GridParam#

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#

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#

Zooming function

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.BinningParam#

Binning parameters

binning_x#

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

binning_y#

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’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. 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(binning_x: int, binning_y: 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:
  • binning_x (int) – Cluster size (X). Number of adjacent pixels to be combined together along x-axis. Integer higher than 2. Default: 2.

  • binning_y (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’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. 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#

Binning function on data

Parameters:
  • src – input image object

  • param – parameters

Returns:

Output image object

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

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#

Extract single ROI

Parameters:
  • src – input image object

  • p – ROI parameters

Returns:

Output image object

class cdl.computation.image.LineProfileParam#

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#

Compute horizontal or vertical profile

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.SegmentProfileParam#

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#

Compute segment profile

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.AverageProfileParam#

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#

Compute horizontal or vertical average profile

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.RadialProfileParam#

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#

Update parameters from image

choice_callback(item, value)#

Callback for choice item

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

Compute radial profile around the centroid

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute histogram of the image data

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output signal object

cdl.computation.image.compute_swap_axes(src: ImageObj) ImageObj#

Swap image axes

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_abs(src: ImageObj) ImageObj#

Compute absolute value

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_re(src: ImageObj) ImageObj#

Compute real part

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_im(src: ImageObj) ImageObj#

Compute imaginary part

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.DataTypeIParam#

Convert image data type parameters

dtype_str#

Destination data type. Output image data type. Single choice from: ‘float32’, ‘float64’, ‘complex128’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. 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’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. Default: ‘float32’.

Returns:

New instance of DataTypeIParam.

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

Convert image data type

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_log10(src: ImageObj) ImageObj#

Compute log10

Parameters:

src – input image object

Returns:

Output image object

cdl.computation.image.compute_exp(src: ImageObj) ImageObj#

Compute exponential

Parameters:

src – input image object

Returns:

Output image object

class cdl.computation.image.ZCalibrateParam#

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#

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#

Apply clipping

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

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#

Compute gaussian filter

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute moving average

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute moving median

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_wiener(src: ImageObj) ImageObj#

Compute Wiener filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute FFT

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute inverse FFT

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute magnitude spectrum

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

cdl.computation.image.compute_phase_spectrum(src: ImageObj) ImageObj#

Compute phase spectrum

Parameters:

src – input image object

Returns:

Output image object

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

Compute power spectral density

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.ButterworthParam#

Butterworth filter parameters

cut_off#

Cut-off frequency ratio. Cut-off frequency ratio (0.0 - 1.0). Float between 0.0 and 1.0. Default: 0.5.

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 (0.0 - 1.0). Float between 0.0 and 1.0. Default: 0.5.

  • 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#

Compute Butterworth filter

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#

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#

Return centroid coordinates

Parameters:

data – input data

Returns:

Centroid coordinates

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

Compute centroid

Parameters:

image – input image

Returns:

Centroid coordinates

cdl.computation.image.get_enclosing_circle_coords(data: ndarray) ndarray#

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#

Compute minimum enclosing circle

Parameters:

image – input image

Returns:

Diameter coords

class cdl.computation.image.HoughCircleParam#

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#

Compute Hough circles

Parameters:
  • image – input image

  • p – parameters

Returns:

Circle coordinates

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

Compute statistics on an image

Parameters:

obj – input image object

Returns:

Result properties

Exposure correction features#

Exposure computation module#

class cdl.computation.image.exposure.AdjustGammaParam#

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#

Gamma correction

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.AdjustLogParam#

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#

Compute log correction

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.AdjustSigmoidParam#

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#

Compute sigmoid correction

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.RescaleIntensityParam#

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’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. 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’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. 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’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. 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’, ‘int32’, ‘int16’, ‘uint16’, ‘uint8’. Default: ‘dtype’.

Returns:

New instance of RescaleIntensityParam.

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

Rescale image intensity levels

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.EqualizeHistParam#

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#

Histogram equalization

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.exposure.EqualizeAdaptHistParam#

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#

Adaptive histogram equalization

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Restoration features#

Restoration computation module#

class cdl.computation.image.restoration.DenoiseTVParam#

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#

Compute Total Variation denoising

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.restoration.DenoiseBilateralParam#

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#

Compute bilateral filter denoising

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

class cdl.computation.image.restoration.DenoiseWaveletParam#

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#

Compute Wavelet denoising

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Denoise using White Top-Hat

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Morphological features#

Morphology computation module#

class cdl.computation.image.morphology.MorphologyParam#

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#

Compute White Top-Hat

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute Black Top-Hat

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute Erosion

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute Dilation

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute morphological opening

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute morphological closing

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

Edge detection features#

Edges computation module#

class cdl.computation.image.edges.CannyParam#

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#

Compute Canny filter

Parameters:
  • src – input image object

  • p – parameters

Returns:

Output image object

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

Compute Roberts filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute Prewitt filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute horizontal Prewitt filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute vertical Prewitt filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute Sobel filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute horizontal Sobel filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute vertical Sobel filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute Scharr filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute horizontal Scharr filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute vertical Scharr filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute Farid filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute horizontal Farid filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute vertical Farid filter

Parameters:

src – input image object

Returns:

Output image object

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

Compute Laplace filter

Parameters:

src – input image object

Returns:

Output image object

Detection features#

Blob detection computation module#

class cdl.computation.image.detection.GenericDetectionParam#

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#

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#

Compute 2D peak detection

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Peak coordinates

class cdl.computation.image.detection.ContourShapeParam#

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#

Compute contour shape fit

class cdl.computation.image.detection.BaseBlobParam#

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#

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#

Compute blobs using Difference of Gaussian method

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates

class cdl.computation.image.detection.BlobDOHParam#

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#

Compute blobs using Determinant of Hessian method

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates

class cdl.computation.image.detection.BlobLOGParam#

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#

Compute blobs using Laplacian of Gaussian method

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates

class cdl.computation.image.detection.BlobOpenCVParam#

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#

Compute blobs using OpenCV

Parameters:
  • imageOutput – input image

  • p – parameters

Returns:

Blobs coordinates