|
TPCCLIB
|
Reading and writing ECAT 7.x matrix list. More...
#include "libtpcimgio.h"Go to the source code of this file.
Functions | |
| void | ecat7InitMatlist (ECAT7_MATRIXLIST *mlist) |
| void | ecat7EmptyMatlist (ECAT7_MATRIXLIST *mlist) |
| int | ecat7ReadMatlist (FILE *fp, ECAT7_MATRIXLIST *ml, int verbose) |
| void | ecat7PrintMatlist (ECAT7_MATRIXLIST *ml) |
| int | ecat7EnterMatrix (FILE *fp, int matrix_id, int block_nr) |
| int | ecat7_val_to_id (int frame, int plane, int gate, int data, int bed) |
| void | ecat7_id_to_val (int matrix_id, ECAT7_Matval *matval) |
| void | ecat7SortMatlistByPlane (ECAT7_MATRIXLIST *ml) |
| void | ecat7SortMatlistByFrame (ECAT7_MATRIXLIST *ml) |
| int | ecat7CheckMatlist (ECAT7_MATRIXLIST *ml) |
| int | ecat7DeleteLateFrames (ECAT7_MATRIXLIST *ml, int frame_nr) |
| int | ecat7GetPlaneAndFrameNr (ECAT7_MATRIXLIST *mlist, ECAT7_mainheader *h, int *plane_nr, int *frame_nr) |
| int | ecat7GetMatrixBlockSize (ECAT7_MATRIXLIST *mlist, int *blk_nr) |
| int | ecat7GetNums (ECAT7_MATRIXLIST *ml, ECAT7_mainheader *mh, FILE *fp, short int *num_planes, short int *num_frames, short int *num_gates, short int *num_bed_pos) |
| int | ecat7GatherMatlist (ECAT7_MATRIXLIST *ml, short int do_planes, short int do_frames, short int do_gates, short int do_beds) |
Reading and writing ECAT 7.x matrix list.
Definition in file ecat7ml.c.
| void ecat7_id_to_val | ( | int | matrix_id, |
| ECAT7_Matval * | matval ) |
Conversion of matrix identifier to numerical values
| matrix_id | matrix identifier coding |
| matval | matrix values structure |
Definition at line 262 of file ecat7ml.c.
Referenced by ecat7DeleteLateFrames(), ecat7GatherMatlist(), ecat7GetNums(), ecat7GetPlaneAndFrameNr(), ecat7PrintMatlist(), ecat7PrintSubheader(), ecat7ReadHeaders(), ecat7SortMatlistByFrame(), ecat7SortMatlistByPlane(), ecat7WriteHeaders(), imgReadEcat7(), and imgReadEcat7Frame().
| int ecat7_val_to_id | ( | int | frame, |
| int | plane, | ||
| int | gate, | ||
| int | data, | ||
| int | bed ) |
Returns the matrix identifier.
| frame | frame number [0..65536] |
| plane | plane number [0..65536] |
| gate | gate number [0..64] |
| data | data [0..1] |
| bed | bed position [0..16] |
Definition at line 245 of file ecat7ml.c.
Referenced by ecat7GatherMatlist(), imgWrite2DEcat7(), imgWriteEcat7(), imgWriteEcat7Frame(), and imgWritePolarmap().
| int ecat7CheckMatlist | ( | ECAT7_MATRIXLIST * | ml | ) |
Checks that all matrixlist entries have read/write status.
| ml | checked matrix list |
Definition at line 329 of file ecat7ml.c.
Referenced by ecat7ReadHeaders(), ecat7WriteHeaders(), ecatFixMatrixlist(), imgReadEcat7(), imgReadEcat7Frame(), and imgReadEcat7Header().
| int ecat7DeleteLateFrames | ( | ECAT7_MATRIXLIST * | ml, |
| int | frame_nr ) |
Mark deleted the frames after the specified frame number.
| ml | target matrix list |
| frame_nr | first index to be marked as deleted [1..number of frames] |
Definition at line 346 of file ecat7ml.c.
| void ecat7EmptyMatlist | ( | ECAT7_MATRIXLIST * | mlist | ) |
Free memory allocated for ECAT matrix list.
| mlist | target matrix list that has allocated memory |
Definition at line 26 of file ecat7ml.c.
Referenced by ecat7PrintSubheader(), ecat7ReadHeaders(), ecat7ReadMatlist(), ecat7WriteHeaders(), imgReadEcat7(), imgReadEcat7Frame(), and imgReadEcat7Header().
| int ecat7EnterMatrix | ( | FILE * | fp, |
| int | matrix_id, | ||
| int | block_nr ) |
Prepare matrix list for additional matrix data and return block number for matrix header. Directory records are written in big endian byte order. Set block_nr to the number of data blocks + (nr of header blocks - 1)
| fp | file pointer |
| matrix_id | matrix identifier coding |
| block_nr | matrix number [1..number of matrixes] |
Definition at line 147 of file ecat7ml.c.
Referenced by ecat7CopyFile(), ecat7Write2DScanMatrix(), ecat7WriteImageMatrix(), ecat7WritePolarmapMatrix(), and ecat7WriteScanMatrix().
| int ecat7GatherMatlist | ( | ECAT7_MATRIXLIST * | ml, |
| short int | do_planes, | ||
| short int | do_frames, | ||
| short int | do_gates, | ||
| short int | do_beds ) |
Matrix numbers in ECAT 7 matrix list are edited, when necessary, so that plane, frame, gate and/or bed numbers are continuous, starting from one (planes, frames and gates) or from zero (beds). List order is not changed.
| ml | ECAT 7 matrix list, where the matrix numbers will be edited |
| do_planes | Plane numbers are gathered together (1) or not (0) |
| do_frames | Frame numbers are gathered together (1) or not (0) |
| do_gates | Gate numbers are gathered together (1) or not (0) |
| do_beds | Bed numbers are gathered together (1) or not (0) |
Definition at line 535 of file ecat7ml.c.
Referenced by ecatFixMatrixlist(), imgReadEcat7Frame(), and imgReadEcat7Header().
| int ecat7GetMatrixBlockSize | ( | ECAT7_MATRIXLIST * | mlist, |
| int * | blk_nr ) |
Calculate the size of one data matrix in ECAT7 file matrix list, and check that the size is same in all matrices.
| mlist | Ecat7 matrix list; note that this list is here sorted by planes |
| blk_nr | number of blocks will be put here; NULL if not needed |
Definition at line 418 of file ecat7ml.c.
Referenced by imgReadEcat7Header().
| int ecat7GetNums | ( | ECAT7_MATRIXLIST * | ml, |
| ECAT7_mainheader * | mh, | ||
| FILE * | fp, | ||
| short int * | num_planes, | ||
| short int * | num_frames, | ||
| short int * | num_gates, | ||
| short int * | num_bed_pos ) |
Read the maximum plane, frame, gate and bed number from matrixlist. In case of 3D formats, num_planes is checked from the first subheader.
| ml | Pointer to matrixlist |
| mh | Pointer to mainheader |
| fp | File pointer to ECAT7 file opened in binary mode |
| num_planes | num_planes will be put here; NULL if not needed to be read |
| num_frames | num_planes will be put here; NULL if not needed to be read |
| num_gates | num_planes will be put here; NULL if not needed to be read |
| num_bed_pos | num_planes will be put here; NULL if not needed to be read |
Definition at line 452 of file ecat7ml.c.
Referenced by ecatFixMatrixlist().
| int ecat7GetPlaneAndFrameNr | ( | ECAT7_MATRIXLIST * | mlist, |
| ECAT7_mainheader * | h, | ||
| int * | plane_nr, | ||
| int * | frame_nr ) |
Calculate the number of planes and frames/gates from ECAT7 matrix list. Check that all planes have equal nr of frames/gates, that frames/gates are sequentally numbered.
| mlist | Ecat7 matrix list; note that this list is here sorted by planes |
| h | Ecat7 main header structure |
| plane_nr | Number of planes will be put here; NULL if not needed [1..number of planes, or NULL] |
| frame_nr | Number of frames/gates will be put here; NULL if not needed [1..number of frames, or NULL] |
Definition at line 372 of file ecat7ml.c.
Referenced by imgReadEcat7Header().
| void ecat7InitMatlist | ( | ECAT7_MATRIXLIST * | mlist | ) |
Initiate ECAT matrix list. Call this once before first use.
| mlist | target matrix list |
Definition at line 15 of file ecat7ml.c.
Referenced by ecat7PrintSubheader(), ecat7ReadHeaders(), ecat7WriteHeaders(), ecatFixMatrixlist(), imgReadEcat7(), imgReadEcat7Frame(), and imgReadEcat7Header().
| void ecat7PrintMatlist | ( | ECAT7_MATRIXLIST * | ml | ) |
Print ECAT matrix list on stdout.
| ml | matrix list for Ecat7 file |
Definition at line 112 of file ecat7ml.c.
Referenced by ecat7PrintSubheader(), ecatFixMatrixlist(), and imgReadEcat7().
| int ecat7ReadMatlist | ( | FILE * | fp, |
| ECAT7_MATRIXLIST * | ml, | ||
| int | verbose ) |
Read ECAT matrix list.
Matrix list must be initiated (once) before calling this.
| fp | File pointer. |
| ml | Pointer to initiated matrix list. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 41 of file ecat7ml.c.
Referenced by ecat7PrintSubheader(), ecat7ReadHeaders(), ecat7WriteHeaders(), ecatFixMatrixlist(), imgReadEcat7(), imgReadEcat7Frame(), and imgReadEcat7Header().
| void ecat7SortMatlistByFrame | ( | ECAT7_MATRIXLIST * | ml | ) |
Sort matrixlist by frame and plane. Bubble sorting algorithm.
| ml | target matrix list |
Definition at line 303 of file ecat7ml.c.
Referenced by imgReadEcat7Frame().
| void ecat7SortMatlistByPlane | ( | ECAT7_MATRIXLIST * | ml | ) |
Sort matrixlist by plane and frame. Bubble sorting algorithm.
| ml | target matrix list |
Definition at line 277 of file ecat7ml.c.
Referenced by ecat7GetPlaneAndFrameNr(), and imgReadEcat7().