Simulating Pencil Beam CT Scans Using Various Acquisition Strategiesο
A Tutorial on Scanning Methods, Sinogram Generation, and Visualizationο
Overviewο
This tutorial demonstrates the simulation of 2D pencil beam computed tomography (CT) scans using different acquisition strategies. Pencil beam CT employs a narrow beam that scans the sample point by point, requiring precise coordination between rotation, translation, and beam exposure. Understanding these scanning methods is essential for optimizing data acquisition, improving reconstruction algorithms, and evaluating scan efficiency.
Objectivesο
By the end of this tutorial, you will:
Understand different scanning strategies used in pencil beam CT.
Visualize sample movement and sinogram generation for various acquisition methods.
Compare stepped and continuous scanning approaches to observe their impact on data collection.
Explore fast-axis vs. slow-axis configurations to analyze scan efficiency.
Scanning Strategies Coveredο
This tutorial includes simulations of the following acquisition strategies, categorized by their motion type:
1. Stepped Scanning (Beam ON/OFF at Fixed Positions)ο
Zigzig Stepped Translation: Zigzig scan with translation as the primary movement axis, moving in discrete steps.
Zigzig Stepped Rotation: Zigzig scan with rotation as the primary movement axis, moving in discrete steps.
Zigzag Stepped Translation: Zigzag scan with translation as the primary movement axis, moving in discrete steps.
Zigzag Stepped Rotation: Zigzag scan with rotation as the primary movement axis, moving in discrete steps.
2. Fast-Axis Scanning (Continuous Motion)ο
Zigzig Fast Translation: Zigzig scan with translation as the primary movement axis, moving in continuous motion.
Zigzig Fast Rotation: Zigzig scan with rotation as the primary movement axis, moving in continuous motion.
Zigzag Fast Translation: Zigzag scan with translation as the primary movement axis, moving in continuous motion.
Zigzag Fast Rotation: Zigzag scan with rotation as the primary movement axis, moving in continuous motion.
3. Fully Continuous Scanningο
Simultaneous Continuous Rotation & Translation A fully dynamic scanning approach where rotation and translation occur simultaneously, ensuring continuous data acquisition.
How This Tutorial Worksο
Each scanning method is visualized with animations, showing how the sample moves and how the sinogram builds up.
The beam behavior (ON/OFF states in stepped scans) is highlighted to illustrate data acquisition timing.
We explore how different acquisition strategies affect the sinogram, providing insights into which methods might be more efficient for specific experimental conditions.
Why This Matters?ο
Pencil beam CT is widely used in scientific imaging, materials science, and non-destructive testing.
Optimizing scan paths can significantly reduce acquisition times while maintaining high-quality reconstructions.
Understanding sinogram formation in different scan modes helps refine reconstruction techniques and reduce artifacts.
For the interested reader the various are discussed in more detail in [1].
Referencesο
[1] βInterlaced X-ray diffraction computed tomographyβ, A. Vamvakeros, S.D.M. Jacques, M. di Michiel, P. Senecal, V. Middelkoop, R.J. Cernik, A.M. Beale, Journal of applied crystallography, 49, 2, 485-496, 2016
[14]:
import numpy as np
from IPython.display import HTML
import matplotlib as mpl
import time
mpl.rcParams["animation.embed_limit"] = 100 # Increase the limit to 50MB (adjust as needed)
from nDTomo.sim.pencilbeam import (zigzig_stepped_translation, zigzig_stepped_rotation, zigzag_stepped_translation,
zigzag_stepped_rotation, zigzig_fast_translation, zigzig_fast_rotation,
zigzag_fast_translation, zigzag_fast_rotation, continuous_rot_trans, continuous_rot_trans_optimised)
First we create a phantom object that we will use for our simulations
[15]:
# Example usage
image = np.zeros((40, 40), dtype='float32') # Create a blank image
image[10:20,10:20] = 0.9
image[23:27,23:27] = 0.3
image[21:30,10:17] = 1.5
image[20:23, 10:30] = 1 # A square in the middle
angles = np.linspace(0, 180, 5)
Zigzig Stepped Translation: Zigzig scan with translation as the primary movement axis, moving in discrete steps.
[16]:
start = time.time()
ani, ani_html = zigzig_stepped_translation(image, angles, interval=100, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Elapsed time: 26.46 seconds
[16]:
Zigzig Stepped Rotation: Zigzig scan with rotation as the primary movement axis, moving in discrete steps.
[17]:
start = time.time()
ani, ani_html = zigzig_stepped_rotation(image, angles, interval=50, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 800
Elapsed time: 23.44 seconds
[17]:
Zigzag Stepped Translation: Zigzag scan with translation as the primary movement axis, moving in discrete steps.
[18]:
start = time.time()
ani, ani_html = zigzag_stepped_translation(image, angles, interval=100, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 400
Elapsed time: 13.56 seconds
[18]:
Zigzag Stepped Rotation: Zigzag scan with rotation as the primary movement axis, moving in discrete steps.
[19]:
start = time.time()
ani, ani_html = zigzag_stepped_rotation(image, angles, interval=50, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 400
Elapsed time: 12.56 seconds
[19]:
Zigzig Fast Translation: Zigzig scan with translation as the primary movement axis, moving in continuous motion.
[20]:
start = time.time()
ani, ani_html = zigzig_fast_translation(image, angles, interval=100, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 400
Elapsed time: 13.24 seconds
[20]:
Zigzig Fast Rotation: Zigzig scan with rotation as the primary movement axis, moving in continuous motion.
[21]:
start = time.time()
ani, ani_html = zigzig_fast_rotation(image, angles, interval=50, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 400
Elapsed time: 12.62 seconds
[21]:
Zigzag Fast Translation: Zigzag scan with translation as the primary movement axis, moving in continuous motion.
[22]:
start = time.time()
ani, ani_html = zigzag_fast_translation(image, angles, interval=100, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 200
Elapsed time: 5.85 seconds
[22]:
Zigzag Fast Rotation: Zigzag scan with rotation as the primary movement axis, moving in continuous motion.
[23]:
start = time.time()
ani, ani_html = zigzag_fast_rotation(image, angles, interval=50, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 200
Elapsed time: 6.07 seconds
[23]:
Simultaneous Continuous Rotation & Translation
[24]:
start = time.time()
ani, ani_html = continuous_rot_trans(image, angles, num_trans_steps=image.shape[0], interval=50, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 200
Elapsed time: 6.24 seconds
[24]:
Simultaneous Continuous Rotation & Translation (with interpolation)
[25]:
start = time.time()
ani, ani_html = continuous_rot_trans_optimised(image, angles, num_trans_steps=image.shape[0], interval=50, cmap="jet")
print(f"Elapsed time: {time.time() - start:.2f} seconds")
HTML(ani_html)
Total frames: 200
Elapsed time: 6.53 seconds
[25]:
Summary: Understanding and Optimizing Pencil Beam CT Acquisitionο
In this tutorial, we explored a range of 2D pencil beam CT acquisition strategies using animated simulations and synthetic sinograms. These methods demonstrate how rotation, translation, and beam control interact to affect scan efficiency, data structure, and reconstruction quality.
π§ What We Covered:ο
Stepped Scans: Discrete motion with beam ON/OFF control, ideal for simple coordination but slower acquisition.
Fast-Axis Continuous Scans: One axis moves continuously while the other steps, balancing speed and precision.
Fully Continuous Scans: Both rotation and translation progress simultaneously, enabling fast acquisition but requiring interpolation-aware reconstruction.
Each method has different implications for:
Temporal resolution
Mechanical load on the stage
Sinogram continuity and reconstruction complexity
π Why This Matters:ο
Pencil beam CT is ideal for high-resolution, low-scatter imaging, but acquisition time can be a bottleneck.
Choosing the right scan strategy improves efficiency, minimizes motion artefacts, and enhances reconstruction accuracy.
These simulations can be adapted to real-world systems or used to benchmark reconstruction methods under controlled conditions.
π Next Steps:ο
Simulate 3D scans using stacked 2D planes with interleaved motion.
Test how each scan mode affects different reconstruction pipelines.
Integrate this simulation framework with hardware control code to pre-validate scan paths before real experiments.
Understanding scan geometry is as critical as understanding the reconstruction itself β and this tutorial offers the tools to do both.