A form of artificial intelligence designed to identify different types of pastries at checkout has been repurposed to identify cancer cells.

BakeryScan was developed by Brain Co., specifically to scan baked goods on a tray to properly identify them and charge shoppers the correct amount for each item - nice and easy.

But now it is being used for the greater good, as the software looks at urinary cells and identifies which are diseased - a task it performs with 99 per cent accuracy.

The change came after a doctor at the Louis Pasteur Center for Medical Research, in Kyoto, Japan, saw a news segment about BakeryScan and he had a Eureka moment.

He realised that cancerous cells looked similar to bread when under a microscope, so he contacted Brain Co. and they developed a new version of BakeryScan specifically for pathologists.

BakeryScan was designed to identify croissants from doughnuts (
Image:
Facebook)

The artificial intelligence, launched in 2013, was designed by Hisashi Kambe and since then it has been purchased by more than 400 retail shops for a price of $20,000.

James Somers for the New Yorker reports: "In early 2017, a doctor at the Louis Pasteur Center for Medical Research, in Kyoto, saw a television segment about the BakeryScan.

"He realized that cancer cells, under a microscope, looked kind of like bread. He contacted Brain and the company agreed to begin developing a version of BakeryScan for pathologists."

A doctor saw BakeryScan's potential after realising cancer cells looked a bit like bread (
Image:
Facebook)

After the doctor contacted BakeryScan, it emerged they had already begun enhancing the software - enabling it to identify more things than just pastry.

The new version would be able to identify interesting features in images, and even incorrectly wired bolts in jet-engine parts.

The new product became known as AI-Scan, and Brain Co began making a version specifically for pathologists - known as Cyto-Aiscan.

They modified the system so that it would measure the nucleus in urinary cells on microscope slides, massively improving the success rate and speed of cell analysis.

Now, the software is in use in two major hospitals in Japan, in Kobe and Kyoto, and is capable of 'whole-slide analysis', where multiple cells can be analysed at once.

Kambe said that the software still operates in the same way as when it was identifying pastries, and the core artificial intelligence hasn't changed.