Hysterosalpingography (HSG) is an X-ray procedure used to check for blockage or growths inside the uterus and fallopian tubes. This may help your doctor find the cause of infertility or repeated pregnancy loss. It is also done to detect growths or scarring in the uterus.