def filename_to_indices(filename, identifiers='tzc'):
    escaped = [re.escape(a) for a in identifiers]
    axes = re.findall('(' + '|'.join(escaped) + r')(\d+)',
                            filename)
    if len(axes) > len(identifiers):
        axes = axes[-3:]
    order = [a[0] for a in axes]
    result = [0] * len(identifiers)
    for (i, col) in enumerate(identifiers):
        try:
            result[i] = int(axes[order.index(col)][1])
        except ValueError:
            result[i] = 0
    return result
Find ocurrences of axis indices (e.g. t001, z06, c2)
dataset/ETHPy150Open soft-matter/pims/pims/image_sequence.py/filename_to_indices