Nifti header and image resolutions

Hello,
This may be a question more specific to the Nifti format than VTK. However, I’m using vtk’s Nifti reader that works great.

We have several volumes of brain image data that are acquired at various resolutions. For example, 10, 50 and 100 um resolutions.

When loading these different files, is there a way to read from the Nifti header what resolution the volume is acquired at? I only see one member, unit, that could be used for this, but in all our files it is just set to mm.

Currently the resolution is encoded in the filename.

You can use the data spacing:

>>> reader.GetDataSpacing()
(0.05, 0.05, 0.1)

Or you can use the pixdim from the NIFTI header:

>>> reader.GetNIFTIHeader().GetPixDim(1)
0.05

If these don’t match the resolutions from your filenames, it might mean that the person who created the NIFTI file didn’t write the resolution into the header.