def sinogram_as_rytov(uSin, u0=1, align=True):
    r"""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:

    .. math::
        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
    :math:`u_\mathrm{B}(\mathbf{r})` with the Rytov approximation
    :math:`u_\mathrm{R}(\mathbf{r})`, assuming that the scattered
    field is equal to
    :math:`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
        :math:`u_\mathrm{R}(\mathbf{r}) + u_\mathrm{0}(\mathbf{r})`.
        The first axis iterates through the angles :math:`\phi_0`.
    u0: ndarray of dimension as `uSin` or less, or int.
        The incident plane wave
        :math:`u_\mathrm{0}(\mathbf{r})` at the detector.
        If `u0` is "1", it is assumed that the data is already
        background-corrected (
        `uSin` :math:`= \frac{u_\mathrm{R}(\mathbf{r})}{
        u_\mathrm{0}(\mathbf{r})} + 1`
        ). Note that if the reconstruction distance :math:`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: 2d or 3d real ndarray
        The Rytov-filtered complex sinogram
        :math:`u_\mathrm{B}(\mathbf{r})`.

    See Also
    --------
    skimage.restoration.unwrap_phase: phase unwrapping
    """
    ndims = len(uSin.shape)

    # imaginary part of the complex Rytov phase
    phiR = np.angle(uSin / u0)

    # real part of the complex Rytov phase
    lna = np.log(np.absolute(uSin / u0))

    if ndims == 2:
        # unwrapping is very important
        phiR[:] = np.unwrap(phiR, axis=-1)
    else:
        # Unwrap gets the dimension of the problem from the input
        # data. Since we have a sinogram, we need to pass it the
        # slices one by one.
        for ii in range(len(phiR)):
            phiR[ii] = unwrap_phase(phiR[ii], seed=47)

    if align:
        align_unwrapped(phiR)

    # rytovSin = u0*(np.log(a/a0) + 1j*phiR)
    # u0 is one - we already did background correction

    # complex rytov phase:
    rytovSin = 1j * phiR + lna
    return u0 * rytovSin