def convert_to_imagecoord(shape, header):
arg_types = _generate_arg_types(len(shape.coord_list), shape.name)<EOL>new_coordlist = []<EOL>is_even_distance = True<EOL>coord_list_iter = iter(zip(shape.coord_list, arg_types))<EOL>new_wcs = WCS(header)<EOL>pixel_scales = proj_plane_pixel_scales(new_wcs)<EOL>for coordinate, coordinate_type in coord_list_iter:<EOL><INDENT>if coordinate_type == CoordOdd:<EOL><INDENT>even_coordinate = next(coord_list_iter)[<NUM_LIT:0>]<EOL>old_coordinate = SkyCoord(coordinate, even_coordinate,<EOL>frame=shape.coord_format, unit='<STR_LIT>',<EOL>obstime='<STR_LIT>')<EOL>new_coordlist.extend(<EOL>np.asscalar(x)<EOL>for x in old_coordinate.to_pixel(new_wcs, origin=<NUM_LIT:1>)<EOL>)<EOL><DEDENT>elif coordinate_type == Distance:<EOL><INDENT>if arg_types[-<NUM_LIT:1>] == Angle:<EOL><INDENT>degree_per_pixel = pixel_scales[<NUM_LIT:0> if is_even_distance else <NUM_LIT:1>]<EOL>is_even_distance = not is_even_distance<EOL><DEDENT>else:<EOL><INDENT>degree_per_pixel = np.sqrt(proj_plane_pixel_area(new_wcs))<EOL><DEDENT>new_coordlist.append(coordinate / degree_per_pixel)<EOL><DEDENT>elif coordinate_type == Angle:<EOL><INDENT>new_angle = _estimate_angle(coordinate,<EOL>shape.coord_format,<EOL>header)<EOL>new_coordlist.append(new_angle)<EOL><DEDENT>else:<EOL><INDENT>new_coordlist.append(coordinate)<EOL><DEDENT><DEDENT>return new_coordlist<EOL>
Convert the coordlist of `shape` to image coordinates

    Parameters
    ----------
    shape : `pyregion.parser_helper.Shape`
        The `Shape` to convert coordinates

    header : `~astropy.io.fits.Header`
        Specifies what WCS transformations to use.

    Returns
    -------
    new_coordlist : list
        A list of image coordinates defining the shape.