# Motion Correction for Brain MRI Using Deep Learning and a Novel Hybrid Loss Function
## 3 Materials and Methods
### Motion-Corrupted Images  
Images with simulated motion artifacts were based on deidentified brain MRI scans from 52 human subjects (50 males and 2 females, 48.6 \(\pm\) 9.1 years old) previously enrolled in research studies. All data were acquired using a 3T scanner (TIM Trio, Siemens Healthcare, Erlangen, Germany). The ability of MC-Net to correct real (non-simulated) images with motion artifacts was assessed using motion-corrupted scans from five additional healthy subjects (2 males and 3 females, age 19 \(\pm\) 4.9 years old). The pipeline of generating motion-corrupted images is shown in Figure 2. The (2D) source images were based on 3D sagittal magnetization-prepared rapid gradient-echo (MP-RAGE) scans and 2D axial fluid-attenuated inversion-recovery (FLAIR) scans obtained from 52 subjects and assessed visually to ensure they did not contain motion artifacts. The scan parameters for MP-RAGE were TR = 2.2 s; TE = 4.47 ms; TI = 1 s; resolution = 1 mm isotropic; and matrix size = 256 \(\times\) 256 \(\times\) 160, and those for FLAIR were TR = 9.1 s; TE = 84 ms; echo train length = 11; matrix size = 256 \(\times\) 204; in-plane resolution = 1 mm\({}^{2}\); slice thickness = 3 mm; slice spacing = 3 mm; and TI = 2.5 s.  
Forty-two axial in-plane motion trajectories of 256 temporal samples each were generated from in vivo head movements measured with the prospective acquisition correction (PACE) algorithm [24] during BOLD functional MRI (fMRI). The source motion trajectories had translations < 2 mm and rotations < 2\({}^{\circ}\) and were subsequently multiplied by eight and reduced from 6 degrees of freedom to 3 in-plane motions (2 translations and 1 rotation). All motion trajectories were set to zero at the center of the trajectory (point 128). The severity of each motion trajectory applied is indicated by the temporal standard deviation for the three in-plane degrees of freedom (L2-norm of in-plane translations in mm and in-plane rotation in degrees). Figure 1: Architecture of MC-Net, which was derived from UNet. The filter number in each convolutional layer of the customized UNet is half that of the original UNet [22]. An optional concatenation on top of the UNet structure is indicated by a dashed line. To simulate motion artifacts, the original artifact-free 3D MP-RAGE images were zero-padded to 256 \(\times\) 256 \(\times\) 256, and sagittal as well as re-sliced axial and coronal 2D views were extracted. The resulting 2D images were then Fourier-transformed to create k-space data. Since rigid motion corrupts k-space data by changing the sampled k-space trajectory, the new k-space trajectory was calculated for each trajectory using the augmented homogeneous transform [8]. Next, the original (non-corrupted) k-space data were re-sampled on the motion k-space trajectory using non-uniform FFT (NuFFT) [25], and additional phase ramps induced by translations were added to obtain corrupted k-space data. Finally, motion-corrupted images were calculated via inverse Fourier-transformation of the corrupted k-space data. Four different datasets were used. Datasets 1, 2, and 3 were generated with simulated motion, whereas dataset 4 contains images with real motion artifacts from human subjects. Dataset 1 was used to train the neural network. Ten axial MP-RAGE slices spaced 5 mm apart were extracted from each \"clean\" (original) and corresponding motion-corrupted MP-RAGE volume. These images were divided into a training set (35 subjects; 25 motion trajectories; 13,700 slices), validation set (5 subjects; 7 motion trajectories; 1950 slices), and test set (12 subjects; 7 motion trajectories; 4680 slices). The subjects and motion trajectories in these sets did not overlap. As noted, motion trajectories for both training and testing data were magnified 8-fold. Dataset 2 was used to test the generalizability of MC-Net with respect to unseen anatomical structures. It comprised motion-corrupted MP-RAGE images in sagittal (140 total slices) and coronal (140 total slices) views of 5 (of 12) subjects from the test set of Dataset 1.