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 hackaday.io. 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.

16 thoughts on “DIY X-Ray Machine Becomes CT Scanner

  1. I have a mixed feelings about it.
    It is a nice idea with nice results and for reasonable money.
    But, it can be a really dangerous in a hands of irresponsible person. The device seems not to have any radiation shielding so you probably should use it in a cellar to have at least some. Compared to microwave the shielding is not so easy. And unfortunately, some harmful effects of the X-ray radiation are not immediately visible and it takes some time to show up.

    1. Yes, people in the approach of science has killed a lot of people. Its also injured even more. Some of our greatest and brightest died while in the endeavors of science.

      Yeah. 65kV power supply is already a life ending mistake. And xrays are radio spectrum in the ionizing area. Yeah, they’re dangerous. But I’d hope that they do the experimentation safely, at least for regard of others.

      1. I assume you mean radiation spectrum because X-rays are just about as far from radio waves as light gets :)

        True, 65kV is potentially life-ending, as are improperly used X-rays, but from this guy’s last feature on HaD it sounds like he’s got some professional experience around this stuff and he’s isolated it in a separate room. Also there’s consistently been the proper radiation measuring equipment in the photos of his stuff, so I assume he’s keeping an eye on it.

        65kV can kill you, but so can sixty volts. Radiation can kill you, but so can a million other things you work on or with in the garage. Like your car. He seems to know the risks, understand dosage, and have a plan–so I think the uneasiness that always crops up in the comments section is more due to the sensational nature of what he’s doing instead of undue risk. I’m glad people can do things like this in a semi-hobbyist manner.

    1. I agree, nothing about this project is inherently unsafe if even the most basic of safety measures are implemented.

      Obviously you don’t want to run something like this in an apartment complex, but 6 foot thick concrete wall aren’t needed either…the xrays produced must be less than 65KeV and therefore in the range of medical diagnostics, wear a lead cod piece and stand behind a wall.

      1. Standing behind a wall is not necessarily going to help as x-rays reflect off surfaces. We work with Electron beams that produce X-rays, we aim for 0 emissions from our chambers but to do so one thing you have to do is to machine a recess into the door so that the chamber casing slots into it when closed. This creates a small channel where any x-rays trying to slip past the door seal end up bouncing down the channel until they loose enough energy to not be a danger any more. X-ray’s are sneaky buggers.

        1. *scatter* is the word you’re looking for…
          Actual reflections require:
          1) dense materials – metals
          2) a very high impact angle, otherwise they just go through/into the object…
          And thus are not as common under normal household/garage conditions.

          Scattering on the other hand is a problem you’d run into when CTing most interesting things that contain light elements (like hydrogen, which is in nearly everything organic) and is the main reason you get a lead apron when you have to keep your pet steady under an x-ray machine, despite the beam leaving the machine only where the marker light shines…

          Might be worth doing a HAD article on – DIY ionizing radiation shielding on the cheap :D

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.