ECG Gating

The `Segmentation Thresholds and Gating' panel also allows you to segment and visualise parts of the body moving under the influence of the cardiac pulse. Under these conditions, it is necessary to gate all of Stradx's visualisation and analysis windows to a particular phase of the cardiac cycle. Otherwise, the various windows will show the anatomy at different stages of the cycle, a bit like a blurred photograph. Here's an example showing blurred `Reslice' and `Manifold' images, texture mapped into the `Outline' window:

The ECG Segmentation Controls

The B-scan (outlined in red) corresponds to the systolic phase of the cardiac cycle: there is considerable blood flow in the arteries. The reslice and manifold images (outlined in green), however, are made up of B-scans acquired at various phases of the cycle, and are barely intelligible. With gating, however, you can make the `Reslice' and `Manifold' windows (and any other window) show the anatomy at systole, asystole or any phase you like.

The first step is to estimate the cardiac phase of each B-scan. This is usually done using an electrocardiagram (ECG) monitor attached to the patient, but Stradx attempts to deduce the ECG signal from the B-scans themselves. This is easy if we're dealing with a Doppler ultrasound recording of an artery or arteries: all we need to do is look at the variation in the number of coloured pixels in each B-scan. With the toggle button at the top of the `Segmentation Thresholds and Gating' panel set to `Doppler', press the `Calculate' ECG button. Stradx runs through the entire data set and counts the coloured pixels in every B-scan, producing a pseudo-ECG trace in the `Segmentation Thresholds and Gating' panel like the one below.

The ECG Segmentation Controls

The yellow lines show those B-scans at zero degrees phase (systole). If you click the `Gate to' button, all the other B-scans will be disregarded by all of Stradx's visualisation and analysis windows: you'll only see the anatomy at systole. Here's the same example as above, but this time gated to zero degrees:

The ECG Segmentation Controls

To gate to a different phase, adjust the first slider next to the `Gate to' button. Here's the same example gated to 180 degrees (asystole):

The ECG Segmentation Controls

If your CPU and graphics hardware are up to it, dragging the phase slider will cause all the other windows to update in real time, so you get to see a sort of `movie' of the cardiac pulse: click here for an example. The second slider controls the gating tolerance. For example, here are the selected B-scans (yellow lines) if you gate to 0 degrees plus or minus 45 degrees:

The ECG Segmentation Controls

The default, zero degree tolerance (illustrated higher up this page) is a special case which selects the single B-scan closest to the selected phase: it guarantees the selection of one, and only one, B-scan per cardiac cycle. If you like, you can manually adjust which B-scans are gated and which are not: you can delete yellow lines with the right mouse button and add yellow lines with the left mouse button.

ECG gating can also be useful for segmentation and volume measurement. Suppose we wish to estimate the volume of the lumen flowing through the arteries in the example above. What we need is a segmentation of the arteries at systole (zero degrees). So select zero degrees ECG phase, set up the sliders to segment only the arterial flow (red), choose a suitable value for `Fire jump', and press ECG `Segment':

The ECG Segmentation Controls

Stradx then goes and segments all the red regions in every B-scan corresponding to a yellow line (ie. systole). Here is the resulting set of segmentation contours displayed in the `Outline' window.

The Outline Window

Finally, here is the surface interpolated through the contours by the `Surface' window. The bifurcations of the small artery are clearly visible. The volume of the segmented vessels is about 0.7 ml.

The Surface Window

The ECG signal is harder to detect with greyscale ultrasound recordings, but not impossible. For example, consider this B-scan of the carotid artery and jugular vein. The threshold sliders have been set to highlight bright structures, including the vessel walls, in magenta.

The Review Window

The dotted circle is a user-defined ECG region of interest. At this phase of the cardiac cycle, both walls of the jugular are inside the circle. If we counted the number of magenta pixels inside the circle, we'd get quite a high number. Now consider the B-scan below, acquired at a different point of the cardiac cycle.

The Review Window

This time, the lower wall of the jugular has moved outside the circle, and the magenta pixel count would be considerably lower. In fact, if we've got the ECG region of interest and segmentation sliders right, we can get an ECG trace by simply counting the number of magenta pixels inside the circle. Here's the result:

The ECG Segmentation Controls

The trace is unsurprisingly noisy, but Stradx applies some filters to pick out the dominant frequency component, from which it can estimate the phase of all the B-scans. The phase is used for gating, as described above, and is also displayed (relative to the selected gating phase) inside the circle in the `Review' window:

The Review Window

So this B-scan is about 50 degrees lagging behind the selected gating phase.

All that remains is to describe how to define the ECG region of interest in the `Review' window. Simply click on the `ECG region' button, then click and drag with the left mouse button to define a circle. This circle is projected into the other B-scans automatically. If, as you scroll through the B-scans, the circle starts drifting away from the optimal location, click and drag again to define a new circle in the right place. You can define circles in as many B-scans as you like: the circles in intermediate B-scans are interpolated from the closest user-defined circles. If you make a mistake, you can delete the nearest circle with the right mouse button.

Note that the ECG region of interest is active whenever you have the `Sliders' button selected, even with Doppler data. So, with Doppler data you can estimate the ECG in two ways: (a) with `Sliders' not selected, by counting coloured pixels in the entire B-scan, and (b) with `Sliders' selected, by counting thresholded (magenta) pixels in the ECG region of interest. With greyscale data, only option (b) is available.

Finally, once you've got a good estimate of the ECG signal, either from Doppler or greyscale data, you'll probably want to save it to file: that way, next time you look at the data set you can simply load the ECG phase file, and not go through the whole process of estimating the ECG signal all over again. Not surprisingly, the `Save' button saves the ECG signal, the `Clear' button clears it, and the `Load' button loads a new ECG phase file. The suffix for ECG phase files is .sxp - see the `Stradx Files' section for the .sxp file format.

After you've saved an ECG phase file, you'll notice the data file name in the main window highlighted in yellow, indicating that you may now wish to save the data file. This is because you've now associated this data file with a particular ECG phase file. If you do save the data file, then next time you load the data file the corresponding ECG phase file will be loaded automatically.