bilinear: Bilinear interpolator

Bilinear interpolator, peak finder, line-profile for images

class BilinearImage

Bilinear interpolator for images … or any data on a regular grid

__call__()

Function f((y, x)) where f is a continuous function made from the image and (y,x)=(row, column) is the pixel coordinates in natural C-order

Parameters

x – 2-tuple of float (row, column)

Returns

Interpolated signal from the image

coarse_local_maxi(self, size_t x) → size_t

Return the nearest local maximum … without sub-pixel refinement

Parameters

idx – start index (=row*width+column)

Returns

local maximum index

local_maxi(self, coord)

Return the nearest local maximum … with sub-pixel refinement

Nearest maximum search:

steepest ascent

Sub-pixel refinement:

Second order Taylor expansion of the function; At the maximum, the first derivative is null delta = x-i = -Inverse[Hessian].gradient if Hessian is singular or |delta|>1: use a center of mass.

Parameters

coord – 2-tuple of scalar (row, column)

Returns

2-tuple of float with the nearest local maximum

map_coordinates(self, coordinates)

Map coordinates of the array on the image

Parameters

coordinates – 2-tuple of array of the same size (row_array, column_array)

Returns

array of values at given coordinates

opp_f(self, coord)

Function -f((y,x)) for peak finding via minimizer.

Gives large number outside the boundaries to return into the image

Parameters

x – 2-tuple of float in natural C order, i.e (row, column)

Returns

Negative interpolated signal from the image

profile_line(self, src, dst, int linewidth=1, method=u'mean')

Return the mean or sum of intensity profile of an image measured along a scan line.

Parameters
  • src (2-tuple of numeric scalar) – The start point of the scan line.

  • dst (2-tuple of numeric scalar) – The end point of the scan line. The destination point is included in the profile, in contrast to standard numpy indexing.

  • linewidth (int) – Width of the scanline (unit image pixel).

  • method (str) – ‘mean’ or ‘sum’ depending if we want to compute the mean intensity along the line or the sum.

Returns

The intensity profile along the scan line. The length of the profile is the ceil of the computed length of the scan line.

Return type

1d array

Inspired from skimage