Operations on Images#

This section describes the operations that can be performed on images.

See also

Processing Images for more information on image processing features, or Analysis features on Images for information on analysis features on images.

../../_images/i_operation.png

Screenshot of the “Operations” menu.#

When the “Image Panel” is selected, the menus and toolbars are updated to provide image-related actions.

The “Operations” menu allows you to perform various operations on the current image or group of images. It also allows you to extract profiles, distribute images on a grid, or resize images.

Basic arithmetic operations#

Operation

Description

sum Sum

zM=k=0M1zk

average Average

zM=1Mk=0M1zk

difference Difference

z2=z1z0

quadratic_difference Quadratic difference

z2=z1z02

product Product

zM=k=0M1zk

division Division

z2=z1z0

inverse Inverse

z2=1z1

Operations with a constant#

Create a new image which is the result of a constant operation on each selected image:

Operation

Equation

constant_add Addition

zk=zk1+conv(c)

constant_substract Subtraction

zk=zk1conv(c)

constant_multiply Multiplication

zk=conv(zk1×c)

constant_divide Division

zk=conv(zk1c)

where c is the constant value and conv is the conversion function which handles data type conversion (keeping the same data type as the input image).

Real and imaginary parts#

Operation

Description

abs Absolute value

zk=|zk1|

re Real part

zk=(zk1)

im Imaginary part

zk=(zk1)

Data type conversion#

The “Convert data type” convert_dtype action allows you to convert the data type of the selected images. For integer data types, the conversion is done by clipping the values to the new data type range before effectively converting the data type. For floating point data types, the conversion is straightforward.

Note

Data type conversion uses the cdl.algorithms.datatypes.clip_astype() function which relies on numpy.ndarray.astype() function with the default parameters (casting=’unsafe’).

Basic mathematical functions#

Function

Description

exp Exponential

zk=exp(zk1)

log10 Logarithm (base 10)

zk=log10(zk1)

Log10(z+n)

zk=log10(zk1+n) (avoid Log10(0) on image background)

Other operations#

Flat-field correction#

Create a new image which is flat-field correction of the two selected images:

z1={z0zf.zfif z0>zthresholdz0otherwise

where z0 is the raw image, zf is the flat field image, zthreshold is an adjustable threshold and zf is the flat field image average value:

zf=1Nrow.Ncol.i=0Nrowj=0Ncolzf(i,j)

Note

Raw image and flat field image are supposedly already corrected by performing a dark frame subtraction.

Flip or rotation#

Create a new image by flipping or rotating the data of the selected image. The image may be flipped horizontally, vertically, or diagonally (transposition). It may be rotated by 90°, 270° or any user-defined value.

Intensity profiles#

Line profile

Extract an horizontal or vertical profile from each selected image, and create new signals from these profiles.

../../_images/i_profile.png

Line profile dialog. Parameters may also be set manually (“Edit profile parameters” button).#

Segment profile

Extract a segment profile from each selected image, and create new signals from these profiles.

Average profile

Extract an horizontal or vertical profile averaged over a rectangular area, from each selected image, and create new signals from these profiles.

../../_images/i_profile_average.png

Average profile dialog: the area is defined by a rectangle shape. Parameters may also be set manually (“Edit profile parameters” button).#

Radial profile extraction

Extract a radial profile from each selected image, and create new signals from these profiles.

The following parameters are available:

Parameter

Description

Center

Center around which the radial profile is computed: centroid, image center, or user-defined

X

X coordinate of the center (if user-defined), in pixels

Y

Y coordinate of the center (if user-defined), in pixels

Distribute images along a grid#

Feature

Description

distribute_on_grid Distribute on a grid

Distribute selected images on a regular grid

reset_positions Reset image positions

Reset the positions of the selected images to first image (x0, y0) coordinates