# Data conversion methods¶

 odt_to_ri(f, res, nm) Convert the ODT object function to refractive index opt_to_ri(f, res, nm) Convert the OPT object function to refractive index sinogram_as_radon(uSin[, align]) Compute the phase from a complex wave field sinogram sinogram_as_rytov(uSin[, u0, align]) Convert the complex wave field sinogram to the Rytov phase

## Sinogram preparation¶

Tomographic data sets consist of detector images for different rotational positions $$\phi_0$$ of the object. Sinogram preparation means that the measured field $$u(\mathbf{r})$$ is transformed to either the Rytov approximation (diffraction tomography) or the Radon phase (classical tomography).

odtbrain.sinogram_as_radon(uSin, align=True)

Compute the phase from a complex wave field sinogram

This step is essential when using the ray approximation before computation of the refractive index with the inverse Radon transform.

Parameters
• uSin (2d or 3d complex ndarray) – The background-corrected sinogram of the complex scattered wave $$u(\mathbf{r})/u_0(\mathbf{r})$$. The first axis iterates through the angles $$\phi_0$$.

• align (bool) – Tries to correct for a phase offset in the phase sinogram.

Returns

phase – The unwrapped phase array corresponding to uSin.

Return type

2d or 3d real ndarray

skimage.restoration.unwrap_phase

phase unwrapping

radontea.backproject_3d

e.g. reconstruction via backprojection

odtbrain.sinogram_as_rytov(uSin, u0=1, align=True)

Convert the complex wave field sinogram to the Rytov phase

This method applies the Rytov approximation to the recorded complex wave sinogram. To achieve this, the following filter is applied:

$u_\mathrm{B}(\mathbf{r}) = u_\mathrm{0}(\mathbf{r}) \ln\!\left( \frac{u_\mathrm{R}(\mathbf{r})}{u_\mathrm{0}(\mathbf{r})} +1 \right)$

This filter step effectively replaces the Born approximation $$u_\mathrm{B}(\mathbf{r})$$ with the Rytov approximation $$u_\mathrm{R}(\mathbf{r})$$, assuming that the scattered field is equal to $$u(\mathbf{r})\approx u_\mathrm{R}(\mathbf{r})+ u_\mathrm{0}(\mathbf{r})$$.

Parameters
• uSin (2d or 3d complex ndarray) – The sinogram of the complex wave $$u_\mathrm{R}(\mathbf{r}) + u_\mathrm{0}(\mathbf{r})$$. The first axis iterates through the angles $$\phi_0$$.

• u0 (ndarray of dimension as uSin or less, or int.) – The incident plane wave $$u_\mathrm{0}(\mathbf{r})$$ at the detector. If u0 is “1”, it is assumed that the data is already background-corrected ( uSin $$= \frac{u_\mathrm{R}(\mathbf{r})}{ u_\mathrm{0}(\mathbf{r})} + 1$$ ). Note that if the reconstruction distance $$l_\mathrm{D}$$ of the original experiment is non-zero and u0 is set to 1, then the reconstruction will be wrong; the field is not focused to the center of the reconstruction volume.

• align (bool) – Tries to correct for a phase offset in the phase sinogram.

Returns

uB – The Rytov-filtered complex sinogram $$u_\mathrm{B}(\mathbf{r})$$.

Return type

2d or 3d real ndarray

## Translation of object function to refractive index¶

To obtain the refractive index map $$n(\mathbf{r})$$ from an object function $$f(\mathbf{r})$$ returned by e.g. backpropagate_3d(), an additional conversion step is necessary. For diffraction based models, odt_to_ri() must be used whereas for Radon-based models opt_to_ri() must be used.

odtbrain.odt_to_ri(f, res, nm)

Convert the ODT object function to refractive index

In ODT, the object function is defined by the Helmholtz equation

$f(\mathbf{r}) = k_\mathrm{m}^2 \left[ \left( \frac{n(\mathbf{r})}{n_\mathrm{m}} \right)^2 - 1 \right]$

with $$k_\mathrm{m} = \frac{2\pi n_\mathrm{m}}{\lambda}$$. By inverting this equation, we obtain the refractive index $$n(\mathbf{r})$$.

$n(\mathbf{r}) = n_\mathrm{m} \sqrt{\frac{f(\mathbf{r})}{k_\mathrm{m}^2} + 1 }$
Parameters
• f (n-dimensional ndarray) – The reconstructed object function $$f(\mathbf{r})$$.

• res (float) – The size of the vacuum wave length $$\lambda$$ in pixels.

• nm (float) – The refractive index of the medium $$n_\mathrm{m}$$ that surrounds the object in $$f(\mathbf{r})$$.

Returns

ri – The complex refractive index $$n(\mathbf{r})$$.

Return type

n-dimensional ndarray

Notes

Because this function computes the root of a complex number, there are several solutions to the refractive index. Always the positive (real) root of the refractive index is used.

odtbrain.opt_to_ri(f, res, nm)

Convert the OPT object function to refractive index

In OPT, the object function is computed from the raw phase data. This method converts phase data to refractive index data.

$n(\mathbf{r}) = n_\mathrm{m} + \frac{f(\mathbf{r}) \cdot \lambda}{2 \pi}$
Parameters
• f (n-dimensional ndarray) – The reconstructed object function $$f(\mathbf{r})$$.

• res (float) – The size of the vacuum wave length $$\lambda$$ in pixels.

• nm (float) – The refractive index of the medium $$n_\mathrm{m}$$ that surrounds the object in $$f(\mathbf{r})$$.

Returns

ri – The complex refractive index $$n(\mathbf{r})$$.

Return type

n-dimensional ndarray

Notes

This function is not meant to be used with diffraction tomography data. For ODT, use odt_to_ri() instead.