Synthetic X-ray tomography with Julia

Dear All,

Objective: My aim is to use Julia to combine a number of complex computational tasks, one of them being creation of synthetic tomography. My search provided no results on existing Julia packages related to X-ray image reconstructions or simulating projections by modelling X-ray propagation within the studied sample.
I need both parts actually. The objective is to input a 3D image of a sample (attenuation coefficients) and then to create projections, which i later want to reconstruct back to attenuations.

Question: I would be grateful to any links or ideas of how one could use existing Julia functions or wrappings around other codes to solve this problem from Julia.

A somewhat more detailed list of objectives:

  1. Simulate point X-ray source
  2. Simulate projections with all necessary physics involved based on input 3D distribution of attenuations
  3. Reconstruct images from these projections

Many thanks in advance!

1 Like

If I were you, I would start by wrapping Poulson’s distributed butterfly transform. There’s an example there of how to calculate a generalized Radon transform. See also the paper, which is slightly less enlightening if you’re not already familiar with the butterfly algorithm. You can try using CxxWrap.jl or Cxx.jl, but I don’t believe either is stable yet. If that fails, you can write a C wrapper for the C++ library, and then wrap that in Julia.

With that in mind, it should be easier to swap physical models, create synthetic data sets, perform backprojection, and etc.

Another approach would involve writing a pure Julian butterfly.

1 Like

I’m guessing that you have some kind of material sample (e.g. bones, rocks, concrete, metal) with known properties from real x-ray scans but you use them for model validation only since you’re probably planning to use synthetic material models in the future because they are much cheaper and allow for more controlled variations.

What else are you aiming to do? Are you trying to build some multi-physics toolbox?
If you want to do experiments with wave propagation (active/passive), then you may want to have a look at SeismicJulia. Further you may look into meshing and FEM/CFD packages to see how you may couple them.

If you are open to a less “physics-based” approach and if you have enough data, then you may look into a machine learning solution to generate synthetic X-ray results.

1 Like

Thank you for your suggestions, Guys!

Just to let you know that i found an interesting package that solves some problems i was looking for: ASTRA Toolbox (
I could not find anything that solves all my problems stated above completely. Your solutions may work fine, but very time consuming from the programming point of view (and i have lousy programming skills).

Thank you very much for your answers,

I just started a package to pull the x-ray linear attenuations from the NIST XCOM Database called Attenuations.jl. It can help you start with creating your objects that you’ll forward project.


The Attenuations.jl package got some substantial upgrades so now it contains all materials and elements from NIST tables 2 and 4. It also uses Unitful.jl for energy requests and returns linear and mass attenuation coefficients with their respective SI units.

1 Like

Oh, and @tim.holy made the JuliaImages/ImageReconstruction.jl package and we have implemented a radon and inverse radon transform for images (not volumes) so far.

You’ll need an estimate of your x-ray source energy distribution also. An accurate method for computer‐generating tungsten anode x‐ray spectra from 30 to 140 kV is a commonly implemented model for computed tomography applications.

Then, you’re probably just missing the physics measurement model which depends on the type of radiation detector you’re using.


I make a Julia wrapper for ASTRA toolbox:

Currently, it only supports 2D parallel or fan beam.

1 Like

Wow, looks pretty useful to me! We are using python wrapping at the moment in our research… But Julia would be cool to jump to.
Did you wrap it through python or directly cpp code?
Looking forward for the full 3D+Cuda version!
Thank you!

Sorry i somehow missed this msg of yours.
Thank you for the reference - i shall look into it. I am not yet sure if this will work for our porous materials microCT applications or not.
Are you planning to finish the full 3D/Cuda versions?

Welcome! I made it for my research purpose :slight_smile: It is implemented by porting from the cpp code, e.g.

It’s nice to see people working on tomography. Yes, if I do for 3D later, I will reply here!

1 Like