Give the highest contribution to the orientation

    Parameters
    ----------
    im: 2d array
        The image
    approxangle: number, optional
        The approximate angle (None if unknown)
    isshiftdft: Boolean, default False
        True if the image has been processed (DFT, fftshift)
    truesize: 2 numbers, optional
        Truesize of the image if isshiftdft is True
    rotateAngle: number, optional
        The diagonals are more sensitives than the axis.
        rotate the image to avoid pixel orientation (flat or diagonal)

    Returns
    -------
    angle: number
        The orientation of the image

    Notes
    -----
    if approxangle is specified, search only within +- pi/4

def orientation_angle(im, approxangle=None, *, isshiftdft=False, truesize=None,
                      rotateAngle=None):
    """Give the highest contribution to the orientation

    Parameters
    ----------
    im: 2d array
        The image
    approxangle: number, optional
        The approximate angle (None if unknown)
    isshiftdft: Boolean, default False
        True if the image has been processed (DFT, fftshift)
    truesize: 2 numbers, optional
        Truesize of the image if isshiftdft is True
    rotateAngle: number, optional
        The diagonals are more sensitives than the axis.
        rotate the image to avoid pixel orientation (flat or diagonal)

    Returns
    -------
    angle: number
        The orientation of the image

    Notes
    -----
    if approxangle is specified, search only within +- pi/4
    """
    im = np.asarray(im)

    # If we rotate the image first
    if rotateAngle is not None and not isshiftdft:
        # compute the scale corresponding to the image
        scale = np.sqrt(.5 * (1 + (np.tan(rotateAngle) - 1)**2 /
                              (np.tan(rotateAngle) + 1)**2))
        # rotate the image
        im = rotate_scale(im, rotateAngle, scale)

    # compute log fft (nearest interpolation as line go between pixels)
    lp = polar_fft(im, isshiftdft=isshiftdft,
                   logoutput=False, interpolation='nearest',
                   truesize=truesize)
    # get distribution
    adis = lp.sum(-1)
    if approxangle is not None:
        #-np.pi/2 as we are in fft. +- pi/4 is search window
        amin = clamp_angle(approxangle - np.pi / 4 - np.pi / 2)
        amax = clamp_angle(approxangle + np.pi / 4 - np.pi / 2)
        angles = np.linspace(-np.pi / 2, np.pi / 2,
                             lp.shape[0], endpoint=False)
        if amin > amax:
            adis[np.logical_and(angles > amax, angles < amin)] = adis.min()
        else:
            adis[np.logical_or(angles > amax, angles < amin)] = adis.min()

    # get peak pos
    ret = get_peak_pos(adis, wrap=True)
    anglestep = np.pi / lp.shape[0]

    """
    import matplotlib.pyplot as plt
    plt.figure()
    plt.plot(anglestep*np.arange(len(adis)),adis)
    #"""

    # return max (not -pi/2 as 0 is along y and we want 0 alonx x.)
    # the transformation is basically "For Free"
    ret = clamp_angle(ret * anglestep)

    # Substract rotateAngle to get the original image
    if rotateAngle is not None:
        ret = clamp_angle(ret - rotateAngle)

    return ret