STIR  6.2.0
Typedefs | Functions

A (slightly dangerous) utility to perform so-called corner-swapping for ECAT6 projection data. More...

#include "stir/ProjDataInterfile.h"
#include "stir/utilities.h"
#include "stir/SegmentBySinogram.h"
#include "stir/Succeeded.h"
#include "stir/error.h"
#include <iostream>
#include <algorithm>

Typedefs

typedef unsigned char byte
 

Functions

int main (int argc, char **argv)
 

Detailed Description

A (slightly dangerous) utility to perform so-called corner-swapping for ECAT6 projection data.

Author
Christian Michel
CTI PET Inc
Kris Thielemans
Usage
ecat_swap_corners out_name in_name
What does it do?

For some historical reason, CTI scanners store 3D sinograms sometimes in a 'corner-swapped' mode. What happens is that some corners of the positive and negative segments are interchanged. (As a consequence, segment 0 is never affected).

Below is a summary of what Kris Thielemans understood about corner-swapping from various emails with CTI people. However, he might have totally misunderstood this, so beware!

Corner-swapped mode occurs ALWAYS for ECAT6 data straight from the scanner. However, data which have been normalised using the import_3dscan utility from CTI are already corner-swapped correctly. Unfortunately, there is no field in the ECAT6 header that allows you to find out which mode it is in.

For ECAT7 data, the situation is even more confusing. Data acquired directly in projection data have to be corner-swapped when the acquisition was in 'volume-mode' (i.e. stored by sinograms), but NOT when acquired in 'view-mode' (i.e. stored by view). It seems that bkproj_3D_sun follows this convention by assuming that any ECAT7 projection data stored in 'volume-mode' has to be corner swapped, and when it writes projection data in 'view-mode', it does the corner swapping for you. So, although there is strictly speaking no field in the ECAT7 header concerning corner swapping, it seems that the storage mode field determines the corner swapping as well.
When the data is acquired in listmode, this changes somewhat. Apparently, there is a parameter in the set-up of listmode scans that allows you to put the ACS in 'volume-mode' or 'view-mode'. The resulting listmode files encode the sinogram coordinates then with corner-swapping or without. After the acquisition, the listmode data has then to be binned into projection data. It is then up to the binning program to take this corner-swapping into account. This is easiest to do by generating 'volume-mode' projection data when a 'volume-mode' when the listmode setup was in 'volume-mode', and similar for 'view-mode'.
If this sounds confusing to you, KT would agree. Here seems to be the best thing to do:

Do all acquisitions in 'view-mode', set-up your listmode scan in 'view-mode', bin the data in 'view-mode'. Forget about corner-swapping.

If you cannot do this, then this utility will corner-swap the projection data for you.

Who implemented this and how was it tested?

The actual corner swapping code was supplied by Christian Michel, based on code by Larry Byars.
KT has tested it by performing a very long cylinder scan in 'volume-mode' on the ECAT 966, and looking at the delayeds. The oblique segments had obvious discontinuities in the efficiency patterns. After applyying this utility, these discontinuities appeared.

Warning
This utility does not (and cannot) check for you if the data has to be corner-swapped or not. So, it can do the wrong thing.