def getXY(mmdict, df, rowid, size):
    """
    Get the X and Y (and some other things) coordinates for row rowid of the dataframe
    
    Parameters
    ----------
    mmdict : dictionary of mmfiles
    df : the dataframe
    rowid : row interest in the dataframe
    size : size of the image patch

    Returns
    -------
    tuple : (mfile, fid, x, y, well)
        mfile: memmap file
        fid : file id form dataframe
        x : x coordinate
        y : y coordinate
        well: what well the image is in
        
    """
    rowd = df[df['id'] == rowid]
    if len(rowd) == 0:
        print(len(rowd), rowid)
        
    row = rowd.iloc[0]
    fid = int(row['fid'])
    xc = row['xc']
    yc = row['yc']
    well = row['well']
    mfile = mmdict[row['mmfile'].strip()]
    x = int(xc) - size//2
    y = int(yc) - size//2

    shape = mfile.shape
    if x < 0:
        x = 0
    if y < 0:
        y = 0
    if x > (shape[2] - size):
        x = shape[2] - size
    if y > (shape[1] - size):
        y = shape[1] - size

    return mfile, fid, x, y, well