ncempy.algo.fourier_operations module

ncempy.algo.fourier_operations.bandpass_filter(im, inner, outer, sigma)[source]

Apply a bandpass filter with smoothed edges in Fourier space.

Parameters:
  • im (ndarray, 2D) – The image to apply the bandpass filter to.

  • inner (float) – The lowest spatial frequency allowed in terms of the Nyquist frequency. Should be between 0 and 0.5.

  • outer (float) – The highest spatial frequency allowed in terms of the Nyquist frequency. Should be between 0 and 0.5.

  • sigma (float) – The standard deviation of the Gaussian smoothing to remove hard edges.

Returns:

The image with the bandpass filter applied.

Return type:

ndarray, 2D

ncempy.algo.fourier_operations.rotateImage(im, theta, pad=False)[source]

Use three shears in Fourier space to exactly (and reversibly) rotate an image.

Currently only works for square images.

Parameters:
  • im (ndarray, 2D) – The image to rotate

  • theta (float) – The angle to rotate by in radians

  • pad (bool) – Add padding to the image before rotating

ncempy.algo.fourier_operations.shearImage(im, dim, shear_factor)[source]

Exact shear of an image using the frequency space of the FFT of the image.

Currently only works for square images.

Parameters:
  • im (ndarray, 2D) – The image to shear.

  • dim (int) – The axis to shear along

  • shear_factor (float) – The amount of shear.

Returns:

The sheared image.

Return type:

ndarray

ncempy.algo.fourier_operations.shiftImage(im, shift)[source]

Exact shear of an image using the frequency space of the FFT of the image.

Parameters:
  • im (ndarray, 2D) – The image to shear.

  • shift (tuple of floats) – The number of pixels to shift in each direction

Returns:

The shifted image.

Return type:

ndarray