I would like to understand the exact role of the following circuit (By Vtomole - Own work, CC BY-SA 4.0) in the 5-qubit QECC.
The image attached (from Wikipedia) is captioned "Quantum Circuit that Measures Stabilizers in the Five Qubit Error Correcting Code".
Background According to Nielsen and Chuang, "the five qubit code has the generators $$g_{1} = XZZXI$$ $$g_{2} = IXZZX$$ $$g_{3} = XIXZZ$$ $$g_{4} = ZXIXZ$$ and it has the logical $Z$ and logical $X$ operators $$\bar{Z} = ZZZZZ$$ $$\bar{X} = XXXXX$$ However, their textbook does not give explicit detail as to how this code works.
My interpretation of the circuit
My understanding is the the codewords are logical 0 and logical 1 qubits
$|0\rangle _{5L} = \frac{1}{4} (I + g_{1})(I +g_{2})(I + g_{3})(I + g_{4})|0\rangle \otimes |0\rangle \otimes |0\rangle \otimes |0\rangle \otimes |0\rangle$
and the same idea for
$|1\rangle_{5L} = \frac{1}{4} (I + g_{1})(I +g_{2})(I + g_{3})(I + g_{4})|1\rangle \otimes |1\rangle \otimes |1\rangle \otimes |1\rangle \otimes |1\rangle $ .
So these are the possible starting states of the 5-qubit state $|\psi\rangle$.
First question: Why do we do this to obtain the codewords?
We go through the circuit and eventually measure the 4 ancillary qubits to output four pieces of information, (I assume these bits will correspond to the error that we may have in our codeword. For example, if there was an $X$ error on the first ancillary qubit then we will output $0001$ from the circuit?
My question(s)
But then where do the $\bar{X}$ and $\bar{Z}$ operators come in? Is this even a correct interpretation of the circuit? How does the circuit fit into the overall QECC?