Pixel Spacing for CT/MRI Image Stacks
When contributing data to MorphoSource, providing pixel spacing information is critical for maintaining discoverability, accessibility, reusability of your data. If pixel spacing is supplied incorrectly, not only will the scale and proportions of image previews created by MorphoSource be wrong, but the scale and proportions of volumetric images created by future researchers who access your data will also be wrong. This could lead to other users being unable to work with the data, or worse: it could lead to inaccurate representations of the specimen or object you have imaged in future literature, inaccurate observations or measurements reported for that specimen or object, and/or inaccurate scientific predictions or conclusions based on those observations.
- Frequently Asked Questions About Pixel Spacing
- What is volumetric pixel spacing?
- How is pixel spacing recorded in DICOM-format images?
- How are DICOMs different from other image formats (TIFFs, JPEG, etc.) when it comes to pixel spacing values?
- What is slice thickness? How is it related to Z pixel spacing?
- Why is loading a single image unreliable for determining Z pixel spacing?
- Can I provide a log file in the deposit instead of entering pixel information separately, if the log file contains pixel spacing information?
- How to Find Pixel Spacing Information for DICOM Image Stacks Using ImageJ
Frequently Asked Questions About Pixel Spacing
What is volumetric pixel spacing?
For CT or MRI modalities, a series of 2D image “slices” constitute a 3D volume. Pixel spacing values indicate the real-world size or scale of each pixel in the 3D slice stack. There are three kinds of pixel spacing: X pixel spacing, Y pixel spacing, and Z pixel spacing. Z pixel spacing is defined as the distance between adjacent slices in millimeters, measured from center to center in the Z axis. X and Y pixel spacing values define the distance from the center of one pixel to the center of an adjacent pixel in millimeters in the X and Y axes, respectively. This image indicates X and Y pixel spacing diagramatically, where column spacing corresponds to X spacing and row spacing corresponds to Y spacing.
Together, X, Y, and Z pixel spacing values help define the size of a 3D voxel, or volumetric pixel. The spacing values also indicate “resolution.” Smaller pixel spacing values indicate that more fine-grained details on the imaged object are likely to be well captured and resolved in the image stack.
How is pixel spacing recorded in DICOM-format images?
DICOM (.dicom, .dcm, other file suffixes) is one particular image file format that is commonly used for CT/MRI stacks, due to each DICOM file containing an extensive metadata header that allows for storing important CT/MRI scanning properties directly on the file. There are standard DICOM metadata files that store X, Y, and Z pixel spacing. X and Y pixel spacing are recorded in the Pixel Spacing field. Z pixel spacing can be recorded in at least two different locations. Some software records Z pixel spacing in the Spacing Between Slices field. Avizo is an example of software that will record Z pixel spacing in this field. The other way that Z pixel spacing is recorded is through the Image Position (Patient) field. Each individual DICOM-format image records the real-world 3D (X/Y/Z) position of the upper-left pixel of the image. Comparing sequential Image Position matrices for multiple adjacent 2D slices is the second method of determining Z pixel spacing, and this is in fact the most universal way that CT/MRI stacks record Z pixel spacing.
MorphoSource can automatically infer X and Y pixel spacing from a DICOM image, since Pixel Spacing is almost always present. When Spacing Between Slices is present, MorphoSource can also infer Z pixel spacing.
How are DICOMs different from other image formats (TIFFs, JPEG, etc.) when it comes to pixel spacing values?
CT/MRI image stacks in formats like TIFF, JPEG, and BMP do not have universal standardized ways to save pixel spacing information in internal metadata. These scans will always require an extrinsic source for the pixel information, such as a scanner device log file. Users should check log files to find the pixel spacing values as required.
What is slice thickness? How is it related to Z pixel spacing?
Slice thickness is a standard DICOM metadata field defined as the thickness in millimeters of each image slice comprising the 3D stack. Compare this to the Z pixel spacing AKA spacing between slices, which is the distance between adjacent slices in millimeters, measured from center to center of each slice in the Z axis. These values are independent from each other, and are not the same. Slice thickness should NOT be used instead of spacing between slices, except in rare special occasions where extra information is available to verify that the software producing the DICOMs incorrectly put slice spacing values in the slice thickness field.
Why is loading a single image unreliable for determining Z pixel spacing?
For a single DICOM-format image, ImageJ will attempt to check two different standard DICOM metadata fields to locate the “voxel depth” - one of these fields will provide the correct Z pixel spacing value, and the other will provide an incorrect value. ImageJ first checks the Spacing Between Slices DICOM field, which contains the correct Z pixel spacing value value. If Spacing Between Slices is present, then the voxel depth value will match Z pixel spacing accurately. If Spacing Between Slices is not present, ImageJ will then use the value of the field Slice Thickness as the voxel depth. This is not equivalent to Z pixel Spacing, and so this voxel depth is not an accurate indicator of Z pixel spacing.
Additionally, the best way to determine Z pixel spacing is to compare the Image Position fields of multiple sequential DICOM images, since each DICOM image records its own position along the Z axis. This requires multiple images, and so determining Z pixel spacing from a single image is not recommended.
Can I provide a log file in the deposit instead of entering pixel information separately, if the log file contains pixel spacing information?
You can provide a log file in the ZIP archive of the CT Image Series media, and in fact providing such a log file will likely help other users to be able to better interpret your data in the future. But unfortunately, MorphoSource does not currently read or parse metadata from log files included with deposits to derive critical metadata. Hopefully this will be implemented in the future, but for now, pixel spacing information must be entered manually.
How to Find Pixel Spacing Information for DICOM Image Stacks Using ImageJ
- Download and install ImageJ or Fiji (https://imagej.net/). Fiji (AKA, “Fiji Is Just ImageJ) is a version of ImageJ bundled with other supporting plugins and frameworks.
- Open ImageJ.
- Important: To find the pixel spacing for your DICOM stack, you MUST load the entire image sequence into ImageJ! If you only load one file, ImageJ will often provide an incorrect Z pixel spacing value (more details) . These instructions will demonstrate how to load the entire image sequence.
- In ImageJ, access the File menu, followed by Import, followed by Image Sequence.
- Navigate to the directory containing all your image stack files. If you are using Windows, you will select the first image in the sequence, and ImageJ will be able to automatically read the other images in that sequence. If you are using OSX, you will select the entire directory instead of a single file. Select Open.
- You should see the sequence options menu. You don’t need to change any default settings. If you try to load the image stack and get “out of memory” errors, you can select the “Use virtual stack” option. This can also load stacks faster. For getting pixel spacing, using the virtual stack is fine.
- The image sequence will appear. Go to the menu and select Image, followed by Properties.
- The Image Properties menu will appear. Your X pixel spacing and Y pixel spacing values are indicated by Pixel width and height, respectively. Your Z pixel spacing value is indicated by the Voxel depth field (value is highlighted in the screenshot below).