An HSG is an x-ray dye test used to visualize the uterus and tubes. It involves the injection of a radio-opaque dye through the cervix and into the uterus and tubes. A series of x-rays is taken and the contour and patency of the uterus and tubes are assessed. The procedure can be somewhat uncomfortable, and may result in some cramping which often lasts for a few hours after the procedure. The likelihood of this occurring can be diminished or lessened by taking Ibuprofen or other pain medications, one hour before the test. In a small percentage of cases an HSG can cause tubal infection. This is more common in women who have one or more blocked tubes. If this is the case, the individual should immediately contact her infertility specialist to be placed on antibiotics for a week.