What would happen if screening for male infertility was just about as easy as taking a pregnancy test in your home bathroom?

That’s the question researchers at Brigham and Women’s Hospital and Massachusetts General Hospital tried to answer when they went about developing a smartphone-based test that men could use to test their semen in the comfort of their homes.

The test delivered impressive results, identifying abnormal semen samples with approximately 98 percent accuracy according to the researchers, who published their findings Wednesday in the journal Science Translational Medicine.

Get Breaking News Delivered to Your Inbox

Infertility affects up to 12 percent of the male population worldwide. Though it’s as common as female infertility, it often goes unrecognized due to factors like cultural stigma, the high cost and time required for testing, and access to laboratory facilities.

As things stand now, men have to provide samples “in these specific rooms in hospitals under so much stress and embarrassment,” the study’s principal investigator, Hadi Shafiee, PhD, told CBS News.

His team’s new approach aims to change that with a simple and inexpensive at-home test option.

The smartphone-based test involves several distinct parts: one, a disposable device on which to place the sample, including a disposable microchip that handles the sample; two, an optical attachment that connects to a smartphone; three, an app that guides the user through each step of testing. The researchers say the optical attachment could be created by 3D-printing, and the device would only cost about $5.

The testing kit also includes a tiny weight scale that connects wirelessly to the testing app and measures the total number of sperm swimming in the sample.

The March 22, 2017 cover of the journal Science Translational Medicine depicts a smartphone-based test for male infertility. Gilank Bara Verdana / Ravastra Design Studio, Science Translational Medicine

The researchers tested the device on 350 clinical semen specimens in Massachusetts, including both trained and untrained users in their trial.

“The accuracy of this approach was very similar to that of computer-assisted laboratory analysis, even when it was performed by untrained users with no clinical background,” they wrote in the study.

The app is similar to a fitness tracker, in a sense, in that it stores any history of previous semen samples as well. The app’s user experience is hard to forget: users can see vivid moving images of their sperm right on the screen.

Though the system is in the prototyping stage, it could eventually shake up the world of fertility testing by allowing men to evaluate their sperm in their own homes and helping health centers with fewer resources offer easy, cheap testing.

In addition, the developers say it could also potentially be used by men who have had a vasectomy to monitor their progress at home following surgery. Currently, they’re required to make office visits to a urologist for several months to ensure that the operation was successful.

Shafiee’s team plans to continue refining the test and then file for approval from the Food and Drug Administration (FDA). Several other home-based tests are already on the market, but Boston researchers say their version can analyze additional aspects of the sample, checking how well the sperm move (known as motility) as well as their concentration.

Male infertility has a range of root causes, from low or abnormal sperm production to blockages to illness.