import struct


def _decode_5100(data):
    """Read the block of data with ID 5100.

    Parameters
    ----------
    data : bytes
        The 5100 block to decode.

    Returns
    -------
    meta : dict
        The extracted information.

    """
    name_size = struct.unpack('<h',
                              data[:2])[0]
    name = data[2:name_size + 2].decode('utf8')

    header_format = '<ddddddddddiiihBhBhBhB'
    header_size = 104

    (x_delta, y_delta, z_delta, z_start, z_end, z_4d_start, z_4d_end,
     x_init, y_init, z_init, n_x, n_y, n_z, _, text1, _, text2, resolution,
     text3, transmission, text4) = struct.unpack(
         header_format, data[name_size + 2:name_size + header_size + 2])

    return {'name': name,
            'x_delta': x_delta,
            'y_delta': y_delta,
            'z_delta': z_delta,
            'z_start': z_start,
            'z_end': z_end,
            'z_4d_start': z_4d_start,
            'z_4d_end': z_4d_end,
            'x_init': x_init,
            'y_init': y_init,
            'z_init': z_init,
            'n_x': n_x,
            'n_y': n_y,
            'n_z': n_z,
            'text1': text1,
            'text2': text2,
            'resolution': resolution,
            'text3': text3,
            'transmission': transmission,
            'text4': text4}