<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def openlines(image, linelength=10, dAngle=10, mask=None):
 """ Do a morphological opening along lines of different angles. Return difference between max and min response to different angles for each pixel. This effectively removes dots and only keeps lines. image - pixel image to operate on length - length of the structural element angluar_resolution - angle step for the rotating lines mask - if present, only use unmasked pixels for operations """

    nAngles = 180//dAngle
    openingstack = np.zeros((nAngles,image.shape[0],image.shape[1]),image.dtype)

    for iAngle in range(nAngles):
        angle = dAngle * iAngle
        se = strel_line(linelength,angle)
        openingstack[iAngle,:,:] = opening(image, mask=mask, footprint=se)

    imLines = np.max(openingstack,axis=0) - np.min(openingstack,axis=0)
    return imLines