nibabel.ecat

Read ECAT format images

An ECAT format image consists of:

  • a main header;

  • at least one matrix list (mlist);

ECAT thinks of memory locations in terms of blocks. One block is 512 bytes. Thus block 1 starts at 0 bytes, block 2 at 512 bytes, and so on.

The matrix list is an array with one row per frame in the data.

Columns in the matrix list are:

  • 0: Matrix identifier (frame number)

  • 1: matrix data start block number (subheader followed by image data)

  • 2: Last block number of matrix (image) data

  • 3: Matrix status

    • 1: hxists - rw

    • 2: exists - ro

    • 3: matrix deleted

There is one sub-header for each image frame (or matrix in the terminology above). A sub-header can also be called an image header. The sub-header is one block (512 bytes), and the frame (image) data follows.

There is very little documentation of the ECAT format, and many of the comments in this code come from a combination of trial and error and wild speculation.

XMedcon can read and write ECAT 6 format, and read ECAT 7 format: see http://xmedcon.sourceforge.net and the ECAT files in the source of XMedCon, currently libs/tpc/*ecat* and source/m-ecat*. Unfortunately XMedCon is GPL and some of the header files are adapted from CTI files (called CTI code below). It’s not clear what the licenses are for these files.

Functions

get_frame_order(mlist)

Returns the order of the frames stored in the file Sometimes Frames are not stored in the file in chronological order, this can be used to extract frames in correct order

get_series_framenumbers(mlist)

Returns framenumber of data as it was collected, as part of a series; not just the order of how it was stored in this or across other files

load(filespec)

Class method to create image from filename filename

read_mlist(fileobj, endianness)

read (nframes, 4) matrix list array from fileobj

read_subheaders(fileobj, mlist, endianness)

Retrieve all subheaders and return list of subheader recarrays

Classes

EcatHeader([binaryblock, endianness, check])

Class for basic Ecat PET header

EcatImage(dataobj, affine, header, ...[, ...])

Class returns a list of Ecat images, with one image(hdr/data) per frame

EcatImageArrayProxy(subheader)

Ecat implemention of array proxy protocol

EcatSubHeader(hdr, mlist, fileobj)

parses the subheaders in the ecat (.v) file there is one subheader for each frame in the ecat file