07 April 2016

Snuffler version 1.2: The radar experiment

It's time for a new version of Snuffler. I've upgraded from visual studio 2005 to 2015 and changed drawing of custom graphics in dialog boxes, e.g. in the Display Settings dialog, so let me know if you get any strange new problems. If you get an error starting up the new version of Snuffler, you will probably need to run the redist exe that comes in the same zip file.

The main feature added this time is functionality for the display of radar data. Not much mind you, very little in fact. It all started back when I got my radar. I also got a copy of ReflexW, and I'm happy enough using that, but having written Snuffler, I found I was not completely happy with the way radar data is traditionally displayed, and wanted to have a go at writing a display process to see if I could do better. Apart from basic training on how to use ReflexW, I have no formal training in GPR processing theory. Thousands of papers on the subject have passed me by, and I wouldn't really know where to start looking. Some of what I'm doing here is re-inventing the wheel, but I still wanted to have a go at it, despite going in blind. The new functionality I have added to Snuffler is not intended to be a useful GPR processing system, it is very far from that. It is intended to scratch an itch I had regarding GPR display methods and learn something for myself along the way.

For those of you who are not completely familiar with how radar data is displayed, here is a bit of history to bring you up to speed. Apologies if you already know this stuff. Click on any of the images to show a larger version. Unlike for earth resistance and magnetometry, which give a single reading at any point, radar will give you a vertical trace going through the ground. The resulting wave recorded at a single point in horizontal space is known as an A-Scan, and an example is shown below.

A-Scan

The top of this wave is at the ground surface and goes down into the ground. The dotted red line is an amplitude (signal strength) of zero, so as the wave extends further from that line, the more signal is being reflected and the greater the strength of signal. You tend to get a greater reflection at the surface, as less and less energy penetrates further into the ground as you go deeper. So that's a single point on the ground. If you record a line of these and string them together, this is known as a B-Scan. An example of which is shown below.


 B-Scan, historical display method

This is how B-Scans used to be displayed in the early days of computing, when everything was monochrome. The A-Scans where arranged in a line, and the area under the curve of the wave to the right of the zero line was filled with black to create contrast for high amplitude areas. This display method is the equivalent of the dot-density plot for earth resistance, when technology was similarly limited to monochrome, and thankfully isn't used much any more. The progression from this, when shades of grey became available, was to assign white to a negative amplitude (left of the zero line), through the shades of grey to mid grey at the zero line and on to black at a high positive amplitude (right of the zero line). The wave itself was no longer drawn, just the grey appropriate to the amplitude. This would give us the common method of B-Scan display used today, as shown in the example below.

B-Scan, current display method

Thus ends the history lesson. The example B-scan above, which I will use as an example throughout the rest of this blog post is from a town called Ewell. During the excavation by the Surrey Archaeological Society of a Roman road called Stane Street, I went to an adjacent modern road and walked along the pavement, crossing Stane Street. The curving feature in the middle is what I hope is the camber of the Roman road.

So what can you do with Snuffler? To get the data into Snuffler, there is a SEGY file import. SEGY is a common standard for sharing GPR data that can be used by many pieces of GPR software. Currently, Snuffler can currently only import a subset of this, the '2-byte, two's complement integer' type output by ReflexW. If you are trying this out and can't get Snuffler to import your file, zip it up and email it to me and I will get it working. The example above has already been processed in ReflexW, with static correction, background removal, gain and bandpass filters applied; basic stuff that Snuffler cannot do.

The standard method of display, as shown above, is the first thing you will see when you open the file in Snuffler, and here I want to discuss why I have a problem with this display method. There are two pieces of information that an image like this can tell you, amplitude and phase. It will show you both, but it will show you neither very well.

Amplitude is the strength of the wave. You can easily see a broad band across the top of the image with higher amplitude shown as lines of black and white rather than the grey of low amplitude. In a normal earth resistance plot in Snuffler, the scale might go from black as a low reading to white as a high reading. With GPR, both black and white are high amplitude, cutting the palette in half as far as contrast is concerned. It also doesn't help that the shades representing the high points on the wave only appear briefly before plunging back towards the zero line, making comparison of amplitude even more difficult. You can't even concentrate the display range at a certain amplitude to increase contrast without losing the other (negative) half of your data. The solution to this is quite common, but is not often applied to B-Scan data, the envelope. The envelope basically takes absolute value of the amplitude (makes everything positive) and fills in the gaps between the waves. This is normally done using a Hilbert Transform, but since my maths isn't that great, I literally took the absolute values and filled in the gaps instead. The result looks something like this. This, and the other display methods shown hereare not filters in the sense that they change the data, they are on the fly display methods that leave the data alone.

"Envelope" data

Now black is low amplitude and white is high amplitude. We have completely lost the phase information (more on that in a bit), but we can see the amplitude a lot better. We can still improve on this.
 Graph of amplitude data

The graph shows the amplitude on the X axis and the number of readings with that amplitude on the Y axis. If we move the low bound very slightly so the majority of the low readings are ignored and change the palette usage to non-linear, we can get better contrast. A non-linear palette is where instead of a shade of grey being assigned to an amplitude range, it is assigned to an equal number of readings with a similar amplitude. The result looks like this.

"Envelope" data with better contrast

So that's amplitude, what about phase? In simplified terms, a wave with a single frequency, given no obstacles, will have the same wavelength all along its length. There would be the same number of samples between the peaks of the wave. When the wave hits an obstacle, or in the case or GPR, hits a material with a different dielectric potential, the wavelength is temporarily shortened at the point of the interface before continuing, thus the phase of the wave changes. This effect is what produces the nice curve of the Roman road camber in our example. So what is the problem with the standard display method here? While it is easy to see the phase when the amplitude is high, the bottom of the image is a sea of grey with no contrast, rendering the phase there all but invisible. The common solution to this, often used in the oil industry where they go to very great depths, is something called Automatic Gain Control. For each line at a depth along the B-Scan, an average is taken in a time window around that line and the values along the line are changed to reflect the average. The effect of this is to remove the high amplitude bias at the top of the image and flatten it out, losing the amplitude information. This produced something like this.

Automatic Gain Control

Now you can see the lines all the way to the bottom, but we can still improve on this, as there isn't much contrast.


Graph of AGC data


If we change the display bounds to around the curve of the readings and use a non-linear display process as before, we can get a lot more contrast, resulting in a much clearer image as below.

Automatic Gain Control with better contrast

So far, so standard. Here is something that is hopefully a little different, but someone else has probably thought of it already. With the "envelope" data above, the high amplitude features are visible near the surface, but what about features at depth that have a high amplitude compared to other areas at the same depth, but a low amplitude compared to the features at the surface. They are invisible. If we apply automatic gain control followed by an envelope however, we get something like this.

AGC plus envelope

The effect is to lose the absolute amplitude we had before and gain a relative amplitude showing the strongest features at each sample depth. Of course, we can adjust the display parameters to get a better contrast.

Graph of AGC plus envelope data

If we set the low display bound to exclude the low amplitude samples and use a non-linear palette, we get this.

AGC plus envelope with better contrast

Now we can see the interesting features a lot clearer, including that interesting block to the left of Stane Street and Stane Street itself now shows as much more distinct than the rest of the material at that level. So we have three different display methods that are all better than the standard at doing their thing, but you need to look at all three to get the best picture, which is why most people stick with the standard display process that is a Jack of all trades but a master of none. Wouldn't it be great if you could see all three at once?

Channel merged image

Funky. Could you imagine scrolling through timeslices of that? It would be mindbending. Just like the channel merging I did a few versions back, this display method lets you view all three display methods in the same place. The "envelope" data is in the red channel, the automatic gain control in green and AGC plus envelope in blue. You lose some contrast having them all merged together, but the resulting image I think is far more useful than the standard display method that we are all used to. So there you go, itch scratched and funky GPR plots accomplished. I don't think I'll ever make Snuffler a fully functional GPR processing system, but hopefully this will be useful to someone out there. I may do time slices.

You can download this version of Snuffler in the usual place.

1 comment:

  1. David,

    Charles here. I met you abruptly at Chichester Cathedral yesterday. Loving your work.

    ReplyDelete