Gravar-mail: Implicit Reference-Based Group-wise Image Registration and Its Application to Structural and Functional MRI