|
TPCCLIB
|
Reading and writing ECAT 6.3 matrix list. More...
#include "libtpcimgio.h"Go to the source code of this file.
Functions | |
| void | ecat63InitMatlist (MATRIXLIST *mlist) |
| void | ecat63EmptyMatlist (MATRIXLIST *mlist) |
| int | ecat63ReadMatlist (FILE *fp, MATRIXLIST *ml, int verbose) |
| void | ecat63PrintMatlist (MATRIXLIST *ml) |
| int | ecat63Matenter (FILE *fp, int matnum, int blkNr) |
| int | mat_numcod (int frame, int plane, int gate, int data, int bed) |
| void | mat_numdoc (int matnum, Matval *matval) |
| void | ecat63SortMatlistByPlane (MATRIXLIST *ml) |
| void | ecat63SortMatlistByFrame (MATRIXLIST *ml) |
| int | ecat63CheckMatlist (MATRIXLIST *ml) |
| int | ecat63DeleteLateFrames (MATRIXLIST *ml, int frame_nr) |
| int | ecat63GetMatrixBlockSize (MATRIXLIST *mlist, int *blk_nr) |
| int | ecat63GetPlaneAndFrameNr (MATRIXLIST *mlist, ECAT63_mainheader *h, int *plane_nr, int *frame_nr) |
| int | ecat63GetNums (MATRIXLIST *ml, short int *num_planes, short int *num_frames, short int *num_gates, short int *num_bed_pos) |
| int | ecat63GatherMatlist (MATRIXLIST *ml, short int do_planes, short int do_frames, short int do_gates, short int do_beds) |
Reading and writing ECAT 6.3 matrix list.
Assumptions:
Definition in file ecat63ml.c.
| int ecat63CheckMatlist | ( | MATRIXLIST * | ml | ) |
Checks that all matrixlist entries have read/write status.
| ml | matrix list |
Definition at line 324 of file ecat63ml.c.
Referenced by atnMake(), and ecatFixMatrixlist().
| int ecat63DeleteLateFrames | ( | MATRIXLIST * | ml, |
| int | frame_nr ) |
Mark deleted the frames after the specified frame number.
This can be used to delete sum images from the end of dynamic ECAT images.
| ml | matrix list. |
| frame_nr | last index not to be marked as deleted. |
Definition at line 342 of file ecat63ml.c.
Referenced by ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), and imgReadEcat63Header().
| void ecat63EmptyMatlist | ( | MATRIXLIST * | mlist | ) |
Free memory allocated for ECAT matrix list
| mlist | matrix list |
Definition at line 31 of file ecat63ml.c.
Referenced by atnMake(), ecat63AddImg(), ecat63ReadAllToImg(), ecat63ReadMatlist(), ecat63ReadPlaneToImg(), ecat6PrintSubheader(), imgReadEcat63Frame(), and imgReadEcat63Header().
| int ecat63GatherMatlist | ( | MATRIXLIST * | ml, |
| short int | do_planes, | ||
| short int | do_frames, | ||
| short int | do_gates, | ||
| short int | do_beds ) |
Matrix numbers in ECAT 6.3 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 6.3 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 510 of file ecat63ml.c.
Referenced by ecatFixMatrixlist(), imgReadEcat63Frame(), and imgReadEcat63Header().
| int ecat63GetMatrixBlockSize | ( | MATRIXLIST * | mlist, |
| int * | blk_nr ) |
Calculate the size of one data matrix in ECAT 6.3 file matrix list, and check that the size is same in all matrices.
| mlist | Ecat 6.3 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 366 of file ecat63ml.c.
Referenced by imgReadEcat63Frame(), and imgReadEcat63Header().
| int ecat63GetNums | ( | MATRIXLIST * | ml, |
| 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.
| ml | Pointer to matrixlist |
| num_planes | number of planes will be put here; NULL if not needed |
| num_frames | number of frames will be put here; NULL if not needed |
| num_gates | number of gates will be put here; NULL if not needed |
| num_bed_pos | number of gates will be put here; NULL if not needed |
Definition at line 450 of file ecat63ml.c.
Referenced by ecatFixMatrixlist().
| int ecat63GetPlaneAndFrameNr | ( | MATRIXLIST * | mlist, |
| ECAT63_mainheader * | h, | ||
| int * | plane_nr, | ||
| int * | frame_nr ) |
Calculate the number of planes and frames/gates from ECAT 6.3 matrix list. Check that all planes have equal nr of frames/gates, that frames/gates are sequentially numbered. This routines sorts the matrix list by planes.
| mlist | Ecat 6.3 matrix list; note that this list is here sorted by planes |
| h | Ecat 6.3 mainheader |
| plane_nr | Number of planes will be put here; NULL if not needed |
| frame_nr | Number of frames/gates will be put here; NULL if not needed |
Definition at line 400 of file ecat63ml.c.
Referenced by imgReadEcat63Header().
| void ecat63InitMatlist | ( | MATRIXLIST * | mlist | ) |
Initiate ECAT matrix list. Call this once before first use.
| mlist | matrix list |
Definition at line 20 of file ecat63ml.c.
Referenced by atnMake(), ecat63AddImg(), ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), ecat6PrintSubheader(), ecatFixMatrixlist(), imgReadEcat63Frame(), and imgReadEcat63Header().
| int ecat63Matenter | ( | FILE * | fp, |
| int | matnum, | ||
| int | blkNr ) |
Prepare matrix list for additional matrix data and Directory records are written in big endian byte order. Set block_nr to the number of data blocks excluding header;
| fp | file pointer |
| matnum | matrix number [1..number of matrices] |
| blkNr | matrix block number [ >= 1] |
Definition at line 159 of file ecat63ml.c.
Referenced by ecat63CopyFile(), ecat63WriteAttn(), ecat63WriteImage(), ecat63WriteImageMatrix(), ecat63WriteNorm(), ecat63WriteScan(), and ecat63WriteScanMatrix().
| void ecat63PrintMatlist | ( | MATRIXLIST * | ml | ) |
Print ECAT matrix list on stdout.
| ml | Pointer to matrix list to print. |
Definition at line 130 of file ecat63ml.c.
Referenced by ecat63ReadAllToImg(), ecat6PrintSubheader(), and ecatFixMatrixlist().
| int ecat63ReadMatlist | ( | FILE * | fp, |
| MATRIXLIST * | ml, | ||
| int | verbose ) |
Read ECAT 6.3 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 46 of file ecat63ml.c.
Referenced by atnMake(), ecat63AddImg(), ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), ecat6PrintSubheader(), ecatFixMatrixlist(), imgReadEcat63Frame(), and imgReadEcat63Header().
| void ecat63SortMatlistByFrame | ( | MATRIXLIST * | ml | ) |
Sort matrixlist by frame and plane. Bubble sorting algorithm.
| ml | matrix list |
Definition at line 297 of file ecat63ml.c.
Referenced by imgReadEcat63Frame().
| void ecat63SortMatlistByPlane | ( | MATRIXLIST * | ml | ) |
Sort matrixlist by plane and frame. Bubble sorting algorithm.
| ml | marix list. |
Definition at line 271 of file ecat63ml.c.
Referenced by ecat63GetPlaneAndFrameNr(), and imgReadEcat63Header().
| int mat_numcod | ( | int | frame, |
| int | plane, | ||
| int | gate, | ||
| int | data, | ||
| int | bed ) |
Returns the matrix identifier
| frame | frame number [0..4096] |
| plane | plane number [0..256] |
| gate | gate number [0..64] |
| data | data number [0..8] |
| bed | bed position [0..16] |
Definition at line 242 of file ecat63ml.c.
Referenced by atnMake(), ecat63AddImg(), ecat63GatherMatlist(), ecat63WriteAllImg(), and imgWriteEcat63Frame().
| void mat_numdoc | ( | int | matnum, |
| Matval * | matval ) |
Conversion of matrix identifier to numerical values
| matnum | matrix identifier coding |
| matval | target matrix value structure |
Definition at line 254 of file ecat63ml.c.
Referenced by atnMake(), ecat63AddImg(), ecat63DeleteLateFrames(), ecat63GatherMatlist(), ecat63GetNums(), ecat63GetPlaneAndFrameNr(), ecat63PrintMatlist(), ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), ecat63SortMatlistByFrame(), ecat63SortMatlistByPlane(), ecat6PrintSubheader(), imgReadEcat63Frame(), roi_mframe(), and roi_mplane().