# ECAT format

ECAT format can contain PET raw data (sinogram, normalization and attenuation data; *.scn or *s, *.nrm, and *.atn, respectively), dynamic and parametric images (*.img, *.v or *.i) and polar maps. ECAT file contains header information and pixel data. ECAT 6.3 format is described in detail in Siemens ECAT 931 manual (Operating Instructions ECAT Scanner Software), and ECAT 7 format in ECAT Software Operating Instructions Version 7.2, Appendix B (PDF in intranet).

The first PET scanner in TPC produced data in ECAT 6.3 format. GE Advance data was converted to ECAT 6.3 format using in-house UNIX programs: database dump of image set was first extracted using program dbExtr, and then converted to ECAT file using program ge2cti. HR+ produced ECAT 7.2 format.

Currently most in-house analysis programs can read and write PET image data in ECAT formats.

## Converting image file formats

Program ImageConverter (contact Timo Laitinen) is available for converting image data between ECAT 7 and other formats. ImageConverter can optionally create SIF. In TPC, ImageConverter can be started from P:\bin\windows\ImageConverter.exe, elsewhere it can be downloaded from here.

### Command-line tools

Additionally, images and sinograms in ECAT 6.3 format can be converted to ECAT 7 format, and vice versa, using programs e63to7 and e7to63. Note that conversion may not work if the image has been saved in ECAT 7 format in Vinci.

ECAT 6.3 can be converted to previous (VAX) ECAT format and vice versa using program ctivax.

If you have several ECAT 6.3 in a Windows folder, you can save this batch script in your data folder, and then double-click the batch file; it will use program e63to7 create ECAT 7 images from all ECAT 6.3 images in that folder. Of course, e63to7.exe must be installed in your platform for this to work.

Tools for conversion between ECAT formats and NIfTI-1 and Analyze 7.5 are also available.

### Polar map

A variant of ECAT 7 polar map format will be used in Turku PET Centre for storing and modelling myocardial PET data. Polar maps will be constructed with Carimas.

Dynamic and parametric polar map can be converted to/from DFT file using programs pm2dft and dft2pm.

## ECAT 7 format

All data is saved in blocks of size 512. The first block contains the main header. The next block contains a list of matrices and the storage place of their subheader and data blocks, and the place for next list of matrices, if needed. Image dimensions are specified in the sub-headers. 3D sinogram header size is 1024 bytes (2 blocks), other header sizes are 512 bytes. Pixels are stored from left upper corner to the right and down.

In the main- and sub-headers is specified a field called data_type, which can be set to enum values ECAT7_BYTE, ECAT7_VAXI2, ECAT7_VAXI4, ECAT7_VAXR4, ECAT7_SUNI2, ECAT7_SUNI4 and ECAT7_IEEER4 (see ecat7.h in TPCCLIB).

Usually (data_type=ECAT7_SUNI2) the pixel values are scaled to 2-byte short ints, which can be returned to their quantitative real values by multiplying with scale_factor found in sub-headers; see ecat7.h. For quantitative image values, also factors like ecat_calibration_factor in main header may need to be considered.

### Processing on different platforms

The order in which the binary data bytes are stored and processed is different in different computer platforms. The byte order in SUN workstations (and the default in Java applications and in whole Internet) is big endian, while PCs (e.g. Intel and AMD processors) use little endian byte order. The byte order in VAX computers (which were used to control the first PET scanners) is little endian, except floating points, where the word order is swapped (big endian) but byte order is still the same as in PCs. The VAX long ints (4-byte) are the same as on PCs. After word swapping, the 4-byte floating points are stored on VAX, PC, and SUN in this format:

  31       23       15        7      0   Where S= sign bit; 0=+, 1=-
SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM         E= exp
M= mantissa


VAX floating point (4-byte) values have also another difference: the exponential part is 2 larger than in IEEE floating point format, i.e.

VAX:          mantissa
Real value = (-------- + 1) * 2^(exp-129)
2^23
SUN/PC:       mantissa
Real value = (-------- + 1) * 2^(exp-127)
2^23


## CTI ECAT 6.3 format

All data is saved in blocks of size 512. The first block contains the main header. The next block contains a list of matrices and the storage place of their subheader and data blocks, and the place for next list of matrices, if needed. Image dimensions are specified in the sub-headers. Pixels are stored from left upper corner to the right and down.

In the main- and sub-headers is specified a field called data_type, which can be set to enumerated values VAX_I2, VAX_I4, VAX_R4, SUN_I2, SUN_I4 and IEEE_R4 (see ecat63.h in TPCCLIB).

Usually (data_type is VAX_I2 or SUN_I2) the pixel values are scaled to 2-byte short ints, which can be returned to their quantitative real values by multiplying with scale_factor (sinograms) or quant_scale (images) found in sub-headers. For quantitative image values, also factors like ecat_calibration_fctr in image subheader and/or calibration_factor in the main header may need to be considered.

## TPCCLIB

PET program library is written to be platform independent. However, SUN workstations (Solaris) have not been available for years for testing, and therefore the programs might not work there any more.

All ECAT7 data is always saved in big endian byte order, because if data were to be written in little endian byte order (which is the case in ECAT 6.3 format), programs could not then interpret the data_type in the main header and the contents of the matrix list.

For the same reason, all ECAT 6.3 data is always saved in little endian byte order, even if data_type is SUN_I2, SUN_I4, or IEEE_R4. Library functions for reading and writing ECAT 6.3 files aim to keep the data_type as it was. If the information on data type is missing (data_type=0), data_type is set to the default, VAX_I2.

Tags: , , , ,

Updated at: 2018-07-09
Created at: 2013-11-06
Written by: Vesa Oikonen