The research team CUQI at DTU Compute has, with an atypical process, reduced 1000 lines of code to five in new software, which e.g. helps see unwanted features within an object.
Engineers often need to examine the interior of completely closed objects for possible defects without having to cut through the material, for example when looking for internal damage in oil and gas pipelines or wind turbine blades. Instead, they send X-rays or electricity through the objects and measure the attenuation. By inserting the measured data into a mathematical model, they can create reconstructions, e.g. 3D images of objects' internal structures to detect possible defects. However, the question is how much one can trust the reliability of the images because an artifact could perhaps be created by the computational methods from noise in the data.
Here, a new software package - CUQIpy - can help by quantifying the accuracy of the reconstruction by ’reversing’ the computations, so to speak. Based on a given output (measurements) you can see how they have arisen – i.e. what the input is, e.g. errors in construction - and at the same time calculate the uncertainty in images, so that doctors, engineers, or others can make a decision based on knowledge of the uncertainty.
The software has been developed in the research team CUQI (Computational Uncertainty Quantification for Inverse problems) at DTU Compute. It can be used for all sorts of so-called 'inverse problems'; applications where you based on measurements, try to say something about what is inside an object without opening and looking into it, i.e. using indirect measurements - in the industry as well as in the hospital.
"Normally you would have to write 1000 lines of code, but people are not experts in e.g. both CT scans and inverse problem analyses. That's why we have simplified it so you only have to write approximately five lines of code to set up a problem, solve it and visualize it. This makes it as simple as possible for everyone to use the tool to solve and analyze their problems,” says Senior Researcher Jakob Sauer Jørgensen, who leads the software people at CUQI.
Same mathematical core regardless of the problem
Since 2019, the research initiative CUQI, with support from the Villum Foundation, has worked to develop mathematical models and methods that can help e.g. the industry with quality assurance of products.
"We use mathematics to turn abstractions into equations. Whether you are looking at applications with CT scans, blurred images, or trying to find the buried land mine or an oil/gas deposit, they have the same mathematical core, so you can describe it with the same type of equation - with the same mathematical structure. In CUQIpy, we have software building blocks that represent the mathematical building blocks, and thus the software is flexible and can be adapted to the specific problems," explains Professor and Head of CUQI Per Christian Hansen.
The CUQI team has developed building blocks that describe typical problems using a number of demonstration problems that users can start working on. Users can therefore just enter a few specifications for their inverse problems - e.g. how to mathematically describe what happens inside the scanner, and then the software takes care of the rest.
"But at the same time, users can adapt the equations if the measurement geometry needs to be different, or if they want to carry out an uncertainty quantification of a completely different inverse problem, because this can be handled easily with the software," says Per Christian Hansen.
The article continues below the figure.
CUQIpy – how to use the software
Briefly, CUQIpy - https://cuqi-dtu.github.io/CUQIpy - is based on a general formulation of inverse problems by the equation
b = Ax
where b is the measured data, x are the unknown parameters we seek to reconstruct, and A is the so-called forward model that describes the physics of how b arises from x.
In a CT scan, b consists of X-ray measurements, x is a cross-sectional image of the object, and A describes how X-rays are attenuated and the geometry of the scanner.
A typical workflow for a UQ analysis with CUQIpy is shown in the figure below. The user selects one of CUQIpy's built-in forward models A or specifies their own, together with the measured data b. Next, the user specifies what prior information is available of e.g. image and noise in the form of probability distributions. From this, CUQIpy automatically sets up and solves the underlying Bayesian inverse problem, including the choice of an efficient sampling algorithm. The result is presented in the form of both reconstructed images, parameter distributions, and uncertainty information.
Atypical collaboration
CUQIpy has been developed through an atypical, interdisciplinary collaboration, where the researchers have worked through a systematic approach to the different mathematical building blocks of the software. Professional software development tools have been used for version control, code testing, and documentation, and code development has taken place via the open platform Github.
Jakob Sauer Jørgensen was recruited to the CUQI project in April 2020 from The University of Manchester, where he had built and headed a research and software group, and he saw from the start that it would be beneficial to involve the entire CUQI team in the software development:
"Software is getting more and more important everywhere, and therefore we have to work systematically with development when we build new tools. Normally, everyone is busy writing papers about their own part of a project, but here we have built a software product across the group in close collaboration."
The whole CUQI team has participated in training courses to achieve competence in tools and software development so that everyone understands the processes and can contribute to the solution. In addition, they work with two-week plans where they concentrate on implementing certain features that the CUQI team requires in order to move forward. Daily they meet for short updates to coordinate and discuss.
"I am quite excited about our work. It is also special that you can have this great focus on the software platform because often the work with software is just a minor part," says Jakob Sauer Jørgensen.
Progress via collaboration
Per Christian Hansen is pleased that his thoughts were correct when he wrote the application for fund funds to CUQI.
"We have succeeded in attracting very talented people who understand the strategy of combining theoretical mathematics with applied mathematics and statistics - through collaborative software development instead of sitting with their own research in a small number of silos. By gathering people and working together, you move forward. It's about creating the right environment, and I think CUQI is a good example of that.”
This is basic research. CUQI has not committed itself to specific deliverables but has promised that it would develop some software. At the same time, the grant lasts till ultimo August 2025, so there is a nice overlap between PhD students and postdocs who do not have to start from scratch but can continue the work that has already been done.
In September 2022, CUQI held a four-day conference on uncertainty quantification with participants from several European countries. The first day consisted of a workshop where the CUQI team trained the participants in the use of the CUQIpy software. The workshop was followed by three days of theory and mathematical methods. Several such software workshops are underway, and the CUQI team is considering courses for the industry. In addition, the software is under continuous expansion and can easily be made more accessible, e.g. through a more graphical user interface.
"It's great that we have foundations like the Villum Foundation, which support a project where you can be curious and have time to find solutions. I think that more solutions will emerge because the grant is of such a scale that we have the opportunity to bring people together both experts in the mathematical/numerical scale and people with software expertise, says Per Christian Hansen.
- As part of the research project CUQI (Computational Uncertainty Quantification for Inverse Problems) at DTU Compute, a software team led by Senior Researcher Jakob Sauer Jørgensen and postdocs Nicolai Riis and Amal Alghamdi has developed the software tool. In the picture at the top, the three are seen at a CUQIpy software workshop in September 2022.
- The software is written in the Python programming language, which is emphasized by the name CUQIpy – with “py” added to the CUQI name. Read more https://cuqi-dtu.github.io/CUQIpy/
- The entire CUQIpy software is open source, including the forward models, Uncertainty Quantification (UQ) calculation methods, UQ analyses, visualizations, etc., and is so easy to use that even a person who is not an expert in mathematics and statistics, after a little introduction can use the software and put in their own data and do their analysis. If, on the other hand, the user is an expert, all parameters can be adjusted.
- The software can be used to calculate the uncertainty in all so-called 'inverse problems; places where you based on measurements, try to say something about what exists or happens inside an object without opening and looking into it, i.e. indirect measurements - in the industry as well as in the hospital.
- Applications include X-ray tomography of objects, CT scans, and blurred images. Or electrical impedance tomography, where electrodes are used to measure what happens inside the object - for example a chemical process in a tank, where the process stops if you open the tank, but also in hospitals, where the method is used to check lung capacity in premature babies.
- Since April 2020, the CUQI team has developed the software and methods according to the SCRUM principles (https://www.scrum.org) of agile software development, where for periods of two weeks you solve new sub-elements of a joint task together and meet for 15 minutes daily to update.
- CUQI is supported by the Villum Foundation.