In cases where a contrast dye must be injected to improve the imaging, a contrast agent called gadolinium is used. This material can be harmful to patients who suffer from kidney disease. This is why a kidney function test is conducted before an MRI to determine if the patient has normal kidney function, in case the dye needs to be used.