DIY X-Ray Machine Becomes CT Scanner

DIY X-Ray Machine Becomes CT Scanner

Once you’ve built your own X-ray machine to take 2D images of the insides of stuff, there’s really only one logical next step: building your own computed tomography (CT) scanner to get 3D reconstructions instead. That’s exactly what [Fran Piernas] has done, and documented over on While the original X-ray machine build dealt with scary hardware stuff such as high voltage and ionizing radiation, this time it’s the turn of scary mathematics like inverse radon transforms.

The original build, which we wrote about in December, uses a commercial dental X-ray tube and a home-made 65 kV power supply to send X-rays through objects. Transmitted X-rays are viewed using an intensifying screen that converts the rays to visible light. The result is a 2D image similar to that we’re all familiar with.

To create a 3D reconstruction of an object, you need a number of X-ray images taken from different angles. If you’ve ever been unlucky enough to need a medical CT scan, you’ll remember staying motionless in the tunnel while the X-ray apparatus rotated around you. In this build, [Fran] rotates the object instead, using a motor that may have once been part of a microwave oven (one of those “mystery motors” we all have laying around). The required sequence of images is simply obtained by recording video of the X-ray screen while the motor rotates the object.

[Fran] uses a technique called filtered back projection to reconstruct the 3D object from the series of video frames. In this algorithm, which computes a mathematical transform known as the inverse Radon transform, densities in the 3D volume are summed from a number of back-projected trajectories that the X-rays took through the object. The result is a volumetric model of the x-ray absorption density of the object.

What’s inside here?

So far, [Fran] has scanned a few common household items, including an LED light bulb, a cigarette lighter, and an LED panel indicator. The featured image above shows three different methods used to reconstruct the LED indicator. The scans reveal two metal terminals at the top and what appear to be a resistor and capacitor in the body. We’re really impressed with the results.

If you’d like to experiment with CT reconstruction, but lack the resources, time, or requisite safety training to build your own X-ray scanner, you’re in luck! [Fran] has published the source code for this project on GitHub. There, you’ll find MIT-Licensed C++ code (using OpenCV) for filtered back projection along with some sample images and video to test the algorithm. We got a 2D reconstruction going with the simple five-line example in as many minutes, although we’d advise you to try with OpenCV 4.x, since the selectROI() function appears to be missing from some of the 3.x versions.

As luck would have it, [Fran] also hosted the X-Rays and High Voltage Hack Chat this week (Wednesday, February 20, 2019, noon PST). If the subject interests you, definitely stop by and ask all your questions.