def imageHeaderToTable(imhdr):
    """Modify keywords to turn an image header into a table header.

    The function returns a copy of the header with some image-specific
    keywords (e.g. world coordinate system keywords and BUNIT) deleted.

    Parameters
    ----------
    imhdr: pyfits Header object
        A header for a FITS IMAGE HDU.

    Returns
    -------
    hdr: pyfits Header object
        A copy of imhdr, with certain image-specific keywords deleted.
    """
    hdr = imhdr.copy()
    for keyword in ['bscale', 'bzero', 'bunit', 'datamin', 'datamax']:
        if keyword in hdr:
            del hdr[keyword]
    keyword_list = []
    for key in ['ctype', 'crval', 'crpix', 'cdelt', 'cunit']:
        for dim in range(1, 4):
            keyword = key + str(dim)
            keyword_list.append(keyword)
    keyword_list.extend(['wcsaxes', 'pv1_0', 'pv1_1', 'pv1_2', 'pv1_6',
        'cd1_1', 'cd1_2', 'cd2_1', 'cd2_2', 'pc1_1', 'pc1_2', 'pc2_1',
        'pc2_2', 'pc3_1', 'pc3_2'])
    for alt in ['', 'a', 'b', 'c']:
        for key in keyword_list:
            keyword = key + alt
            if keyword in hdr:
                del hdr[keyword]
    return hdr
