The cause of constipation may also be diagnosed using barium enema x-rays. Liquid containing barium is inserted into the rectum for this test. The barium makes the rectum, colon, and lower part of the small intestine visible in the x-ray images.