1. A method for compensating for motion by a subject in a magnetic resonance image, comprising: a. obtaining magnetic resonance image data from the imaged subject: b. estimating the dominant motion in the image data; c. constructing a graphical model for the estimated dominant motion; and d. optimizing the graphical model so that the image data corrupted by the motion of the imaged subject is corrected.