An MRI scan can spot people at risk of heart disease a decade before a potential stroke or heart attack, according to a study.