If consumers only knew what went into food safety, they might think they'd slipped into a James Bond movie.

At Legendary Baking in Chaska, the pies it makes for Bakers Square restaurants and local grocery stores are X-rayed to make sure there's nothing inside but pie. The completely automated machines X-ray a pie and use a computer to analyze the image in a second or less, then eject it from the assembly line if it appears to contain a foreign object.

That's not unusual in the food industry, where products have long been subjected to X-ray machines, metal detectors or special weighing devices to weed out objects such as metal or plastic parts that might fall off an assembly line.

These safeguards help companies comply with federal rules requiring that food be monitored for quality at "hazard analysis critical control points," such as the end of assembly lines.

"We have been using X-rays for seven years to eliminate the potential for dense foreign objects in products," said Steven Hawkes, general manager of the bakery in Chaska, a unit of American Blue Ribbon Holdings in Denver.

Hawkes said Legendary turned to X-ray machines partly because the metal pie tins thwarted metal detectors.

But the X-ray machines can also find contaminants a metal detector can't, such as pieces of glass or plastic from the assembly line process, or tiny rocks that were harvested along with pie ingredients such as strawberries or pumpkins.

Hawkes declined to say whether the machines had ever found any foreign objects in pies.

While assembly line X-ray machines are expensive -- they sell for tens of thousands of dollars each -- food companies find the cost is well worth it, said Ted Labuza, a food engineer in the Food Science and Nutrition Department at the University of Minnesota in St. Paul.

"Compared to the cost of product liability lawsuits, X-ray machines are cheap," Labuza said. "Under Minnesota law, manufacturers are 100 percent liable if their product causes damage, and in most other states it's the same."

Legendary Baking's X-ray machines are made in Coon Rapids by a unit of Massachusetts-based Thermo Fisher Scientific, which also makes industrial metal detectors and special quality-monitoring scales called "checkweighers."

"There were a handful of manufacturers to choose from, and we've worked with several," Hawkes said. "We selected Thermo Fisher because they had competitive prices, they were local and they had a good reputation for service." In addition, the Thermo Fisher X-ray machine "is considerably smaller than competitive units, is simple to run and is designed for easy maintenance."

The X-ray machines, which cost $45,000 to $70,000 each, are about 98 percent accurate in detecting contaminant particles as small as 1 to 2 millimeters in diameter, said Bob Ries, Thermo Fisher's lead product manager for metal detection and X-ray products.

The X-rays have no effect on the food because the X-ray machines operate at low power, about the same amount that's used by a 100 watt lightbulb, Ries said. "It's very similar to the X-ray machines at the airport that examine luggage."

As is typical of industrial X-ray machines, the ones at Legendary have lead shields to prevent radiation from escaping. No special safety precautions are needed to operate them, Hawkes said.

At Legendary Baking, the Thermo Fisher machines can scan one or two pies per second, Ries said.

Speed is important because Legendary's Chaska bakery, and another one in Oak Forest, Ill., produce more than 18 million pies per year for Bakers Square and Village Inn Restaurants (both owned by Legendary's parent company), as well as for retail outlets and food service operations. While pie is the chief product, the bakeries also produce other goods, including cookies and cakes, the company said.

American Blue Ribbon Holdings is privately owned and doesn't disclose finances. The Minnesota operation of Thermo Fisher generates $60 million in worldwide annual revenue, Ries said.

Consumers might be surprised to know how many products they use have been X-rayed, Ries said: "anything in foil, foil tops or cans" and a lot of glass bottles.

"If you walk through a grocery store, there's a 99.9 percent chance that a product there went through either an X-ray machine or a metal detector," Ries said. "Companies do it to avoid recalls and protect their brand names."

Steve Alexander • 612-673-4553