SAN DIEGO (CBS 8) - If you could choose the sex of your baby, would you? In vitro genetic screening makes that choice possible, with greater than 99 percent accuracy.

For one local woman in vitro genetic selection is a medical necessity because of a rare genetic defect that runs in her family.

Ellen Gustafson suffered a miscarriage in 2014 due to a mysterious genetic trait that makes it impossible for her to carry a male baby to term.

"There is something on our X chromosome that carries this male fetal death but we actually don't know exactly what that is," she said.

So, rather than suffer a loss of another baby boy, Ellen decided to select the gender of her next baby in advance using in vitro technology at La Jolla IVF. Doctors at La Jolla IVF have been doing the procedure for the past 16 years.

Ellen is a couple of months away from hopefully becoming pregnant again.

"We're doing this because this is a potential solution for us and it's avoiding the pain of continual fetal loss," she said. "The solution for us and my family is to have IVF and to have some genetic testing before you implant embryos to know that you're having a girl."

Here's how it works in the lab. Five days after in vitro fertilization, doctors take cells from the outer layer of the embryo.

"We try to get three to five cells off of the embryo," said Awie Brotes, an embryologist at La Jolla IVF.

"It doesn't hurt the embryo at all because we're actually taking a few cells off what's going to be the placenta," said Brotes.

Those cells are routinely screened for genetic diseases like downs syndrome; a process which also reveals the sex of the embryo with close to 100 percent accuracy.

The fertilized embryos will be kept frozen until Ellen is ready to get pregnant.

"In her situation, we're doing IVF specifically to make sure that we're getting female embryos to place rather than males," said La Jolla IVF Dr. David Smotrich.

Dr. Smotrich also sees patients who use genetic screening simply because they want to choose a boy or girl; a decision that can be controversial.

"There are many couples who are blessed with three daughters and they would like to have family balancing and they come in to see us for a son," said Dr. Smotrich.

For Ellen, the technology will allow her to have a baby girl or maybe two.

"The numbers of IVF today are much more successful when you implant two, hence the reason why there are a lot of twins in the world today," said Ellen.

Using in vitro fertilization and genetic screening to select the gender of your baby is not cheap, costing in the neighborhood of $20,000 including the price of injectable hormones. The procedure normally is not covered by insurance.