Cardiac computerized tomography (CT) or magnetic resonance imaging (MRI). In a cardiac CT scan, one lies on a table inside a machine called a gantry. An X-ray tube inside the machine rotates around the body and collects images of the heart and chest.