OpenCL Potentials: Medical Imaging

Photo by Eugene MahWhen you ever saw a CT or MRI scanner, you might have noticed the full-sized computer next to it (especially the older ones). There is quite some processing power needed to keep up with the data-stream coming from the scanner, to process the data to a 3D-image and to visualise the data on a 2D-screen. Luckily we have OpenCL to make it even faster; which doctor doesn’t want real-time high-resolution results and which patient doesn’t want to see the results on Apple iPad or Samsung Galaxy Tab?

Architects, bankers and doctors have one thing in common: they get a better feeling for the current subject if they can play with the data. OpenCL makes it possible to process data much faster and thus let the specialist play with it. The interesting part of IT is that it is in every domain now and therefore a new series: OpenCL-potentials.

A personal Note

Medical research, biology and genetics have interested me a lot since some years. A month ago I had a hard choice: apply for a PhD in bio-informatics and pull the plug of StreamHPC, or stick with my start-up. I wanted both, but I had to choose since doing a full-time research and managing a company does not go well together. As you can see I did not go for my deep wish to once start&finish a PhD, but do things that really excite me already.

3D Detection

Positron Emission Tomography (PET), X-ray Computed Tomography (CT) and Magnetic Resonance Imaging (MRI) have one thing in common: it is or can be 3D. 3D-data has something problematic: hard to print on paper – not meant as a joke. You therefore see many techniques to search through the data, including 3D-glasses.

Below the three mentioned techniques are explained. For the sake of simplicity I leave out a lot of details, variations and alternatives; i.e. I don’t mention differences between linear or polar scan. So consult your doctor for more details.


The technique MRI is based on three principles:

  • The 2 protons in water (Hydrogen-atoms) can align their magnetic moment with the magnetic field if shaken
  • Certain radio waves can resonate the protons (microwave principle), and which enough energy get them out of their base-
  • Protons that flip back to their original state send out a photon which can be detected.

The water-based object that needs to be scanned lies in a high energy magnetic field. Some of the protons align, most don’t. By emitting a radio wave for a very short period (we don’t want to microwave the object), protons resonate and can flip to the magnetic field direction. The magnetic field is turned of and all flipping protons send out a photon with a frequency which depends on how big the flip was (conservation of energy), which is detected by the sensors around. By varying the strength of the radio wave, more protons get flipped.


X-ray is a much older technique, but also more dangerous (nuclear). It is based on the idea that X-rays are absorbed at different levels by different materials. When X-rays are sent through the object the energy of the ray is measured at the other side. The weaker the received signal, i.e. the more bone was between the emitter and the detector(s). By rotating around the object (see photo), a 3D-image can be composed.


PET-scans are X-ray based nowadays. Radio-active tracer-fluid is emitted into the body and the special fluid concentrates in tissues of interest. After a waiting period the traces of the decaying tracer-fluids can be detected in a CT-detector. Difference with the CT, is that the source is within the object.

3D Data

By summing all detector-data for one intersection, an image of a slice is formed. Because the detectors cannot be in the body, the received signal is for the whole path and the sum of all signals leaves echoes of this summing (see figure, by Ramsey Badawi). These “shadows” or “blur” makes the resulting image actually not that useful.

The idea is then to use in inverse Fourier transform to unblur the image. First the blur-factor has to be found by a forward Fourier transform, then the inverse Fourier is applied to the signal multiplied by the factor.

Summing the slices, finding the blur-factor and removing the blur are all perfect to do with OpenCL, even better when the resolution and thus matrix-size is higher. To have useful results the doctor can trust, the precision should be high enough and one should be careful with “first results” if the system is designed to gradually increase precision to decrease the feeling of having to wait.

Want to know more? Terry Peters made a presentation on CT Image Reconstruction; Yao Wang has made such for MRI Image Reconstruction; Ramsey Badawi wrote an introduction for PET Image Reconstruction. You get a good idea after reading though these.

Data presentation results in an image with signal strength per pixel, and MRI adds frequency to this. This translates in material-type and can be coloured according.

The most used techniques are slicing (see picture) and projection. Projection is combined with selecting a band of signal strengths. The hard part of projection is that the feeling of 3D is made by shadowing and lighting, but that could add unwanted artefacts to the medical data. Using i.e. OpenGL and being able to easily turn on/off colour and shadow, makes it easy. Since OpenCL works on well with OpenGL, some filtering can be done on-the-fly.


OpenCL is very useful in medical imaging. Finding the blur-factor can be tedious, but with a higher calculation-speed, more guesses can be done to find an optimum. Concluding that an extra scan is needed based on “first results” is also a possibility.

Let me know what you want in the following of the “OpenCL-potential“-series.

Related Posts

2 thoughts on “OpenCL Potentials: Medical Imaging

  1. Pingback: Tweets that mention First in new series OpenCL-potentials: Medical Imaging. --

  2. Hansford

    You actually make it seem so easy with your presentation but I find this matter to be actually something which I think I would never understand. It seems too complex and extremely broad for me. I’m looking forward for your next post, I will try to get the hang of it!

Comments are closed.