Generation and tomography of arbitrary optical qubits using transient collective atomic excitations.