3D 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.
Changed in version 0.4.0.

odtbrain.apple.
apple_core_3d
(shape, res, nm)¶ Return a binary array with the apple core in 3D
Parameters:  shape (listlike, 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.
constraint_nn
(data, mask=None, bg_shell=None)¶ Nonnegativity constraint

odtbrain.apple.
constraint_sh
(data, mask=None, bg_shell=None)¶ Symmetric histogram background data constraint

odtbrain.apple.
correct
(f, res, nm, method='nn', mask=None, bg_shell_width=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
Parameters:  f (3D ndarray) – Complex objec function \(f(\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})\)
 method (str) –
One of:
 ”nn”: nonnegativity constraint (f > 0). This method resembles classic missing apple core correction.
 ”sh”: symmetric histogram constraint (background data in f). This method works well for sparsegradient data (e.g. works better than “nn” for simulated data), but might result in stripelike artifacts when applied to experimental data.
The imaginary part of the refractive index is suppressed in both cases. Note that these constraints are soft, i.e. after the final inverse Fourier transform, the conditions might not be met.
 mask (3D boolean ndarray, or None) – Optional, defines background region(s) used for enforcing method. If a boolean ndarray, the values set to True define the used background regions.
 bg_shell_width (float) – Optional, defines the width of an ellipsoid shell (outer radii matching image shape) that is used additionally for enforcing method.
 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 singleprecision floating point values (complex64).

odtbrain.apple.
count_to_half
(array)¶ Determination of halfinitial value index
Return first index at which array values decrease below 1/2 of the initial initial value array[0].

odtbrain.apple.
ellipsoid_shell
(shape, width=20)¶ Return background ellipsoid shell

odtbrain.apple.
envelope_gauss
(ftdata, core)¶ Compute a gaussianfiltered envelope, without apple core
Parameters:  ftdata (3D ndarray) – Fourier transform of the object function 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

odtbrain.apple.
spillover_region
(shape, shell=0)¶ Return boolean array for region outside ellipsoid