Hexagon acquires Waygate Technologies from Baker Hughes for $1.45 billion
Back to Tutorials
techTutorialbeginner

Hexagon acquires Waygate Technologies from Baker Hughes for $1.45 billion

April 14, 20267 views5 min read

Learn how to work with computed tomography (CT) data using Python. This tutorial teaches you to load, visualize, filter, and analyze CT scan data using popular data science libraries.

Introduction

In this tutorial, you'll learn how to work with computed tomography (CT) data using Python and popular data science libraries. This tutorial is inspired by the recent acquisition of Waygate Technologies by Hexagon, which specializes in CT, radiography, and remote visual inspection technologies. You'll explore how to load, visualize, and analyze CT scan data - a key technology mentioned in the acquisition.

CT scanning technology is used across many industries for non-destructive testing, quality control, and medical imaging. By the end of this tutorial, you'll understand how to work with 3D volumetric data, visualize cross-sections, and extract meaningful information from CT datasets.

Prerequisites

Before starting this tutorial, you'll need:

  • A computer with Python installed (Python 3.7 or higher recommended)
  • Basic understanding of Python programming concepts
  • Internet connection to download required packages

Recommended Python packages:

  • numpy
  • matplotlib
  • scipy
  • SimpleITK (for medical image processing)

You can install these packages using pip:

pip install numpy matplotlib scipy SimpleITK

Step-by-Step Instructions

Step 1: Import Required Libraries

First, we need to import the necessary Python libraries for working with CT data. These libraries will help us handle 3D volumetric data, perform mathematical operations, and create visualizations.

import numpy as np
import matplotlib.pyplot as plt
import SimpleITK as sitk
from scipy import ndimage
import os

Why this step? These libraries form the foundation for our CT data processing work. NumPy provides numerical operations, matplotlib handles visualization, and SimpleITK gives us tools for medical image processing.

Step 2: Create Sample CT Data

Since we don't have access to real CT data in this tutorial, we'll create synthetic 3D data that mimics CT scan characteristics. This will help us understand the concepts without needing actual hardware.

# Create a 3D array representing CT data
# Shape: 100x100x100 voxels
ct_data = np.random.randint(0, 255, (100, 100, 100), dtype=np.uint8)

# Add some structured features to simulate real CT data
# Create a sphere in the center
z, y, x = np.ogrid[:100, :100, :100]
mask = (x - 50)**2 + (y - 50)**2 + (z - 50)**2 < 20**2
ct_data[mask] = 200  # Set sphere to high intensity

# Add a cylindrical feature
cylinder_mask = (x - 50)**2 + (y - 50)**2 < 15**2
ct_data[cylinder_mask] = 150

print(f"CT data shape: {ct_data.shape}")
print(f"Data type: {ct_data.dtype}")
print(f"Intensity range: {ct_data.min()} - {ct_data.max()}")

Why this step? Creating synthetic data allows us to practice CT analysis techniques without needing real hardware. The sphere and cylinder represent common features found in CT scans of objects.

Step 3: Visualize Cross-Sections

CT data is 3D volumetric data, but we often examine it by looking at 2D cross-sections. Let's visualize several cross-sections to understand the internal structure.

# Create a figure with multiple subplots
fig, axes = plt.subplots(2, 3, figsize=(12, 8))
fig.suptitle('CT Data Cross-Sections', fontsize=16)

# Show different cross-sections
axes[0,0].imshow(ct_data[50,:,:], cmap='gray')
axes[0,0].set_title('Axial View (Z=50)')
axes[0,0].axis('off')

axes[0,1].imshow(ct_data[:,50,:], cmap='gray')
axes[0,1].set_title('Sagittal View (Y=50)')
axes[0,1].axis('off')

axes[0,2].imshow(ct_data[:,:,50], cmap='gray')
axes[0,2].set_title('Coronal View (X=50)')
axes[0,2].axis('off')

# Show different slices
axes[1,0].imshow(ct_data[20,:,:], cmap='gray')
axes[1,0].set_title('Slice 20')
axes[1,0].axis('off')

axes[1,1].imshow(ct_data[80,:,:], cmap='gray')
axes[1,1].set_title('Slice 80')
axes[1,1].axis('off')

axes[1,2].imshow(ct_data[40,:,:], cmap='gray')
axes[1,2].set_title('Slice 40')
axes[1,2].axis('off')

plt.tight_layout()
plt.show()

Why this step? CT scans are typically viewed as cross-sectional images. This visualization helps understand how different views reveal different aspects of the internal structure.

Step 4: Apply Filtering to Enhance Data

Real CT data often contains noise that can obscure important features. We'll apply some basic filtering to improve our data quality.

# Apply Gaussian filtering to reduce noise
filtered_data = ndimage.gaussian_filter(ct_data, sigma=1.0)

# Create comparison plot
fig, axes = plt.subplots(1, 2, figsize=(10, 5))

axes[0].imshow(ct_data[50,:,:], cmap='gray')
axes[0].set_title('Original Data')
axes[0].axis('off')

axes[1].imshow(filtered_data[50,:,:], cmap='gray')
axes[1].set_title('Filtered Data')
axes[1].axis('off')

plt.tight_layout()
plt.show()

Why this step? Filtering is a crucial preprocessing step in CT data analysis. It helps reduce noise while preserving important structural features, making the data more suitable for further analysis.

Step 5: Extract and Analyze Features

Now let's extract some basic measurements from our CT data. We'll calculate the volume of the high-intensity regions we created.

# Create a binary mask for high-intensity regions
threshold = 180
binary_mask = ct_data > threshold

# Calculate volume (assuming each voxel is 1mm³)
volume = np.sum(binary_mask)
print(f"Volume of high-intensity regions: {volume} voxels")

# Calculate surface area using marching cubes
from skimage import measure

# Generate surface mesh
verts, faces, normals, values = measure.marching_cubes(binary_mask, level=0.5)

# Calculate surface area
surface_area = measure.mesh_surface_area(verts, faces)
print(f"Surface area: {surface_area:.2f} square voxels")

# Visualize the 3D surface
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
ax.plot_trisurf(verts[:, 0], verts[:, 1], verts[:, 2],
                triangles=faces, alpha=0.7, color='red')
ax.set_title('3D Surface Reconstruction')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.show()

Why this step? Feature extraction is fundamental in CT analysis. Understanding how to measure volumes and surface areas helps in quality control, defect detection, and structural analysis - all key applications of CT technology.

Step 6: Save Processed Data

Finally, let's save our processed CT data for future use or sharing with others.

# Save the processed data as a NumPy array
np.save('processed_ct_data.npy', filtered_data)

# Save a sample cross-section as an image
plt.imsave('ct_sample_slice.png', filtered_data[50,:,:], cmap='gray')

print("Data saved successfully!")
print("- Processed data saved as 'processed_ct_data.npy'")
print("- Sample slice saved as 'ct_sample_slice.png'")

Why this step? Saving processed data is important for reproducibility and future analysis. In real applications, CT data is often stored in specialized formats for sharing with other researchers or for use in downstream applications.

Summary

In this tutorial, you've learned how to work with computed tomography data using Python. You've explored:

  • Creating synthetic CT data that mimics real-world scans
  • Visualizing 3D data through 2D cross-sectional views
  • Applying filtering techniques to reduce noise in CT data
  • Extracting quantitative measurements from CT scans
  • Storing processed CT data for future use

This hands-on approach demonstrates the core concepts behind CT technology that was acquired by Hexagon through Waygate Technologies. While this tutorial uses synthetic data, the same principles apply to real CT scans from industrial and medical applications. Understanding these techniques is crucial for quality control, non-destructive testing, and structural analysis in manufacturing and other industries.

Source: TNW Neural

Related Articles