  We consider a gapped periodic quantum system with time-reversal symmetry of
fermionic (or odd) type, i.e. the time-reversal operator squares to -1. We
investigate the existence of periodic and time-reversal invariant Bloch frames
in dimensions 2 and 3. In 2d, the obstruction to the existence of such a frame
is shown to be encoded in a $\mathbb{Z}_2$-valued topological invariant, which
can be computed by a simple algorithm. We prove that the latter agrees with the
Fu-Kane index. In 3d, instead, four $\mathbb{Z}_2$ invariants emerge from the
construction, again related to the Fu-Kane-Mele indices. When no topological
obstruction is present, we provide a constructive algorithm yielding explicitly
a periodic and time-reversal invariant Bloch frame. The result is formulated in
an abstract setting, so that it applies both to discrete models and to
continuous ones.
