Maybe see how nibabel populates the q_form and s_form values from a given affine matrix. Saves us having to rely on file templates (which can be annoying).