STIR  6.2.0
Namespaces | Macros | Functions

Implementation of ECAT 6 CTI functions to access data. More...

#include "stir/IO/stir_ecat_common.h"
#include "stir/IO/ecat6_utils.h"
#include "stir/ByteOrder.h"
#include "stir/ByteOrderDefine.h"
#include "stir/warning.h"
#include "boost/static_assert.hpp"
#include "boost/cstdint.hpp"
#include <algorithm>
#include <limits.h>
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

Namespaces

 stir
 Namespace for the STIR library (and some/most of its applications)
 
 stir::ecat
 Namespace for the ECAT IO part of the STIR library (and some/most of its applications)
 
 stir::ecat::ecat6
 Namespace for the ECAT6 IO part of the STIR library (and some/most of its applications)
 

Macros

#define bcopy(src, dest, length)   memcpy(dest, src, length)
 
#define toblocks(x)   ((x + (MatBLKSIZE - 1)) / MatBLKSIZE)
 

Functions

int file_data_to_host (char *dptr, int nblks, int dtype)
 Convert data in buffer dptr to native host format.
 
FILE * mat_create (char *fname, Main_header *mhead)
 
 BOOST_STATIC_ASSERT (sizeof(unsigned short)==2)
 
int stir::ecat::ecat6::get_scanheaders (FILE *fptr, long matnum, ECAT6_Main_header *mhead, Scan_subheader *shead, ScanInfoRec *scanParams)
 Read main header and subheader from scan file. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::get_scandata (FILE *fptr, char *scan, ScanInfoRec *scanParams)
 Read scan data from file. Returns EXIT_FAILURE if the data could not be read. More...
 
int stir::ecat::ecat6::get_attnheaders (FILE *fptr, long matnum, ECAT6_Main_header *mhead, Attn_subheader *shead, ScanInfoRec *attnParams)
 Read main header and subheader from attn file. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::get_normheaders (FILE *fptr, long matnum, ECAT6_Main_header *mhead, Norm_subheader *shead, ScanInfoRec *nrmParams)
 Read main header and subheader from normalisation file. Returns EXIT_SUCCESS if no error. More...
 
FILE * stir::ecat::ecat6::cti_create (const char *fname, const ECAT6_Main_header *mhead)
 Open a file and write main header to it. Returns a pointer to the file, or 0 if unsuccessful. More...
 
int stir::ecat::ecat6::cti_read_ECAT6_Main_header (FILE *fptr, ECAT6_Main_header *h)
 Read header data from a file and place it into a ECAT6_Main_header struct. Returns EXIT_SUCCESS if no error. More...
 
long stir::ecat::ecat6::cti_numcod (int frame, int plane, int gate, int data, int bed)
 Encode scan information into a single, incomprehensible number.
 
void stir::ecat::ecat6::cti_numdoc (long matnum, Matval *matval)
 Unpack encoded data into a nice struct. Reverse of cti_numcod (). More...
 
int stir::ecat::ecat6::cti_rblk (FILE *fptr, int blkno, void *bufr, int nblks)
 Read from a matrix file starting at the given block. Returns EXIT_SUCCESS if all went well. More...
 
int stir::ecat::ecat6::cti_wblk (FILE *fptr, int blkno, void *bufr, int nblks)
 Write blocks from buffer into file. Returns EXIT_SUCCESS if successful. More...
 
int stir::ecat::ecat6::cti_enter (FILE *fptr, const ECAT6_Main_header *mhead_ptr, long matnum, int nblks)
 Create entry in file corresponding to matnum, and return offset of next block. Or some such. Returns 0 if there was an error. More...
 
int stir::ecat::ecat6::cti_lookup (FILE *fptr, const ECAT6_Main_header *mhead_ptr, long matnum, MatDir *entry)
 Look up a "matrix number" in the file and return the MatDir entry for it. Returns 0 if the lookup was NOT successful. More...
 
int stir::ecat::ecat6::cti_read_image_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, Image_subheader *header_ptr)
 Read header data from a file and place it into an Image_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_read_scan_subheader (FILE *fptr, const ECAT6_Main_header *, int blknum, Scan_subheader *)
 Read header data from a file and place it into a Scan_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_read_attn_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, Attn_subheader *header_ptr)
 Read header data from a file and place it into a Attn_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_read_norm_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, Norm_subheader *header_ptr)
 Read header data from a file and place it into a Norm_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_write_image_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, const Image_subheader *header_ptr)
 Write an image subheader into a matrix file. Returns 0 if successful. More...
 
int stir::ecat::ecat6::cti_write_scan_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, const Scan_subheader *header_ptr)
 Write a scan subheader into a matrix file. More...
 
int stir::ecat::ecat6::file_data_to_host (char *dptr, int nblks, int dtype)
 Convert data in buffer dptr to native host format.
 
int stir::ecat::ecat6::cti_rings2plane (short nrings, short ring0, short ring1)
 Get sinogram plane from ring pair. More...
 
int stir::ecat::ecat6::cti_write_idata (FILE *fptr, int blk, const short *data, int isize)
 Write data in blocks from buffer into file.
 
int stir::ecat::ecat6::cti_write_image (FILE *fptr, long matnum, const ECAT6_Main_header *mhead_ptr, const Image_subheader *header_ptr, const short *data, int data_size)
 Write an image, including headers, into a matrix file.
 
int stir::ecat::ecat6::cti_write_scan (FILE *fptr, long matnum, const ECAT6_Main_header *mhead_ptr, const Scan_subheader *header_ptr, const short *data, int data_size)
 Write a scan, including headers, into a matrix file.
 
Scan_subheader stir::ecat::ecat6::scan_zero_fill ()
 Fill scan subheader with negative or default values.
 
Image_subheader stir::ecat::ecat6::img_zero_fill ()
 Fill image subheader with negative or default values.
 

Detailed Description

Implementation of ECAT 6 CTI functions to access data.

Author
Kris Thielemans (conversions from/to VAX floats, longs)
PARAPET project
Warning
This file relies on ByteOrderDefine.h to find out if it has to byteswap. This ideally would be changed to use the class stir::ByteOrder. Make sure you run test/test_ByteOrder.