Apple core correction

The missing apple core (in Fourier space) leads to ringing and blurring artifacts in optical diffraction tomography [VDYH09]. This module contains basic functions that can be used to attenuate these artifacts.

New in version 0.3.0.

odtbrain.apple.apple_core_3d(shape, res, nm)

Return a binary array with the apple core in 3D

Parameters:
  • shape (list-like, length 3) – Shape of the reconstruction volume for which to compute the apple core; The second (y-) axis is assumed to be the axis of symmetry (according to ODTbrain standard notation)
  • res (float) – Size of the vacuum wave length \(\lambda\) in pixels
  • nm (float) – Refractive index of the medium \(n_\mathrm{m}\)
Returns:

core – The mask is True for positions within the apple core

Return type:

3D ndarray

odtbrain.apple.correct(ri, res, nm, bg_mask=None, ri_min=None, ri_max=None, enforce_envelope=0.95, max_iter=100, min_diff=0.01, count=None, max_count=None)

Fill the missing apple core of the object function

Enforces ri.imag==0 and ri.real>=ri_min; This enforcement is soft, i.e. after the final inverse Fourier transform, these conditions might not be met.

Parameters:
  • ri (3D ndarray) – Complex refractive index \(n(\mathbf{r})\)
  • res (float) – Size of the vacuum wave length \(\lambda\) in pixels
  • nm (float) – Refractive index of the medium \(n_\mathrm{m}\) that surrounds the object in \(n(\mathbf{r})\)
  • bg_mask (3D boolean ndarray) – Defines background region(s) used for enforcing ri_min
  • ri_min (float) – Minimum refractive index value (condition set while iterating); If set to None, then ri_min is set to nm; the region used for enforcing this condition can be defined with bg_mask
  • ri_max (float) – Maximum refractive index value (condition set during iteration)
  • enforce_envelope (float in interval [0,1] or False) – Set the suppression factor for frequencies that are above the envelope function; disabled if set to False or 0
  • max_iter (int) – Maximum number of iterations to perform
  • min_diff (float) – Stopping criterion computed as the relative difference (relative to the first iteration norm) of the changes applied during the current iteration cur_diff: np.abs(cur_diff/norm) < min_diff
  • count (multiprocessing.Value) – May be used for tracking progress. At each iteration count.value is incremented by one.
  • max_count (multiprocessing.Value) – May be used for tracking progress; is incremented initially.

Notes

Internally, the Fourier transform is performed with single-precision floating point values (complex64).

odtbrain.apple.envelope_gauss(ftdata, core)

Compute a gaussian-filtered envelope, without apple core

Parameters:
  • ftdata (3D ndarray) – Fourier transform of the refractive index data (zero frequency not shifted to center of array)
  • core (3D ndarray (same shape as ftdata)) – Apple core (as defined by apple_core_3d())
Returns:

envelope – Envelope function in Fourier space

Return type:

3D ndarray