KAHIBARO
Discord Login Register

24.2. Reading CT Images

Image dimensions

When you load a CT image for use in GATE, the first thing to understand is its dimensions. A CT volume is a 3D grid of voxels, so you can describe it with three integer numbers: the number of voxels along the x, y, and z axes. In most medical imaging libraries, this is stored as something like $(N_x, N_y, N_z)$.

You will typically obtain these values with an image library such as SimpleITK, ITK, or similar tools in Python. For example, using a generic concept, you read an image from disk and then query its size. The result tells you how many voxels the CT has in each direction. These dimensions are crucial when you convert the CT into a voxelized geometry in GATE, because the voxel indices used by GATE must be consistent with the original image grid.

You can think of CT indices as integer coordinates:
$$
i = 0, 1, \dots, N_x - 1, \quad
j = 0, 1, \dots, N_y - 1, \quad
k = 0, 1, \dots, N_z - 1
$$

Each triplet $(i, j, k)$ identifies one voxel in the image grid.

To avoid confusion, it is important to check which axis corresponds to which physical direction in the patient or phantom. Different tools may order dimensions as $(x, y, z)$, $(row, column, slice)$, or $(width, height, depth)$. When preparing a CT for GATE, you should always confirm the mapping between image indices and physical axes and keep it consistent for all subsequent steps, including material mapping and dose scoring.

Once you know the dimensions, you can compute the total number of voxels,
$$
N_{\text{vox}} = N_x \times N_y \times N_z,
$$
which is often useful to estimate memory usage and simulation complexity.

Always verify that the voxel indices and dimension ordering from your image library match the convention you intend to use in GATE. A mismatched axis order can silently rotate or flip your patient geometry.

Spacing

CT images not only have discrete voxel indices, they also have physical sizes. The spacing describes how large each voxel is in real space. It is usually given as three numbers, for example $(s_x, s_y, s_z)$, with units in millimeters.

The physical size of a voxel in each direction is then:
$$
\Delta x = s_x, \quad \Delta y = s_y, \quad \Delta z = s_z.
$$

When you know the spacing and the image dimensions, you can compute the physical extent of the image volume. For example, if the CT has $N_x$ voxels in x and spacing $s_x$, then the total size in x is:
$$
L_x = N_x \times s_x,
$$
and similarly $L_y = N_y \times s_y$ and $L_z = N_z \times s_z$.

A typical CT might have spacing like $(0.98\ \text{mm}, 0.98\ \text{mm}, 2.5\ \text{mm})$, which means voxels are almost square in the transverse plane but have larger thickness in the slice direction. This anisotropy is common and must be preserved when creating a voxelized phantom in GATE, otherwise the geometry will be distorted.

Spacing becomes particularly important when you:

  1. Define dose grids or activity maps that should match the CT grid.
  2. Compare simulation results with clinical data, where distances and volumes must be correct.
  3. Perform any quantitative analysis that depends on physical path lengths or volumes.

For volumes defined from an image, the physical volume of a single voxel is
$$
V_{\text{voxel}} = s_x \times s_y \times s_z.
$$

If you know the mass density $\rho$ assigned to a voxel, you can also estimate the mass of that voxel,
$$
m_{\text{voxel}} = \rho \times V_{\text{voxel}},
$$
which is important later for dose calculations.

Always keep spacing in consistent units, typically millimeters, and confirm it matches the units you use in GATE. Incorrect or missing spacing leads directly to incorrect physical dimensions and wrong dose or attenuation calculations.

Origin

The origin specifies where the CT image grid is located in physical space. While dimensions and spacing tell you the size and resolution of the volume, the origin tells you where the voxel with index $(0, 0, 0)$ lies in a real-world coordinate system, for example in patient coordinates or in the GATE world coordinates.

In most image libraries, the origin is given as a 3D vector, for example
$$
\mathbf{O} = (O_x, O_y, O_z),
$$
with each component in millimeters. This means the center of voxel $(0, 0, 0)$ is located at that physical position, after any image orientation is taken into account.

If you know the origin, spacing, and voxel indices, you can compute the physical center of any voxel. Ignoring orientation for simplicity, the position of voxel $(i, j, k)$ is often described as
$$
x = O_x + i \cdot s_x, \quad
y = O_y + j \cdot s_y, \quad
z = O_z + k \cdot s_z.
$$

In practice, real images can also have an orientation matrix, so the full mapping from index space to physical space is:
$$
\mathbf{r} = \mathbf{O} + \mathbf{M}
\begin{pmatrix}
i \cdot s_x \\
j \cdot s_y \\
k \cdot s_z
\end{pmatrix},
$$
where $\mathbf{M}$ encodes the image orientation. The detailed handling of orientation and coordinate systems is discussed elsewhere, but the key concept here is that origin is the anchor point for the entire CT in physical space.

When you bring a CT into a GATE simulation, you must choose how to align the image with your world volume and other components, such as a treatment beam or detector geometry. You can either:

  1. Use the CT origin directly, placing the CT exactly as it is defined in the image file, or
  2. Shift or re-center the CT so that, for example, its center is at the GATE world origin.

In both cases, understanding the numerical values of the origin is necessary to ensure that the patient or phantom is correctly positioned relative to beams, sources, and detectors.

A common strategy is to compute the physical center of the CT volume and then shift it so this center coincides with the GATE world origin. If the minimum coordinates of the volume are $(x_{\text{min}}, y_{\text{min}}, z_{\text{min}})$ and the maximum coordinates are $(x_{\text{max}}, y_{\text{max}}, z_{\text{max}})$, then the center is:
$$
x_{\text{center}} = \frac{x_{\text{min}} + x_{\text{max}}}{2},
$$
with similar expressions for $y_{\text{center}}$ and $z_{\text{center}}$.

Do not ignore the image origin. If you assume the CT is centered at $(0, 0, 0)$ but the stored origin places it elsewhere, your patient geometry will be shifted relative to beams and detectors, which leads to incorrect simulation results.

Views: 10

Comments

Please login to add a comment.

Don't have an account? Register now!