def write_tile(codec, tile_index, data, data_size, stream):
OPENJP2.opj_write_tile.argtypes = [CODEC_TYPE,<EOL>ctypes.c_uint32,<EOL>ctypes.POINTER(ctypes.c_uint8),<EOL>ctypes.c_uint32,<EOL>STREAM_TYPE_P]<EOL>OPENJP2.opj_write_tile.restype = check_error<EOL>datap = data.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8))<EOL>OPENJP2.opj_write_tile(codec,<EOL>ctypes.c_uint32(int(tile_index)),<EOL>datap,<EOL>ctypes.c_uint32(int(data_size)),<EOL>stream)<EOL>
Wraps openjp2 library function opj_write_tile.

    Write a tile into an image.

    Parameters
    ----------
    codec : CODEC_TYPE
        The jpeg2000 codec
    tile_index : int
        The index of the tile to write, zero-indexing assumed
    data : array
        Image data arranged in usual C-order
    data_size : int
        Size of a tile in bytes
    stream : STREAM_TYPE_P
        The stream to write data to

    Raises
    ------
    RuntimeError
        If the OpenJPEG library routine opj_write_tile fails.