The Importance of Calculating Full-Width at Half-Maximum (FWHM) in Medical Physics

M Mahdi Ramadhan, M. Si
4 min readApr 7, 2024

--

In medical physics, the accurate characterization of signals is crucial for various diagnostic and therapeutic applications. One of the fundamental parameters used in signal analysis is the Full-Width at Half-Maximum (FWHM). FWHM represents the width of a waveform at half of its maximum amplitude and plays a significant role in various aspects of medical physics.

Importance of FWHM in Medical Physics:

  1. Resolution in Imaging Techniques: FWHM is commonly used to quantify the spatial resolution of imaging systems such as X-ray imaging, MRI, PET, and SPECT. A smaller FWHM indicates higher spatial resolution, enabling better visualization of anatomical structures and finer details in medical images. Accurate assessment of spatial resolution is essential for diagnostic accuracy and treatment planning.
  2. Quantification of Signal Characteristics: FWHM provides valuable information about the shape and spread of signals in medical physics applications. For instance, in gamma spectroscopy used for radionuclide imaging and radiation dosimetry, FWHM helps in determining the energy resolution of detectors. Precise energy resolution ensures accurate identification and quantification of radioactive isotopes, essential for accurate diagnosis and treatment monitoring.
  3. Determination of Temporal Characteristics: In dynamic medical imaging modalities such as functional MRI (fMRI) and dynamic PET, FWHM is used to characterize the temporal dynamics of physiological processes. By analyzing the FWHM of temporal signal changes, medical physicists can assess the kinetics of tracer uptake, blood flow, and metabolic activity in tissues. This information is vital for understanding disease progression, evaluating treatment response, and designing targeted therapies.
  4. Quality Assurance and Instrument Calibration: FWHM serves as a metric for quality assurance and calibration of medical devices and instruments. Regular measurement of FWHM ensures the proper functioning of imaging systems, radiation detectors, and other medical equipment. Deviations from expected FWHM values may indicate equipment malfunction or calibration errors, prompting corrective actions to maintain diagnostic accuracy and patient safety.

Let's dive into code

def fwhm(x, y):
"""
Full-Width at Half-Maximum (FWHM) of the waveform y(x) and its polarity.
The FWHM result in 'width' will be in units of 'x'.

Args:
x: array-like, The x-axis values.
y: array-like, The y-axis values.

Returns:
width: float, Full width at half maximum.
"""

# Normalize y
y = y / max(y)
N = len(y)
lev50 = 0.5

# Find index of center (max or min) of pulse
if y[0] < lev50:
centerindex = y.index(max(y))
print('Pulse Polarity = Positive')
else:
centerindex = y.index(min(y))
print('Pulse Polarity = Negative')

i = 1
while (y[i] - lev50) * (y[i - 1] - lev50) > 0:
i += 1 # First crossing is between y[i-1] & y[i]
if i == N:
break

interp = (lev50 - y[i - 1]) / (y[i] - y[i - 1])
tlead = x[i - 1] + interp * (x[i] - x[i - 1])

i = centerindex + 1 # Start search for next crossing at center

try:
while (y[i] - lev50) * (y[i - 1] - lev50) > 0 and i < N - 1:
i += 1

if i != N:
print('Pulse is Impulse or Rectangular with 2 edges')
interp = (lev50 - y[i - 1]) / (y[i] - y[i - 1])
ttrail = x[i - 1] + interp * (x[i] - x[i - 1])
width = ttrail - tlead
else:
print('Step-Like Pulse, no second edge')
ttrail = None
width = None

except IndexError as e:
print('Index error occurred:', e)
width = None

return width

if you want to use this code, please cite my source [link]

The provided Python function calculates the FWHM of a waveform represented by the input arrays ‘x’ and ‘y’. Here’s a breakdown of the code:

  • The function normalizes the input waveform ‘y’ to ensure that its maximum value is 1.
  • It then identifies the index of the maximum or minimum value of ‘y’ to determine the polarity of the pulse.
  • Using a threshold of 0.5, the function finds the indices corresponding to the half-maximum points on both sides of the pulse.
  • By interpolating between these points, it calculates the leading and trailing edges of the pulse.
  • Finally, it computes the FWHM by subtracting the trailing edge from the leading edge.

On this code, you can get some information from the code beside FWHM :

  1. Determine the polarity: polarity refers to the direction of the pulse in the waveform. A positive polarity indicates that the waveform has a peak, while a negative polarity indicates that the waveform has a trough. The code determines the polarity by comparing the first value of the normalized waveform ‘y’ with a threshold of 0.5. If the first value is less than 0.5, it assumes a positive polarity; otherwise, it assumes a negative polarity.
  2. Step-Like Pulse, no second edge: This message indicates that the waveform resembles a step function, where the signal abruptly transitions from one level to another without a distinct trailing edge. In such cases, the code cannot find a second crossing point of the threshold level (0.5) after the center index. Hence, it cannot calculate the FWHM because there is no trailing edge to measure. Step-like pulses often occur in certain types of signals, such as square waves or abrupt changes in physiological parameters. They represent instantaneous changes in the signal without any duration.
  3. Pulse is Impulse or Rectangular with 2 edges: This message suggests that the waveform exhibits characteristics of an impulse or rectangular pulse with clear leading and trailing edges. An impulse pulse is a short-duration signal with a rapid rise and fall, often resembling a spike in the waveform. It has a negligible width, and its FWHM is effectively zero. A rectangular pulse has a constant amplitude over a finite duration, with distinct leading and trailing edges. The FWHM of a rectangular pulse corresponds to the duration of the pulse at half of its maximum amplitude. By identifying two distinct edges in the waveform, the code can accurately calculate the FWHM, providing valuable information about the temporal extent of the pulse.

Conclusion

In conclusion, the accurate determination of FWHM is essential in various aspects of medical physics, including imaging resolution, signal characterization, temporal analysis, and instrument calibration. By understanding the importance of FWHM and utilizing tools like the provided Python function, medical physicists can enhance the quality and reliability of diagnostic and therapeutic procedures, ultimately improving patient care outcomes.

--

--