<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def strel_octagon(radius):
 """Create an octagonal structuring element for morphological operations radius - the distance from the origin to each edge of the octagon """

    #
    # Inscribe a diamond in a square to get an octagon.
    #
    iradius = int(radius)
    i, j = np.mgrid[-iradius:(iradius + 1), -iradius:(iradius+1)]
    #
    # The distance to the diagonal side is also iradius:
    #
    # iradius ** 2 = i**2 + j**2 and i = j
    # iradius ** 2 = 2 * i ** 2
    # i = iradius / sqrt(2)
    # i + j = iradius * sqrt(2)
    #
    dradius = float(iradius) * np.sqrt(2)
    strel = (((i+j) <= dradius) & ((i+j) >= -dradius) &
             ((i-j) <= dradius) & ((i-j) >= -dradius))
    return strel