Image Output
Table of Contents
MHD
In GATE, MHD files are one of the main formats used to store 3D images such as dose maps or voxelized energy deposition. MHD stands for MetaImage header. It uses a small human‑readable text header file with extension .mhd and a separate binary data file usually with extension .raw or .raw.gz. The header describes how to interpret the binary values as a 3D image.
When you attach image‑producing actors, for example a dose actor or energy deposition actor, you typically choose an output filename that ends in .mhd. GATE then writes two files with the same base name. The .mhd file contains the image dimensions, voxel spacing, origin, data type, and the name of the binary data file. The binary file contains the voxel values in a fixed order, usually with x changing fastest, then y, then z.
The MHD format is convenient because many medical‑imaging and general‑purpose tools understand it. You can load MHD images directly into ITK‑based software, 3D Slicer, or your own Python scripts using SimpleITK or similar libraries. For GATE users this makes it straightforward to inspect results, overlay dose on CT, or export images to other workflows.
Image orientation and coordinate conventions are defined through the header information. The header includes the voxel spacing in each direction and the position of the image origin in the simulation coordinate system. These values are critical when you want to compare voxelized outputs from GATE with other data, such as CT images or treatment planning system dose. Inconsistent origins or spacings cause misalignments even if the numerical dose values are correct.
Always check in the .mhd header:
- The image size in voxels.
- The voxel spacing in millimeters.
- The origin in simulation coordinates.
Incorrect values lead to misaligned or distorted images in downstream analysis.
Because MHD separates header and data, it is easy to edit metadata without touching the binary content. For example, you can correct the origin or change the element type in the header file if needed. However, you must ensure that the header description matches the binary data exactly. Any mismatch, especially in image size or element type, will corrupt the interpretation of voxel values.
In practical GATE workflows, MHD is often the default choice for dose and other voxel images because it is simple, open, and well supported. When you set up a dose actor or a voxelized energy deposition actor, you specify the output path for the image, and GATE takes care of filling the header with the geometry and grid configuration defined in your simulation. You then use standard imaging tools to inspect or analyze the results.
NIfTI
NIfTI is another common format for 3D and 4D images, especially in neuroimaging and many medical imaging tool chains. NIfTI files generally use the extensions .nii for a single file that holds both header and image data, or .nii.gz for a compressed version. GATE can write voxel images as NIfTI if you choose that extension for the actor output.
A NIfTI file stores the voxel array, voxel spacing, image dimensions, and transformation that places the image in a world coordinate system. Unlike MHD, where the header is a simple text file, NIfTI uses a binary header that many specialized tools know how to read. This makes NIfTI attractive when you want to process GATE images in environments that already use NIfTI, such as some PET or MRI analysis pipelines.
In GATE, the grid that you define for an image‑producing actor, including the number of voxels and voxel size, is translated into the NIfTI header fields. The position and orientation of the grid in the simulation world are stored as affine transformation coefficients. When you load the NIfTI file in external software, this transformation determines where the image appears in physical space.
When working with NIfTI output:
- Ensure that voxel spacing and orientation in the NIfTI header match your simulation grid.
- Be careful when combining NIfTI files from different sources. Even if voxel arrays have the same size, their coordinate systems may differ.
NIfTI is especially useful when you want to integrate GATE dose or activity distributions with analysis tools that already expect NIfTI input. You can for example create GATE voxel dose maps in .nii.gz format and directly import them into Python libraries that work with NIfTI or into neuroimaging tools.
Because NIfTI uses a single container for data and metadata, it is easier to move and share than a pair of .mhd and .raw files. However, being binary, the header is not as easily editable by hand as an MHD header. You usually rely on dedicated software to inspect or modify the header information. For most GATE users this is acceptable because the grid definition is already controlled carefully in the simulation script, and the NIfTI header is generated automatically from that configuration.
Voxel images
Voxel images in GATE represent quantities that have been scored on a regular three‑dimensional grid. Each small volume element, or voxel, corresponds to one array element in the output image. Common voxel images include absorbed dose distributions, energy deposition maps, particle fluence maps, and sometimes activity distributions for internal dosimetry.
The grid for a voxel image is defined inside the relevant actor. You choose the number of voxels along each axis and the physical size of each voxel. GATE then places this grid in the world, with a specified origin and orientation, and records the desired quantity in each voxel during the simulation. The grid definition for the actor must be consistent with your physical geometry if you want the voxel image to align with phantoms, CT‑based patient models, or detector volumes.
Most voxel images are written as MHD or NIfTI, depending on the file extension you select. In both cases, the stored voxel values reflect averages or totals over the voxel volume. For example, a dose actor typically records the total energy deposited in each voxel divided by the voxel mass, which gives absorbed dose in gray. The meaning and units of the values are defined by the actor type and configuration.
A typical voxel image can be described by the following properties.
| Property | Description |
|---|---|
| Dimensions | Number of voxels in x, y, z |
| Voxel spacing | Physical size of each voxel in mm |
| Origin | Position of a reference grid point in world coordinates |
| Orientation | Direction of the grid axes in the world frame |
| Value type | Quantity stored, for example dose or energy |
| Units | Units associated with the stored quantity |
For voxel images used in quantitative analysis:
- Confirm that the voxel grid covers exactly the region of interest.
- Verify the units of the stored quantity, for example gray for dose.
- Ensure consistent spacing, origin, and orientation when comparing different images.
Voxel images are central to many applications that use GATE. In radiation therapy and internal dosimetry, voxel dose maps are used to evaluate treatment plans, study dose distributions, and compute dose‑volume histograms. In detector development, voxel energy deposition maps can help you understand how particles interact within complex geometries. Because voxel images link Monte Carlo results to image‑based analysis tools, careful control of grid definition and image format is essential for reliable interpretation.
Views: 11
KAHIBARO