This is a little Python utility I wrote in order to read positron emission tomography (PET) data stored in ECAT7 format. It can be used to access ECAT7 files in a Pythonic way, print info about them and also convert them to NIfTI images for easier manipulation with neuroimaging software such as FSL.
ECAT7 files, aka Matrix files, are generated by PET cameras such as the ECAT HR+. They store various types of data related to PET acquisitions, including sinograms, reconstructed images, attenuation and normalization data. A description of the file format can be found in ECAT Software Operating Instructions Version 7.2, Appendix B. The format is quite old and I am not sure if it is still used in modern PET cameras, but I know at least two research institutions currently generating ECAT7 files so it may be convenient to have a Pythonic way of accessing them.
This version can only read files (which is what I need most) but one day I may implement writing too. Once I am satisfied I might consider merging pyecat into nibabel if that makes sense and the authors show interest.
Pyecat is released under the MIT license. Needless to say, I take no responsibility for anything that may happen by using it. It does what I needed to do when I wrote it, but it may not work for you. Use at your own risk.
Installation is trivial: gunzip pyecat-0.1.py.gz
, make pyecat.py
executable and put it in a directory included in your PYTHONPATH
and in your
shell PATH
if you like short command lines. Pyecat imports Numpy, so make
sure you have it. Matplotlib is required when using the --plot
switch.
To print info about an ECAT7 file:
pyecat.py --info <file path>
To visually inspect each frame:
pyecat.py --plot <file path>
To convert to a NIfTI file:
pyecat.py --to-nifti <file path> <output .nii.gz path>
To load a file from your own code:
import pyecat
ecatf = pyecat.ECATFile(file_path)
Just take a look at the ECATFile
class definition to see how to access
headers and data.
Last update: 2011-09-18