def _native_to_elastix_trafo(trafo, resolution=None):
    """ Convert native transformation matrix to elastix transformantion parameter.
    """
    params = 12 * [0]

    params[0] = trafo[2, 2]
    params[1] = trafo[2, 1]
    params[2] = trafo[2, 0]

    params[3] = trafo[1, 2]
    params[4] = trafo[1, 1]
    params[5] = trafo[1, 0]

    params[6] = trafo[0, 2]
    params[7] = trafo[0, 1]
    params[8] = trafo[0, 0]

    if resolution is None:
        params[9] = trafo[2, 3]
        params[10] = trafo[1, 3]
        params[11] = trafo[0, 3]
    else:
        params[9] = trafo[2, 3] * resolution[2]
        params[10] = trafo[1, 3] * resolution[1]
        params[11] = trafo[0, 3] * resolution[0]

    return params