Non-Destructive Testing (NDT)
What is non-destructive testing (NDT)?
Non-destructive testing (NDT) (also called non-destructive examination, NDE, or inspection, NDI) is the inspection of a material, part or structure for flaws or for properties such as wall thickness, without damaging it, so the part can go back into service. Common methods use light, liquids, magnetism, eddy currents, X-rays or ultrasound to reveal cracks, voids and corrosion.

A simulated ultrasonic test of a steel plate with a crack and a drilled hole: the A-scan at the probe, a phased-array sector scan, the B-scan cross-section and the C-scan plan view (sample data). Try the interactive version.
- NDT finds flaws without harming the part. Surface methods (visual, penetrant, magnetic particle, eddy current) and volumetric methods (radiography, ultrasound) answer different questions.
- Ultrasonic testing times echoes. Depth is velocity × time ÷ 2, so 5.92 mm/µs in steel turns 4.05 µs into 12.0 mm.
- An A-scan is one trace; B-scans, C-scans and S-scans arrange thousands of A-scans into images.
- Phased array probes steer and focus the beam electronically; TOFD sizes cracks from the signals diffracted at their tips.
- Common mistakes include a wrong velocity setting, too much gain and poor couplant.
Where NDT is used
NDT is used wherever a hidden flaw could cause a failure, and wherever cutting a part open to check it isn't an option:
- Welds, in pipelines, pressure vessels, storage tanks, ships and steel structures, checked after welding and during service.
- Aircraft, for fatigue cracks around fastener holes, corrosion under paint and damage inside composite panels.
- Pipelines and process plant, where wall thickness is measured on a schedule to track corrosion and erosion.
- Railways, where rails and wheelsets are scanned for internal cracks.
- Castings, forgings and composites, inspected in the factory before they ship.
- Power stations, including boiler tubes, turbine parts and nuclear plant.
Inspectors work to written procedures and standards, and the person doing the test is usually certified for that method and level (see NDT standards and certification).
NDT methods compared
Each NDT method suits different flaws and materials: surface methods are quick and cheap, while radiography and ultrasound look through the whole thickness.
| Method | What it finds | Works on | Strengths | Limitations |
|---|---|---|---|---|
| Visual testing (VT) | Surface cracks, corrosion, misalignment, weld shape | Anything you can see, directly or with a borescope | Cheapest and quickest; always done first | Surface only; depends on access, lighting and the inspector |
| Liquid penetrant testing (PT) | Cracks and pores open to the surface | Non-porous materials, metal or not | Simple, portable, shows flaw length clearly | Flaws must break the surface; needs clean parts and chemicals |
| Magnetic particle testing (MT) | Surface and slightly sub-surface cracks | Ferromagnetic steels and irons | Fast, sensitive to fine cracks | Ferromagnetic parts only; flaw direction matters |
| Eddy current testing (ET) | Surface and near-surface cracks, corrosion, coating thickness | Electrically conductive materials | No couplant or contact needed; fast scans of tubes and aircraft skins | Shallow depth; geometry and material changes affect the signal |
| Radiographic testing (RT) | Voids, porosity, inclusions, lack of fusion | Most materials, through their thickness | Permanent image; good for volumetric flaws | Radiation safety; needs access to both sides; poor at cracks lying across the beam |
| Ultrasonic testing (UT) | Internal cracks, lack of fusion, laminations, wall thickness | Metals, plastics, composites, ceramics | Finds and sizes deep flaws from one side; gives depth directly | Needs couplant and a trained operator; coarse-grained materials scatter the sound |
| Acoustic emission (AE) | Cracks growing or leaking under load | Pressure vessels, tanks, bridges | Monitors a whole structure while it's loaded | Only active flaws; needs a load and good noise control |
| Infrared thermography (IRT) | Delaminations, disbonds, moisture, hot spots | Composites, coatings, electrical equipment | Non-contact, covers large areas quickly | Near-surface only; affected by surface emissivity |
Visual, penetrant and magnetic particle testing check the surface; eddy current reaches a little below it. Radiography and ultrasound look inside the part.
Eddy current testing
Eddy current testing passes an alternating current through a coil held near a conductive part. The coil's field induces circulating currents in the metal, and a crack, a thinner wall or a change in conductivity alters those currents, which changes the coil's impedance. The instrument shows that change as a trace on an impedance plane. Higher frequencies concentrate the currents near the surface, and lower ones reach further in, so the frequency is chosen for the depth of interest. It's widely used on heat-exchanger tubes, aircraft skins around fasteners and wheel bores.
How ultrasonic testing works
Ultrasonic testing (UT) sends short pulses of high-frequency sound, usually between about 0.5 and 20 MHz, into a part and listens for echoes. Sound reflects wherever the material changes, at a crack, a void or the far wall, and the time each echo takes to come back gives the depth of whatever reflected it.
A piezoelectric probe turns an electrical pulse into a pulse of sound and turns returning echoes back into a voltage. Air reflects almost all of the sound, so a thin layer of couplant (gel, oil or water) fills the gap between probe and surface.
- A straight-beam probe sends longitudinal waves straight down; it suits plates, forgings, laminations and thickness readings.
- An angle-beam probe sits on a plastic wedge and sends shear waves into the part at an angle, typically 45°, 60° or 70°. It's the usual choice for welds, where the flaws that matter often lie at an angle to the surface.
Pulse-echo and through-transmission
In pulse-echo testing, one probe sends the pulse and receives the echoes from the same side. It's the common method, because it needs access to only one surface and it gives the depth of each reflector.
In through-transmission, one probe sends from one side and a second probe receives on the other. A flaw shows up as a drop in the received signal rather than as an echo. It suits thin, attenuating materials such as composite panels, where echoes are weak, but it can't say how deep the flaw is.
How to read an A-scan
An A-scan is the basic ultrasonic display: received amplitude, as a percentage of full screen height (% FSH), against time of flight. Reading it from left to right:
- The initial pulse (or main bang) at time zero is the transmitted pulse and the probe's ringing. Nothing can be seen while it lasts.
- A flaw echo appears between the initial pulse and the back wall. Its position gives the flaw's depth; its height says how strongly it reflects, which depends on its size, shape and angle.
- The back-wall echo comes from the far surface. If a flaw shadows part of the beam, the back-wall echo drops, which is a clue in its own right.
- Small, random echoes along the baseline, called "grass", are noise from the grains of the metal and the electronics.
A gate is a window in time (or depth) with a threshold height. The instrument reports the highest echo in the gate, its time and its depth, and can sound an alarm when an echo crosses the threshold. Gates are also how B-scan and C-scan images are built from raw A-scans.
Flaw detectors usually show the rectified signal or its envelope rather than the raw radio-frequency (RF) waveform; the demo below draws both.
Time of flight and depth
The pulse travels down to a reflector and back, so the depth of the reflector is
where is the sound velocity in the material and is the time of flight. Longitudinal waves travel at about 5,920 m/s (5.92 mm/µs) in low-alloy steel, the reference velocity for steel standard block No. 1 (ISO 2400, which replaced EN 12223). NIST studied how accurately that velocity can be measured on IIW-type blocks. Shear waves travel at a little over half that, about 3,200 m/s.
A worked example: in a 25 mm steel plate, an echo at 4.05 µs is a reflector 5.92 × 4.05 ÷ 2 = 12.0 mm deep, and the back wall returns at 2 × 25 ÷ 5.92 = 8.45 µs. Each millimetre of steel adds 0.338 µs to the round trip.
Ultrasonic thickness gauge: measuring wall thickness
An ultrasonic thickness gauge applies the same formula to the back-wall echo. It times the echo from the far wall and shows the thickness directly: in steel, an echo at 8.45 µs reads 5.92 × 8.45 ÷ 2 = 25.0 mm. It's the standard way to check pipes, tanks and ship hulls for corrosion from the outside, without draining or opening them.
For a reliable reading:
- The velocity must match the material. The gauge only measures time, so a velocity set 5% too high reads 5% too thick: 26.25 mm instead of 25 mm. Calibrate on a sample of known thickness in the same material.
- Dual-element probes, with separate transmit and receive crystals, read thin and corroded walls better than a single crystal, because the receiver isn't blinded by the transmitted pulse.
- In echo-to-echo mode, the gauge times the gap between two successive back-wall echoes. A 10 mm wall gives echoes 3.38 µs apart. This cancels the coating's thickness, so the reading is the steel under the paint.
Gain, decibels and distance-amplitude correction
Echo heights are compared in decibels. The difference between two amplitudes and is
so adding 6 dB of gain doubles an echo's height, and 20 dB multiplies it by 10. An echo at 40% FSH is 6.0 dB below one at 80%. Inspectors report flaw echoes in dB relative to a reference, such as the back wall in a sound area or a reference hole of known size.
The same flaw gives a smaller echo the deeper it is, because the beam spreads and the material absorbs energy. A distance-amplitude correction (DAC) curve, drawn through the echoes from identical reference holes at several depths in a calibration block, shows how big a reference-sized echo is at each depth. Time-corrected gain (TCG) does the same job the other way round: it raises the gain with time, so that identical reflectors show at the same height at any depth.
A-scan, B-scan, C-scan and S-scan: ultrasonic data displays
Ultrasonic instruments show the same echoes in four standard views: the A-scan as one trace, and the B-, C- and S-scans as images built from many A-scans.
A scanner, encoder or phased array records thousands of A-scans, and each display arranges them differently:
| View | What the axes show | Colour or height | Best for |
|---|---|---|---|
| A-scan | Time (or depth) across, amplitude up | Height of the trace | Reading one position: depth and echo height |
| B-scan | Probe position across, depth down | Echo amplitude (envelope) | A cross-section along one scan line: flaw depth and length |
| C-scan | Position x and y over the part, seen from above | Peak echo amplitude in a gate, or its depth | Mapping where flaws, corrosion or disbonds are, as with an X-ray image |
| D-scan | Position along the weld, depth | Echo amplitude | A side view at right angles to the B-scan, as in TOFD and weld scans |
| S-scan (sector scan) | Beam angle and sound path, drawn as a fan | Echo amplitude | Phased array inspection of welds from one probe position |
A C-scan is in effect a heatmap of the part. When it shows amplitude, a bright patch is a strong reflector; when it shows depth (time of flight), it maps remaining wall thickness, which is how corrosion maps are made. Medical ultrasound images ("B-mode" scans) use the same principle as the industrial B-scan and S-scan, drawing a fan of echo envelopes as a grey-scale image; SciChart's polar ultrasound heatmap draws one of those sector images.
Phased array ultrasonic testing (PAUT), TOFD and other advanced techniques
Phased array and TOFD go beyond a single-element probe: phased array steers and focuses the beam electronically, and TOFD times the waves diffracted from a crack's tips.
Phased array ultrasonic testing (PAUT)
Phased array ultrasonic testing (PAUT) uses a probe made of many small elements in a row, each fired with its own time delay. The waves from the elements add up into one beam, and the set of delays (the focal law) decides its direction and focus. To steer a beam by an angle , each element fires later than its neighbour by
where is the element pitch. For a 0.6 mm pitch steering 30° in steel, that's about 51 ns per element. It's the same delay-and-sum idea that steers the beam of a phased array antenna.
Because the focal laws are switched electronically, one probe can do several kinds of scan:
- A sector scan (S-scan) sweeps the angle, say from 40° to 70°, and draws the result as a fan. One probe position covers a whole weld cross-section.
- A linear (electronic) scan fires groups of elements in turn at a fixed angle, moving the beam along the probe without moving the probe.
- Focusing at a chosen depth gives a narrower beam and better sizing there.
The total focusing method (TFM) records every transmit-receive pair of elements (full matrix capture) and focuses at every point of an image grid in software.
Time of flight diffraction (TOFD)
Time of flight diffraction (TOFD) uses two probes facing each other across a weld, one sending and one receiving. Instead of waiting for a reflection, it picks up the weak signals diffracted from the top and bottom tips of a crack. The receiver sees, in order: a lateral wave along the surface, the upper tip, the lower tip, then the back-wall echo.
With the probes apart, a tip at depth is found from its arrival time by
For probes 60 mm apart in steel ( = 30 mm), the lateral wave arrives at 10.14 µs, and a tip signal at 11.33 µs puts the tip 15.0 mm deep. Because the depths come from times rather than echo heights, TOFD measures crack height well. Its results are shown as a grey-scale D-scan along the weld.
Signal processing for ultrasonic flaw detection
Ultrasonic flaw detection relies on a few signal-processing steps, done in hardware or software, between the raw RF signal and the picture an inspector reads:
- Filtering. A band-pass filter around the probe's frequency (for example 2 to 8 MHz for a 5 MHz probe) removes low-frequency drift and high-frequency electronic noise.
- Envelope detection. The echo's outline, computed by rectifying and smoothing or with the Hilbert transform, gives one amplitude per sample regardless of the wave's phase. B-scans, C-scans and S-scans are built from envelopes.
- Averaging. Averaging several pulses at the same position reduces random electronic noise by the square root of the number of pulses, improving the signal-to-noise ratio. Grain noise doesn't average away, because it's the same at each position.
- Gating and peak detection. The gated peak and its time are what a C-scan stores at each point.
An A-scan is a fast transient, sampled at 100 MHz or more, so the tools for reading it are close to those of an oscilloscope.
NDT standards and certification
Ultrasonic and other NDT work is governed by written standards and certified personnel. The main references include:
- ISO 16810, the general principles of ultrasonic testing.
- ISO 17640, ultrasonic testing of welds: techniques, testing levels and assessment.
- ISO 16809, ultrasonic thickness measurement, and ISO 10863, TOFD for welds.
- ASME Boiler and Pressure Vessel Code, Section V: the nondestructive examination methods referenced by the rest of the code.
- ISO 9712, the qualification and certification of NDT personnel, at levels 1, 2 and 3 for each method.
Product and acceptance standards (for pipelines, pressure vessels or aircraft) then set what must be tested and which flaws are acceptable.
NDT vs destructive testing
Non-destructive testing checks parts that stay in service, while destructive testing breaks samples to measure properties such as strength.
| Non-destructive testing | Destructive testing | |
|---|---|---|
| What happens to the part | Stays in service | Cut, broken, bent or loaded to failure |
| What it tells you | Whether this part has flaws, and where; its thickness | The material's properties: strength, ductility, toughness, hardness |
| How much is tested | Every part, or every weld, can be checked | Samples taken from a batch or a test coupon |
| Typical tests | Visual, penetrant, magnetic particle, eddy current, radiography, ultrasound | Tensile test (stress–strain curve), bend test, impact (Charpy) test, macro sections |
Destructive tests qualify a material or a welding procedure; NDT then checks that each production part or weld made that way is free of unacceptable flaws.
Common ultrasonic testing mistakes
Most ultrasonic testing errors come from calibration, coupling and the near field, not from the instrument.
- Wrong velocity calibration. Depth and thickness are only as accurate as the velocity. Calibrate on a block of the same material, and recalibrate when the temperature changes a lot.
- Ignoring the near field and the dead zone. Close to the probe, the beam is uneven: for a 10 mm, 5 MHz probe in steel the near field reaches about = 21 mm, and echo heights there don't follow the usual rules. The ringing of the initial pulse also hides the first few millimetres. Use a dual-element or delay-line probe for near-surface work.
- Poor or uneven couplant. A dry patch or a rough surface lowers every echo, which can look like a flaw (a lost back wall) or hide one. Watch the back-wall echo as a check that sound is getting in.
- Gain set too high. A saturated echo stops at the top of the screen, so its true height is lost, and grass starts to cross the gate. Set the gain against a reference, then add scanning gain separately.
- Reading a geometric echo as a flaw. Edges, holes, weld caps and roots, and mode-converted waves all give real echoes from sound metal. Work out where each echo comes from before calling it a flaw.
- Missing flaws lying the wrong way. A crack parallel to the beam returns almost nothing. Use more than one angle, or TOFD, for welds.
How to plot ultrasonic A-scans, B-scans and C-scans in JavaScript, React or Angular
The demo below recomputes all four views, the A-scan trace and the B-scan, C-scan and sector images, every time you move the probe or change a setting, and SciChart.js redraws the trace and the three heatmaps. It simulates a 5 MHz, 10 mm contact probe on a steel plate with a planar crack and a 3 mm side-drilled hole, all in the browser. The physics is simplified: a Gaussian-windowed tone burst, a beam that widens with depth, a small material loss, and grain and electronic noise.
Drag the Probe position across the crack (x = 35 mm) and the hole (x = 70 mm), or press Scan to sweep the plate and watch the B-scan and C-scan fill in. Change the Plate thickness, Crack depth, Crack size and Hole depth, then move the Gate start and Gate width to choose what the C-scan maps, and switch C-scan shows between amplitude and depth. Turn up the Gain until the crack echo saturates, and raise the Noise to see grass cross the gate. The readout converts the gated echo's time to depth with d = v·t/2 and gives its height in dB relative to a sound back wall. Scroll to zoom, drag to pan, double-click to reset, and hover for values.
Here is the code for this demo. The ultrasound simulation, the envelope and the gating are plain JavaScript; SciChart.js draws the A-scan, the two heatmaps and the polar sector. The React and Angular versions below draw a B-scan from your own data.
- JavaScript
- React
- Angular
// Ultrasonic testing of a steel plate: an A-scan with a gate, a B-scan cross-section, a C-scan plan view
// and a phased-array sector scan (S-scan), charted with SciChart.js
const {
SciChartSurface,
SciChartPolarSurface,
NumericAxis,
PolarNumericAxis,
NumberRange,
EAutoRange,
EAxisAlignment,
EPolarAxisMode,
FastLineRenderableSeries,
XyDataSeries,
UniformHeatmapDataSeries,
UniformHeatmapRenderableSeries,
PolarUniformHeatmapRenderableSeries,
HeatmapColorMap,
LineAnnotation,
TextAnnotation,
VerticalLineAnnotation,
HorizontalLineAnnotation,
EHorizontalAnchorPoint,
EVerticalAnchorPoint,
SciChartJsNavyTheme,
CursorModifier,
LegendModifier,
ELegendOrientation,
ELegendPlacement,
MouseWheelZoomModifier,
ZoomPanModifier,
ZoomExtentsModifier,
PolarMouseWheelZoomModifier,
PolarPanModifier,
PolarZoomExtentsModifier
} = SciChart;
// or, for npm, import { SciChartSurface, ... } from "scichart"
const GATE_LEVEL = 20; // % of full screen height: echoes in the gate must cross this to count
const SAMPLE_STEP = 0.01; // µs, a 100 MHz digitiser
// Depth from time of flight: the pulse goes down and back, so depth = velocity × time / 2
const depthFromTime = (timeUs) => (VELOCITY * timeUs) / 2;
const timeFromDepth = (depthMm) => (2 * depthMm) / VELOCITY;
// Screen height in % of full screen height (FSH) for a raw amplitude at a gain in dB
const toScreen = (raw, gainDb) => raw * DISPLAY_SCALE * Math.pow(10, gainDb / 20);
// Envelope (magnitude of the analytic signal), clipped at the top of the screen as a flaw detector does
const envelopeOf = (signal, i, gainDb) => Math.min(100, toScreen(Math.hypot(signal.re[i], signal.im[i]), gainDb));
// The gated peak at one probe position: highest envelope inside the gate, its time and its depth
function gatedPeak(block, settings, px, py) {
const echoes = echoesAt(block, px, py, 0);
const from = timeFromDepth(settings.gateStart);
const to = timeFromDepth(settings.gateStart + settings.gateWidth);
const times = [];
for (let t = from; t <= to; t += 0.02) times.push(t);
const signal = receivedSignal(echoes, times, settings.noise, seedFor(px, py, 0), true);
let peak = 0;
let peakTime = 0;
for (let i = 0; i < times.length; i++) {
const value = envelopeOf(signal, i, settings.gain);
if (value > peak) {
peak = value;
peakTime = times[i];
}
}
return { peak, peakTime };
}
// One colour map for all three images: dark for no echo, through blue and cyan, to yellow and red for strong
const makeColorMap = (maximum) =>
new HeatmapColorMap({
minimum: 0,
maximum,
gradientStops: [
{ offset: 0, color: "#0B1A3A" },
{ offset: 0.25, color: "#1F4FA8" },
{ offset: 0.5, color: "#2FB8D9" },
{ offset: 0.75, color: "#F5E663" },
{ offset: 1, color: "#FF4D4D" }
]
});
const theme = new SciChartJsNavyTheme();
const titleStyle = { fontSize: 14 };
const axisTitleStyle = { fontSize: 13 };
const cartesianModifiers = () => [
new CursorModifier({ showTooltip: true, showYLine: true }),
new MouseWheelZoomModifier(),
new ZoomPanModifier(),
new ZoomExtentsModifier()
];
// --- 1. A-scan: amplitude against time, with a second axis showing depth in steel ---
const aScan = await SciChartSurface.create(ui.aScanDiv, { theme, title: "A-scan at the probe", titleStyle });
const aTime = new NumericAxis(aScan.wasmContext, {
axisTitle: "Time of flight (µs)",
axisTitleStyle,
autoRange: EAutoRange.Never,
labelPrecision: 1
});
const aDepth = new NumericAxis(aScan.wasmContext, {
id: "depth",
axisAlignment: EAxisAlignment.Top,
axisTitle: "Depth in steel (mm), d = v·t/2",
axisTitleStyle,
autoRange: EAutoRange.Never,
drawMajorGridLines: false,
drawMinorGridLines: false,
labelPrecision: 0
});
// Keep the depth axis in step with the time axis as you zoom and pan
aTime.visibleRangeChanged.subscribe(({ visibleRange }) => {
aDepth.visibleRange = new NumberRange(depthFromTime(visibleRange.min), depthFromTime(visibleRange.max));
});
aScan.sciChartSurface.xAxes.add(aTime, aDepth);
aScan.sciChartSurface.yAxes.add(
new NumericAxis(aScan.wasmContext, {
axisTitle: "Amplitude (% screen height)",
axisTitleStyle,
autoRange: EAutoRange.Never,
visibleRange: new NumberRange(-105, 120),
labelPrecision: 0
})
);
const rfSeries = new XyDataSeries(aScan.wasmContext, { dataSeriesName: "RF signal", dataIsSortedInX: true });
const envelopeSeries = new XyDataSeries(aScan.wasmContext, { dataSeriesName: "Envelope", dataIsSortedInX: true });
aScan.sciChartSurface.renderableSeries.add(
new FastLineRenderableSeries(aScan.wasmContext, { dataSeries: rfSeries, stroke: "#50C7E099", strokeThickness: 1 }),
new FastLineRenderableSeries(aScan.wasmContext, { dataSeries: envelopeSeries, stroke: "#F48420", strokeThickness: 2 })
);
const gateLine = new LineAnnotation({ y1: GATE_LEVEL, y2: GATE_LEVEL, stroke: "#F5E663", strokeThickness: 3 });
const gateLabel = new TextAnnotation({
text: "Gate",
textColor: "#F5E663",
fontSize: 12,
y1: GATE_LEVEL,
verticalAnchorPoint: EVerticalAnchorPoint.Bottom
});
const echoLabels = ["← Initial pulse", "Crack", "Hole", "Back wall"].map(
(text) =>
new TextAnnotation({
text,
textColor: "#FFFFFF",
fontSize: 12,
horizontalAnchorPoint: EHorizontalAnchorPoint.Center,
verticalAnchorPoint: EVerticalAnchorPoint.Bottom
})
);
aScan.sciChartSurface.annotations.add(gateLine, gateLabel, ...echoLabels);
aScan.sciChartSurface.chartModifiers.add(
...cartesianModifiers(),
new LegendModifier({ showCheckboxes: false, orientation: ELegendOrientation.Horizontal, placement: ELegendPlacement.BottomRight })
);
// --- 2. B-scan: probe position against depth, colour = envelope amplitude ---
const bScan = await SciChartSurface.create(ui.bScanDiv, { theme, title: "B-scan along y = 30 mm", titleStyle });
bScan.sciChartSurface.xAxes.add(
new NumericAxis(bScan.wasmContext, { axisTitle: "Probe position x (mm)", axisTitleStyle, labelPrecision: 0 })
);
bScan.sciChartSurface.yAxes.add(
new NumericAxis(bScan.wasmContext, {
axisTitle: "Depth (mm)",
axisTitleStyle,
flippedCoordinates: true, // depth increases downwards, like a cross-section
labelPrecision: 0
})
);
const bData = new UniformHeatmapDataSeries(bScan.wasmContext, {
xStart: 0,
xStep: 0.5,
yStart: 0,
yStep: 1,
zValues: [[0]]
});
bScan.sciChartSurface.renderableSeries.add(
new UniformHeatmapRenderableSeries(bScan.wasmContext, { dataSeries: bData, colorMap: makeColorMap(100) })
);
const markerStyle = { stroke: "#FFFFFF", strokeThickness: 1, strokeDashArray: [4, 4] };
const bProbe = new VerticalLineAnnotation({ ...markerStyle, x1: 0, showLabel: true, labelValue: "Probe" });
const bGateTop = new HorizontalLineAnnotation({ ...markerStyle, stroke: "#F5E663", y1: 0 });
const bGateBottom = new HorizontalLineAnnotation({ ...markerStyle, stroke: "#F5E663", y1: 0 });
bScan.sciChartSurface.annotations.add(bProbe, bGateTop, bGateBottom);
bScan.sciChartSurface.chartModifiers.add(...cartesianModifiers());
// --- 3. C-scan: plan view of the whole plate, colour = gated peak amplitude or its depth ---
const cScan = await SciChartSurface.create(ui.cScanDiv, { theme, title: "C-scan (plan view)", titleStyle });
cScan.sciChartSurface.xAxes.add(
new NumericAxis(cScan.wasmContext, {
axisTitle: "x (mm)",
axisTitleStyle,
labelPrecision: 0,
visibleRange: new NumberRange(0, PLATE.length)
})
);
cScan.sciChartSurface.yAxes.add(
new NumericAxis(cScan.wasmContext, {
axisTitle: "y (mm)",
axisTitleStyle,
labelPrecision: 0,
visibleRange: new NumberRange(0, PLATE.width)
})
);
const cData = new UniformHeatmapDataSeries(cScan.wasmContext, {
xStart: -0.5,
xStep: 1,
yStart: -0.5,
yStep: 1,
zValues: [[0]]
});
const cSeries = new UniformHeatmapRenderableSeries(cScan.wasmContext, {
dataSeries: cData,
colorMap: makeColorMap(100),
fillValuesOutOfRange: false // cells with no echo above the gate level (value -1) stay empty
});
cScan.sciChartSurface.renderableSeries.add(cSeries);
const cProbe = new VerticalLineAnnotation({ ...markerStyle, x1: 0 });
const cLine = new HorizontalLineAnnotation({
...markerStyle,
y1: SCAN_LINE_Y,
showLabel: true,
labelValue: "B-scan line"
});
cScan.sciChartSurface.annotations.add(cProbe, cLine);
cScan.sciChartSurface.chartModifiers.add(...cartesianModifiers());
// --- 4. S-scan: a phased-array sector, -30° to +30° from straight down, on a polar heatmap ---
const sScan = await SciChartPolarSurface.create(ui.sScanDiv, {
theme,
title: "S-scan, −30° to +30° (phased array sector)",
titleStyle
});
const sectorStart = (3 * Math.PI) / 2 - Math.PI / 6; // centred on 6 o'clock, 60° wide
const SECTOR_OFFSET = -0.12 * ui.sScanDiv.clientHeight;
const SECTOR_SCALE = 1.15;
sScan.sciChartSurface.xAxes.add(
new PolarNumericAxis(sScan.wasmContext, {
polarAxisMode: EPolarAxisMode.Angular,
visibleRange: new NumberRange(-30, 30),
startAngle: sectorStart,
totalAngle: Math.PI / 3,
// With the radial axis enlarged, angle labels would sit inside the fan, so the spokes
// (every 10°) carry the angle and the title gives the range
drawLabels: false,
autoTicks: false,
majorDelta: 10,
drawMajorBands: false,
drawMinorGridLines: false,
// The sector only uses the bottom of the circle, so move the centre up and enlarge the circle
yCenterOffset: SECTOR_OFFSET
})
);
const sRadial = new PolarNumericAxis(sScan.wasmContext, {
polarAxisMode: EPolarAxisMode.Radial,
startAngle: sectorStart,
axisTitle: "Sound path (mm)",
axisTitleStyle,
autoRange: EAutoRange.Never,
labelPrecision: 0,
drawMajorBands: false,
drawMinorGridLines: false,
lengthScale: SECTOR_SCALE
});
sScan.sciChartSurface.yAxes.add(sRadial);
const sData = new UniformHeatmapDataSeries(sScan.wasmContext, {
xStart: -30,
xStep: 1,
yStart: 0,
yStep: 1,
zValues: [[0]]
});
sScan.sciChartSurface.renderableSeries.add(
new PolarUniformHeatmapRenderableSeries(sScan.wasmContext, { dataSeries: sData, colorMap: makeColorMap(100) })
);
sScan.sciChartSurface.chartModifiers.add(
new PolarMouseWheelZoomModifier(),
new PolarPanModifier(),
new PolarZoomExtentsModifier()
);
// --- Reading the controls ---
function readSettings() {
const value = (id) => Number(ui.inputs[id].value);
const thickness = value("thickness");
// Keep both flaws inside the plate
ui.inputs.crackDepth.max = String(thickness - 2);
ui.inputs.holeDepth.max = String(thickness - 3);
return {
position: value("position"),
thickness,
crackDepth: Math.min(value("crackDepth"), thickness - 2),
crackSize: value("crackSize"),
holeDepth: Math.min(value("holeDepth"), thickness - 3),
gain: value("gain"),
gateStart: value("gateStart"),
gateWidth: value("gateWidth"),
noise: value("noise") / 100,
cMode: ui.cModeSelect.value
};
}
const blockFrom = (s) => ({
thickness: s.thickness,
crackDepth: s.crackDepth,
crackSize: s.crackSize,
holeDepth: s.holeDepth,
withFlaws: true
});
// --- B-scan and C-scan: recomputed when the plate, flaws, gain, gate or noise change ---
let bFull = [];
let cFull = [];
let revealUpTo = PLATE.length; // during a scan, only the part already passed is shown
function computeImages(s) {
const block = blockFrom(s);
// B-scan: one A-scan envelope every 0.5 mm along the scan line, sampled at 240 depths
const maxDepth = 1.2 * s.thickness;
const rows = 240;
const depthStep = maxDepth / rows;
const times = Array.from({ length: rows }, (_, i) => timeFromDepth((i + 0.5) * depthStep));
bFull = Array.from({ length: rows }, () => new Array(201).fill(0));
for (let col = 0; col <= 200; col++) {
const px = col * 0.5;
const signal = receivedSignal(echoesAt(block, px, SCAN_LINE_Y, 0), times, s.noise, seedFor(px, SCAN_LINE_Y, 0), true);
for (let row = 0; row < rows; row++) bFull[row][col] = envelopeOf(signal, row, s.gain);
}
bData.yStep = depthStep;
bScan.sciChartSurface.yAxes.get(0).visibleRange = new NumberRange(0, maxDepth);
bScan.sciChartSurface.xAxes.get(0).visibleRange = new NumberRange(0, PLATE.length);
// C-scan: the gated peak every 1 mm over the plate. Amplitude in % screen height, or the
// depth of that peak from its time of flight; -1 where nothing in the gate crosses the gate level
cFull = [];
for (let y = 0; y <= PLATE.width; y++) {
const row = [];
for (let x = 0; x <= PLATE.length; x++) {
const { peak, peakTime } = gatedPeak(block, s, x, y);
if (peak < GATE_LEVEL) row.push(-1);
else row.push(s.cMode === "depth" ? depthFromTime(peakTime) : peak);
}
cFull.push(row);
}
cSeries.colorMap = s.cMode === "depth" ? makeColorMap(s.thickness) : makeColorMap(100);
cScan.sciChartSurface.title = s.cMode === "depth" ? "C-scan: depth of gated echo (mm)" : "C-scan: peak in gate (% FSH)";
showImages();
}
function showImages() {
const cols = Math.round(revealUpTo * 2);
bData.setZValues(bFull.map((row) => row.map((value, col) => (col <= cols ? value : 0))));
cData.setZValues(cFull.map((row) => row.map((value, x) => (x <= revealUpTo ? value : -1))));
}
// --- A-scan, S-scan and readout: recomputed when the probe moves too ---
function updateProbe(s) {
const block = blockFrom(s);
const px = s.position;
const maxTime = timeFromDepth(1.2 * s.thickness);
// A-scan: 0 to 1.2 × the back-wall time, every 10 ns
const times = [];
for (let t = 0; t <= maxTime; t += SAMPLE_STEP) times.push(t);
const echoes = echoesAt(block, px, SCAN_LINE_Y, 0);
const signal = receivedSignal(echoes, times, s.noise, seedFor(px, SCAN_LINE_Y, 0), true);
const gain = Math.pow(10, s.gain / 20) * DISPLAY_SCALE;
const rf = times.map((_, i) => Math.max(-100, Math.min(100, signal.re[i] * gain)));
const envelope = times.map((_, i) => envelopeOf(signal, i, s.gain));
rfSeries.clear();
rfSeries.appendRange(times, rf);
envelopeSeries.clear();
envelopeSeries.appendRange(times, envelope);
// Label each echo above its peak, if it shows on the screen
const heightAt = (t) => envelope[Math.min(envelope.length - 1, Math.round(t / SAMPLE_STEP))] || 0;
const labelAt = (label, t) => {
const h = heightAt(t);
label.isHidden = h < 8 || t > maxTime;
label.x1 = t;
label.y1 = Math.min(h, 100) + 3;
};
labelAt(echoLabels[0], 0.25);
echoLabels[0].x1 = 1.1;
echoLabels[0].y1 = 92;
echoLabels[0].isHidden = false;
echoLabels[0].horizontalAnchorPoint = EHorizontalAnchorPoint.Left;
echoes.forEach((echo, i) => labelAt(echoLabels[i + 1], timeFromDepth(echo.path)));
// The gate, drawn in time on the A-scan and as depth lines on the B-scan
const gateFrom = timeFromDepth(s.gateStart);
const gateTo = timeFromDepth(s.gateStart + s.gateWidth);
gateLine.x1 = gateFrom;
gateLine.x2 = gateTo;
gateLabel.x1 = gateFrom;
bGateTop.y1 = s.gateStart;
bGateBottom.y1 = s.gateStart + s.gateWidth;
bProbe.x1 = px;
cProbe.x1 = px;
// Readout: gated peak, depth from time of flight, and dB relative to the back wall of a sound area
const { peak, peakTime } = gatedPeak(block, s, px, SCAN_LINE_Y);
const soundBackWall = echoesAt({ ...block, withFlaws: false }, px, SCAN_LINE_Y, 0)[0];
const backWallScreen = toScreen(soundBackWall.amplitude, s.gain);
let text = `Probe at x = ${px.toFixed(1)} mm · back wall at ${timeFromDepth(s.thickness).toFixed(2)} µs. `;
if (peak < GATE_LEVEL) {
text += `Nothing in the gate crosses ${GATE_LEVEL}% screen height.`;
} else if (peak >= 100) {
text += `Gated echo at ${peakTime.toFixed(2)} µs → depth ${depthFromTime(peakTime).toFixed(1)} mm, but it is <b>saturated</b> at 100%: lower the gain to measure its height.`;
} else {
const relativeDb = 20 * Math.log10(peak / backWallScreen);
text +=
`Gated echo <b>${peak.toFixed(0)}%</b> at ${peakTime.toFixed(2)} µs → depth = 5.92 × ${peakTime.toFixed(2)} / 2 = ` +
`<b>${depthFromTime(peakTime).toFixed(1)} mm</b> · ${relativeDb.toFixed(1)} dB relative to a sound back wall`;
}
ui.summary.innerHTML = text;
// S-scan: a fan of beams from -30° to +30°, each sampled at 200 points along its sound path
const maxPath = (1.2 * s.thickness) / Math.cos(Math.PI / 6);
const rows = 200;
const pathStep = maxPath / rows;
const pathTimes = Array.from({ length: rows }, (_, i) => timeFromDepth((i + 0.5) * pathStep));
const sValues = Array.from({ length: rows }, () => new Array(60).fill(0));
for (let col = 0; col < 60; col++) {
const angle = -29.5 + col;
const beam = receivedSignal(
echoesAt(block, px, SCAN_LINE_Y, angle, 0.4),
pathTimes,
s.noise,
seedFor(px, SCAN_LINE_Y, Math.round(angle)),
true
);
for (let row = 0; row < rows; row++) sValues[row][col] = envelopeOf(beam, row, s.gain);
}
sData.yStep = pathStep;
sData.setZValues(sValues);
sRadial.visibleRange = new NumberRange(0, maxPath);
}
// --- Wiring the controls ---
let lastThickness = 0;
function update(recompute) {
const s = readSettings();
ui.outputs.position.textContent = `${s.position.toFixed(1)} mm`;
ui.outputs.thickness.textContent = `${s.thickness} mm`;
ui.outputs.crackDepth.textContent = `${s.crackDepth.toFixed(1)} mm`;
ui.outputs.crackSize.textContent = `${s.crackSize.toFixed(1)} mm`;
ui.outputs.holeDepth.textContent = `${s.holeDepth.toFixed(1)} mm`;
ui.outputs.gain.textContent = `${s.gain} dB`;
ui.outputs.gateStart.textContent = `${s.gateStart.toFixed(1)} mm`;
ui.outputs.gateWidth.textContent = `${s.gateWidth.toFixed(1)} mm`;
ui.outputs.noise.textContent = `${Math.round(s.noise * 100)}%`;
if (s.thickness !== lastThickness) {
aTime.visibleRange = new NumberRange(0, timeFromDepth(1.2 * s.thickness));
lastThickness = s.thickness;
}
if (recompute) computeImages(s);
updateProbe(s);
}
// Several slider events can arrive per frame; redraw at most once per frame
let pending = null;
const schedule = (recompute) => {
if (pending === null) {
pending = recompute;
requestAnimationFrame(() => {
const doRecompute = pending;
pending = null;
update(doRecompute);
});
} else {
pending = pending || recompute;
}
};
ui.inputs.position.addEventListener("input", () => schedule(false));
for (const id of ["thickness", "crackDepth", "crackSize", "holeDepth", "gain", "gateStart", "gateWidth", "noise"]) {
ui.inputs[id].addEventListener("input", () => schedule(true));
}
ui.cModeSelect.addEventListener("change", () => schedule(true));
// Scan: sweep the probe along the plate; the B-scan and C-scan fill in behind it
let scanning = false;
ui.scanButton.addEventListener("click", () => {
scanning = !scanning;
ui.scanButton.textContent = scanning ? "Stop" : "Scan";
if (!scanning) return;
let x = 0;
const step = () => {
if (!scanning || x > PLATE.length) {
scanning = false;
ui.scanButton.textContent = "Scan";
revealUpTo = PLATE.length;
showImages();
return;
}
ui.inputs.position.value = String(x);
revealUpTo = x;
showImages();
update(false);
x += 1;
requestAnimationFrame(step);
};
step();
});
update(true);
import { SciChartReact } from "scichart-react";
import {
SciChartSurface,
NumericAxis,
NumberRange,
UniformHeatmapDataSeries,
UniformHeatmapRenderableSeries,
HeatmapColorMap,
VerticalLineAnnotation,
SciChartJsNavyTheme,
CursorModifier,
MouseWheelZoomModifier,
ZoomPanModifier,
ZoomExtentsModifier
} from "scichart";
// A B-scan: envelope amplitude (% screen height) by probe position (columns) and depth (rows)
const initChart = async (rootElement: string | HTMLDivElement) => {
const { wasmContext, sciChartSurface } = await SciChartSurface.create(rootElement, {
theme: new SciChartJsNavyTheme(),
title: "B-scan"
});
// zValues[depthIndex][positionIndex], with the position and depth step in mm
const { zValues, positionStep, depthStep, probePosition } = await getYourBScanData();
sciChartSurface.xAxes.add(new NumericAxis(wasmContext, { axisTitle: "Probe position (mm)" }));
sciChartSurface.yAxes.add(
new NumericAxis(wasmContext, {
axisTitle: "Depth (mm)",
flippedCoordinates: true, // depth increases downwards
visibleRange: new NumberRange(0, zValues.length * depthStep)
})
);
sciChartSurface.renderableSeries.add(
new UniformHeatmapRenderableSeries(wasmContext, {
dataSeries: new UniformHeatmapDataSeries(wasmContext, {
xStart: 0,
xStep: positionStep,
yStart: 0,
yStep: depthStep,
zValues
}),
colorMap: new HeatmapColorMap({
minimum: 0,
maximum: 100,
gradientStops: [
{ offset: 0, color: "#0B1A3A" },
{ offset: 0.25, color: "#1F4FA8" },
{ offset: 0.5, color: "#2FB8D9" },
{ offset: 0.75, color: "#F5E663" },
{ offset: 1, color: "#FF4D4D" }
]
})
})
);
sciChartSurface.annotations.add(
new VerticalLineAnnotation({ x1: probePosition, stroke: "#FFFFFF", strokeDashArray: [4, 4] })
);
sciChartSurface.chartModifiers.add(
new CursorModifier({ showTooltip: true }),
new MouseWheelZoomModifier(),
new ZoomPanModifier(),
new ZoomExtentsModifier()
);
return { sciChartSurface };
};
// SciChartReact creates the chart, sizes it to its parent and cleans it up
export const BScan = () => <SciChartReact initChart={initChart} style={{ width: "100%", height: 400 }} />;
import { Component } from "@angular/core";
import { ScichartAngularComponent } from "scichart-angular";
import {
SciChartSurface,
NumericAxis,
NumberRange,
UniformHeatmapDataSeries,
UniformHeatmapRenderableSeries,
HeatmapColorMap,
VerticalLineAnnotation,
SciChartJsNavyTheme,
CursorModifier,
MouseWheelZoomModifier,
ZoomPanModifier,
ZoomExtentsModifier
} from "scichart";
// A B-scan: envelope amplitude (% screen height) by probe position (columns) and depth (rows)
const initChart = async (rootElement: string | HTMLDivElement) => {
const { wasmContext, sciChartSurface } = await SciChartSurface.create(rootElement, {
theme: new SciChartJsNavyTheme(),
title: "B-scan"
});
// zValues[depthIndex][positionIndex], with the position and depth step in mm
const { zValues, positionStep, depthStep, probePosition } = await getYourBScanData();
sciChartSurface.xAxes.add(new NumericAxis(wasmContext, { axisTitle: "Probe position (mm)" }));
sciChartSurface.yAxes.add(
new NumericAxis(wasmContext, {
axisTitle: "Depth (mm)",
flippedCoordinates: true, // depth increases downwards
visibleRange: new NumberRange(0, zValues.length * depthStep)
})
);
sciChartSurface.renderableSeries.add(
new UniformHeatmapRenderableSeries(wasmContext, {
dataSeries: new UniformHeatmapDataSeries(wasmContext, {
xStart: 0,
xStep: positionStep,
yStart: 0,
yStep: depthStep,
zValues
}),
colorMap: new HeatmapColorMap({
minimum: 0,
maximum: 100,
gradientStops: [
{ offset: 0, color: "#0B1A3A" },
{ offset: 0.25, color: "#1F4FA8" },
{ offset: 0.5, color: "#2FB8D9" },
{ offset: 0.75, color: "#F5E663" },
{ offset: 1, color: "#FF4D4D" }
]
})
})
);
sciChartSurface.annotations.add(
new VerticalLineAnnotation({ x1: probePosition, stroke: "#FFFFFF", strokeDashArray: [4, 4] })
);
sciChartSurface.chartModifiers.add(
new CursorModifier({ showTooltip: true }),
new MouseWheelZoomModifier(),
new ZoomPanModifier(),
new ZoomExtentsModifier()
);
return { sciChartSurface };
};
@Component({
selector: "app-b-scan",
standalone: true,
imports: [ScichartAngularComponent],
// scichart-angular creates the chart, sizes it and cleans it up
template: `<scichart-angular [initChart]="initChart" style="display: block; width: 100%; height: 400px"></scichart-angular>`
})
export class BScanComponent {
initChart = initChart;
}
Key points:
- The A-scan is two
FastLineRenderableSeries(RF and envelope) over the time axis. A secondNumericAxison top shows depth; avisibleRangeChangedhandler keeps it at v·t/2 of the time axis as you zoom. - B-scans and C-scans are
UniformHeatmapRenderableSeriesover aUniformHeatmapDataSeries. CallingsetZValuesreplaces the image;flippedCoordinateson the depth axis puts the surface at the top. SettingfillValuesOutOfRange: falseleaves cells with no gated echo empty. - The phased-array sector is a
PolarUniformHeatmapRenderableSerieson aSciChartPolarSurface, with the angular axis limited to a 60° sector centred on six o'clock withstartAngleandtotalAngle. - The gate, probe and scan-line markers are
LineAnnotation,VerticalLineAnnotationandHorizontalLineAnnotations, moved by setting their coordinates; nothing is rebuilt when the probe moves.
See it in the demo app: JavaScript polar ultrasound heatmap · React polar ultrasound heatmap · Angular polar ultrasound heatmap. Related techniques: the React heatmap chart, React line chart, React chart annotations and React synchronised multi-chart.
Go deeper: SciChart.js polar heatmap documentation, the uniform heatmap, the line chart, and the learning center guides to the heatmap, the Hilbert transform and vibration analysis. For the industries, see SciChart for design, emulation and test, instrumentation and aerospace and defence.
Frequently asked questions
What is non-destructive testing?
Non-destructive testing (NDT) is the inspection of a material, part or structure for flaws, or for properties such as wall thickness, without damaging it, so it can go back into service. Welds, pipelines, aircraft, pressure vessels and rails are checked this way, with methods such as visual inspection, liquid penetrant, magnetic particle, eddy current, radiography and ultrasonic testing.
What are the main NDT methods?
The methods used most are visual testing, liquid penetrant testing and magnetic particle testing for surface flaws, eddy current testing for surface and near-surface flaws in conductive metals, and radiography and ultrasonic testing for flaws inside the material. Acoustic emission and infrared thermography are used for monitoring structures and for composites.
What is the difference between an A-scan, B-scan and C-scan?
An A-scan is a single trace of echo amplitude against time at one probe position. A B-scan lines up many A-scans taken along a line, giving a side-view cross-section with probe position across and depth down. A C-scan is a plan view of the part from above, where each point's colour shows the echo amplitude, or its depth, inside a chosen depth window called a gate.
What is phased array ultrasonic testing (PAUT)?
Phased array ultrasonic testing uses a probe made of many small elements, each pulsed with its own time delay. Changing the delays steers the beam to different angles and focuses it at different depths without moving the probe. A sweep of angles gives a fan-shaped sector scan (S-scan), which shows a cross-section of a weld in a single image.
How does an ultrasonic thickness gauge work?
An ultrasonic thickness gauge sends a pulse into the wall and times the echo from the far surface. The pulse travels down and back, so the thickness is the sound velocity times the time divided by two. In steel, at 5,920 m/s, an echo after 8.45 microseconds means a wall 25.0 mm thick. The gauge must be calibrated for the material's sound velocity.
How do I plot an ultrasonic A-scan or C-scan in JavaScript?
Plot the A-scan as a line chart of amplitude against time of flight, and add a second x-axis for depth (velocity times time over two). Draw B-scans and C-scans as heatmaps: a 2D array of envelope amplitudes, with probe position and depth, or x and y over the part, on the axes. With SciChart.js, use a FastLineRenderableSeries for the A-scan, a UniformHeatmapRenderableSeries for B- and C-scans, and a PolarUniformHeatmapRenderableSeries for a phased-array sector scan.
Sources
- Krautkrämer, J. and Krautkrämer, H. (1990), Ultrasonic Testing of Materials, 4th edition. Springer. Wave types and velocities, near field and beam spread, pulse-echo and through-transmission, displays, DAC and DGS evaluation, TOFD.
- Lerch, T., Renken, M. C. and Fortunko, C. M. (1999), Measurements of longitudinal-wave velocity in IIW-type calibration blocks. Review of Progress in Quantitative Nondestructive Evaluation, vol. 18. How accurately the 5,920 m/s reference velocity can be measured.
- ISO (2024), ISO 16810:2024 Non-destructive testing — Ultrasonic testing — General principles. General requirements for ultrasonic testing; personnel qualified to ISO 9712.
- ASME (2025), Boiler and Pressure Vessel Code, Section V: Nondestructive Examination. Methods and requirements for UT, phased array, TOFD, radiography and the other methods.
- ASNT, Nondestructive testing methods. Overview of the main NDT methods, including visual, penetrant, magnetic particle, electromagnetic (eddy current), radiographic and ultrasonic testing.
- ISO 17640, Non-destructive testing of welds — Ultrasonic testing — Techniques, testing levels, and assessment; ISO 16809, Non-destructive testing — Ultrasonic thickness measurement; ISO 10863, Non-destructive testing of welds — Ultrasonic testing — Use of time-of-flight diffraction technique (TOFD); ISO 9712, Non-destructive testing — Qualification and certification of NDT personnel.
- ISO (2025), ISO 2400:2025 Non-destructive testing — Ultrasonic testing — Specification for standard block No. 1. The steel block used to set up ultrasonic equipment, and its 5,920 m/s reference velocity.
- ASNT, Ultrasonic Testing. Overview of ultrasonic testing, its displays, techniques and applications.