29#ifndef __stir_IO_ecat6_utils_h
30#define __stir_IO_ecat6_utils_h
45long cti_numcod(
int frame,
int plane,
int gate,
int data,
int bed);
72FILE*
cti_create(
const char* fname,
const ECAT6_Main_header* mhead);
82int cti_rblk(FILE* fptr,
int blkno,
void* bufr,
int nblks);
91int cti_wblk(FILE* fptr,
int blkno,
void* bufr,
int nblks);
154int cti_enter(FILE* fptr,
const ECAT6_Main_header* mhead_ptr,
long matnum,
int nblks);
165int cti_lookup(FILE* fptr,
const ECAT6_Main_header* mhead_ptr,
long matnum, MatDir* entry);
221 const ECAT6_Main_header* mhead_ptr,
222 const Image_subheader* header_ptr,
243 const ECAT6_Main_header* mhead_ptr,
244 const Scan_subheader* header_ptr,
305#ifdef STIR_ORIGINAL_ECAT6
316void ffind_minmax(
float* buf,
float* min,
float* max,
int bufsize);
325void sfind_minmax(
short* buf,
short* min,
short* max,
int bufsize);
333void swab(
char* from,
char* to,
int length);
341void swaw(
short* from,
short* to,
int length);
349float get_vax_float(
const unsigned short* bufr,
int off);
357long get_vax_long(
const unsigned short* bufr,
int off);
364void dump_ECAT6_Main_header(FILE* fptr,
const ECAT6_Main_header* mhead);
373void hostltovaxl(
const long in,
unsigned short out[2]);
381void hostftovaxf(
const float in,
unsigned short out[2]);
384ECAT6_Main_header main_zero_fill();
ECAT 6 CTI matrix parameters.
int 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...
Definition ecat6_utils.cxx:329
int 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...
Definition ecat6_utils.cxx:290
int get_scandata(FILE *fptr, char *scan, ScanInfoRec *scanParams)
Read scan data from file. Returns EXIT_FAILURE if the data could not be read.
Definition ecat6_utils.cxx:148
int 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.
Definition ecat6_utils.cxx:223
int 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.
Definition ecat6_utils.cxx:363
int 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 er...
Definition ecat6_utils.cxx:349
int cti_write_idata(FILE *fptr, int blk, const short *data, int isize)
Write data in blocks from buffer into file.
Definition ecat6_utils.cxx:404
int 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.
Definition ecat6_utils.cxx:163
int 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 er...
Definition ecat6_utils.cxx:342
void cti_numdoc(long matnum, Matval *matval)
Unpack encoded data into a nice struct. Reverse of cti_numcod ().
Definition ecat6_utils.cxx:303
FILE * 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.
Definition ecat6_utils.cxx:284
int 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.
Definition ecat6_utils.cxx:472
int cti_write_ECAT6_Main_header(FILE *fptr, const ECAT6_Main_header *header_ptr)
Write an image main header into a matrix file. Returns 0 if successful.
int 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.
Definition ecat6_utils.cxx:309
int 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....
Definition ecat6_utils.cxx:323
int cti_wblk(FILE *fptr, int blkno, void *bufr, int nblks)
Write blocks from buffer into file. Returns EXIT_SUCCESS if successful.
Definition ecat6_utils.cxx:316
int cti_rings2plane(short nrings, short ring0, short ring1)
Get sinogram plane from ring pair.
Definition ecat6_utils.cxx:392
int 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.
Definition ecat6_utils.cxx:88
int 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.
Definition ecat6_utils.cxx:452
long cti_numcod(int frame, int plane, int gate, int data, int bed)
Encode scan information into a single, incomprehensible number.
Definition ecat6_utils.cxx:297
int 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.
Definition ecat6_utils.cxx:371
int 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 er...
Definition ecat6_utils.cxx:356
int 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 ...
Definition ecat6_utils.cxx:335
Image_subheader img_zero_fill()
Fill image subheader with negative or default values.
Definition ecat6_utils.cxx:553
int file_data_to_host(char *dptr, int nblks, int dtype)
Convert data in buffer dptr to native host format.
Definition ecat6_utils.cxx:379
Scan_subheader scan_zero_fill()
Fill scan subheader with negative or default values.
Definition ecat6_utils.cxx:506
ECAT 6 CTI scanner parameters.
Definition ecat6_types.h:82