TPCCLIB
Loading...
Searching...
No Matches
prmat.c
Go to the documentation of this file.
1
7/*****************************************************************************/
10/*****************************************************************************/
11#include "libtpcrec.h"
12/*****************************************************************************/
13
14/*****************************************************************************/
15/* Initialization and memory handling for prmat data */
16/*****************************************************************************/
22void prmatInit(PRMAT *mat)
23{
24 if(PRMAT_VERBOSE) printf("PRMAT:prmatInit() \n");
25
26 /*init the information of projection matrix*/
27 //buffer mat to contain zero
28 memset(mat, 0, sizeof(PRMAT));
29 mat->type=PRMAT_TYPE_NA;
30 mat->viewNr=0;
31 mat->binNr=0;
32 mat->mode=PRMAT_DMODE_01;
33 mat->prmatfov= (int*)NULL;
34 mat->max=mat->min=0.0;
35 mat->scaling_factor=1.0;
36 mat->factor_sum=0.0;
37 mat->factor_sqr_sum=(float*)NULL;
38
39 /*init look-up table*/
40 mat->nrp=0;
41 mat->lines=mat->_linesdata=(unsigned int**)NULL; //data array
42
43 /*init projection data*/
44 mat->dimr=0;
45 mat->dime=(unsigned int*)NULL;
46 mat->fact=mat->_factdata=(unsigned short int***)NULL; //data array
47
48 mat->status=PRMAT_STATUS_INITIALIZED;
49}
50/*****************************************************************************/
56void prmatEmpty(PRMAT *mat)
57{
58 unsigned int ir, ip;
59 if(PRMAT_VERBOSE) printf("PRMAT:prmatEmpty() \n");
60
61 //if mat is allready empty
62 if(mat->status==PRMAT_STATUS_INITIALIZED) return;
63
64 //if look-up table is occupied
65 if(mat->status==PRMAT_STATUS_LU_OCCUPIED) {
66 /*free the occupied memory*/
67 for(ir=0; ir<mat->nrp; ir++) { //every row
68 free((unsigned int*)mat->_linesdata[ir]);
69 }
70 if(mat->nrp > 0) free(mat->_linesdata);
71 }
72
73 //if projection matrix is occupied
74 if(mat->status==PRMAT_STATUS_PR_OCCUPIED ||
75 mat->status==PRMAT_STATUS_BS_OCCUPIED )
76 {
77 free((float*)mat->factor_sqr_sum);
78 for(ir=0; ir<mat->dimr; ir++){ //every row
79 for(ip=0; ip<mat->dime[ir]; ip++){ //every factor
80 free((unsigned short int*)mat->_factdata[ir][ip]);
81 }
82 }
83
84 free((int*)mat->dime);
85
86 if(mat->dimr>0) free(mat->_factdata);
87 mat->dimr=0;
88 }
89 return;
90}
91/*****************************************************************************/
105int prmatAllocate(PRMAT *mat, int set, unsigned int rows, unsigned int *coords)
106{
107 unsigned int *iptr, ir, ip;
108 if(PRMAT_VERBOSE) printf("PRMAT:prmatAllocate(*mat,%d,*coords) \n",rows);
109
110 /*check the arguments*/
111 if(mat->status==PRMAT_STATUS_UNINITIALIZED) return(1);
112 if(rows<1) return(2);
113
114 //If set != 0 allocate for projection matrix.
115 if(set){
116 /*allocate memory*/
117 mat->factor_sqr_sum=calloc(rows,sizeof(float));
118 mat->dimr=rows; //for dimr
119 mat->dime=calloc(rows,sizeof(int));
120 mat->_factdata=
121 (unsigned short int***)calloc(rows,sizeof(unsigned short int**));
122 //if not enough memory
123 if(mat->_factdata==NULL || mat->dime==NULL) return(4);
124 //iterate through the rows
125 for(ir=0,iptr=coords; ir<rows; ir++){
126 //copy the coords vector in the same loop
127 mat->dime[ir]=*iptr;
128 //*iptr is the number of (non-zero) factors in this row
129 mat->_factdata[ir]=
130 (unsigned short int**)calloc(*iptr,sizeof(unsigned short int*));
131 //if not enough memory
132 if(mat->_factdata[ir]==NULL) return(4);
133 //iterate through the factors in this row
134 for(ip=0; ip<(*iptr); ip++){
135 //NOTE that the leaves are coordinates and factor in this order
136 mat->_factdata[ir][ip]=
137 (unsigned short int*)calloc(3,sizeof(unsigned short int));
138 if(mat->_factdata[ir][ip]==NULL) return(4);
139 }
140 iptr++;
141 }
142 /*set data pointers; these pointers are used to avoid data loss*/
143 mat->fact=mat->_factdata;
144 } else {
145 //If set was 0 allocate for look-up table.
146 //allocate memory for look up table
147 mat->nrp=rows;
148 mat->_linesdata=(unsigned int**)calloc(rows,sizeof(unsigned int*));
149 //if not enough memory
150 if(mat->_linesdata==NULL) return(4);
151 //iterate through the rows
152 for(ir=0,iptr=coords; ir<rows; ir++){
153 //iptr is the number of lors belonging to this pixel
154 mat->_linesdata[ir]=(unsigned int*)calloc(*iptr + 2,sizeof(unsigned int));
155 //if not enough memory
156 if(mat->_linesdata[ir]==NULL) return(4);
157 iptr++;
158 }
159 //set data pointers; these pointers are used to avoid data loss
160 mat->lines=mat->_linesdata;
161 }
162 return(0);
163}
164/*****************************************************************************/
165/* GET procedures for PRMAT datatype. USE ONLY THESE FOR GETTING. */
166/*****************************************************************************/
167/* GET FUNCTIONS FOR THE PARAMETERS */
168/*****************************************************************************/
175unsigned int prmatGetNV(PRMAT *mat)
176{
177 return mat->viewNr;
178}
179/*****************************************************************************/
186unsigned int prmatGetNB(PRMAT *mat)
187{
188 return mat->binNr;
189}
190/*****************************************************************************/
197unsigned int prmatGetID(PRMAT *mat)
198{
199 return mat->imgDim;
200}
201/*****************************************************************************/
202/* GET FUNCTIONS FOR ACCESSING LOOK-UP TABLE*/
203/*****************************************************************************/
210unsigned int prmatGetPIX(PRMAT *mat)
211{
212 return mat->nrp;
213}
214/*****************************************************************************/
223unsigned int prmatGetPixCoord(PRMAT *mat,int row)
224{
225 return mat->lines[row][0];
226}
227/*****************************************************************************/
237unsigned int prmatGetRays(PRMAT *mat,int row)
238{
239 return mat->lines[row][1];
240}
241/*****************************************************************************/
253unsigned int prmatGetBinView(PRMAT *mat, int row, int ind)
254{
255 return mat->lines[row][ind+2];
256}
257/*****************************************************************************/
258/* GET FUNCTIONS FOR ACCESSING PROJECTION MATRIX BY A LINE OF RESPONSE.*/
259/*****************************************************************************/
267unsigned int prmatGetRows(PRMAT *mat)
268{
269 //NOTE no checking on parameters to accelerate iteration
270 return(mat->dimr);
271}
272/*****************************************************************************/
282unsigned int prmatGetPixels(PRMAT *mat, int row)
283{
284 return(mat->dime[row]);
285}
286/*****************************************************************************/
297unsigned int prmatGetCoord(PRMAT *mat, int row, int pix)
298{
299 return (int)(mat->fact[row][pix][1])*mat->imgDim + (int)(mat->fact[row][pix][0]);
300}
301/*****************************************************************************/
312unsigned int prmatGetXCoord(PRMAT *mat, int row, int pix)
313{
314 return (int)(mat->fact[row][pix][0]);
315}
316/*****************************************************************************/
327unsigned int prmatGetYCoord(PRMAT *mat, int row, int pix)
328{
329 return (int)(mat->fact[row][pix][1]);
330}
331/*****************************************************************************/
342float prmatGetFactor(PRMAT *mat, int row, int pix)
343{
344 return((float)(mat->scaling_factor)*(mat->fact[row][pix][2]));
345}
346/*****************************************************************************/
354{
355 return(mat->prmatfov[0]);
356}
357/*****************************************************************************/
365{
366 return(mat->prmatfov[1]);
367}
368/*****************************************************************************/
376{
377 return(mat->min);
378}
379/*****************************************************************************/
386float prmatGetMax(PRMAT *mat) {
387 return(mat->max);
388}
389/*****************************************************************************/
398{
399 return(mat->factor_sum);
400}
401/*****************************************************************************/
409float prmatGetFactorSqrSum(PRMAT *mat, int row)
410{
411 return(mat->factor_sqr_sum[row]);
412}
413/*****************************************************************************/
414/* ARCHIVING METHODS */
415/*****************************************************************************/
429{
430 char matrixfile[FILENAME_MAX], semi_x_c[2], semi_y_c[2], mod[2];
431 int semi_x=mat->prmatfov[0], semi_y=mat->prmatfov[1], mode=mat->mode, itmp;
432 unsigned short int x_coordinate, y_coordinate, value, p_coord, lors;
433 unsigned int lor, row, fac, ind;
434 float ftmp;
435 FILE *fp;
436
437 //Compose the file name to write
438 sprintf(semi_x_c,"%i",semi_x);
439 sprintf(semi_y_c,"%i",semi_y);
440 //decide the type
441 if(mat->type==PRMAT_TYPE_ECAT931) strcpy(matrixfile,"prE");
442 else
443 if(mat->type==PRMAT_TYPE_GE) strcpy(matrixfile,"prG");
444 else strcpy(matrixfile,"prN");
445 //decide the mode
446 sprintf(mod,"%i",mode);
447 strcat(matrixfile,mod);
448 strcat(matrixfile,semi_x_c);
449 strcat(matrixfile,semi_y_c);
450 strcat(matrixfile,".prm");
451
452 if(access(matrixfile, 0) != -1) {
453 if(PRMAT_VERBOSE) printf("PRMAT:File %s already exists.\n", matrixfile);
454 return(0);
455 }
456
457 fp=fopen(matrixfile,"wb+");
458 if(fp==NULL) return(1);
459
460 // Save status.
461 fwrite(&(mat->status),sizeof(int),1,fp);
462
463 // Save type of the scanner.
464 fwrite(&(mat->type),sizeof(int),1,fp);
465
466 // Save scanner geometrics.
467 fwrite(&(mat->viewNr),sizeof(int),1,fp);
468 fwrite(&(mat->binNr),sizeof(int),1,fp);
469 fwrite(&(mat->imgDim),sizeof(int),1,fp);
470
471 // Save mode.
472 fwrite(&(mat->mode),sizeof(int),1,fp);
473
474 // Save FOV.
475 fwrite(&(mat->prmatfov[0]),sizeof(int),1,fp);
476 fwrite(&(mat->prmatfov[1]),sizeof(int),1,fp);
477
478 // Save min, max, sum and scaling factor.
479 fwrite(&(mat->min),sizeof(float),1,fp);
480 fwrite(&(mat->max),sizeof(float),1,fp);
481 fwrite(&(mat->factor_sum),sizeof(float),1,fp);
482 fwrite(&(mat->scaling_factor),sizeof(float),1,fp);
483
484 // If projection matrix is set.
485 if(mat->status >= PRMAT_STATUS_BS_OCCUPIED){
486
487 fwrite(&(mat->dimr),sizeof(int),1,fp);
488 //square sums
489 for(row=0;row<prmatGetRows(mat);row++){
490 ftmp=prmatGetFactorSqrSum(mat,row);
491 fwrite(&ftmp,sizeof(float),1,fp);
492 }
493 //dime
494 for(row=0;row<prmatGetRows(mat);row++){
495 itmp=prmatGetPixels(mat,row);
496 fwrite(&itmp,sizeof(int),1,fp);
497 }
498 //the actual data _factdata
499 for(row=0;row<prmatGetRows(mat);row++){
500 //coordinates and values in every row
501 for(fac=0;fac<prmatGetPixels(mat,row);fac++){
502 x_coordinate=prmatGetXCoord(mat,row,fac);
503 fwrite(&x_coordinate,sizeof(unsigned short int),1,fp);
504 y_coordinate=prmatGetYCoord(mat,row,fac);
505 fwrite(&y_coordinate,sizeof(unsigned short int),1,fp);
506 //NOTE that we wan't to save the values in unsigned short ints
507 value=mat->fact[row][fac][2];
508 fwrite(&value,sizeof(unsigned short int),1,fp);
509 }
510 }
511 }// END OF SAVING PROJECTION MATRIX.
512
513 // If look-up table is set.
514 if(mat->status == PRMAT_STATUS_LU_OCCUPIED){
515 //save first the statical parts of the structure
516 fwrite(&(mat->nrp),sizeof(int),1,fp);
517 //save lines: first coordinates of pixels inside the fov,
518 for(row=0;row<prmatGetPIX(mat);row++){
519 p_coord=prmatGetPixCoord(mat,row);
520 fwrite(&p_coord,sizeof(unsigned short int),1,fp);
521 }
522 // then number of lors hitting a pixel.
523 for(row=0; row<prmatGetPIX(mat); row++){
524 lors=prmatGetRays(mat,row);
525 fwrite(&lors,sizeof(unsigned short int),1,fp);
526 }
527
528 //save lors
529 for(row=0;row<prmatGetPIX(mat);row++){
530 for(ind=0; ind<prmatGetRays(mat,row); ind++){
531 lor = prmatGetBinView(mat,row,ind);
532 fwrite(&lor,sizeof(unsigned int),1,fp);
533 }
534 }
535 }// END OF SAVING LOOK-UP TABLE.
536
537 fclose(fp);
538 return(0);
539}
540/*****************************************************************************/
550int prmatReadMatrix(char *fname, PRMAT *mat)
551{
552 unsigned int fov[2], *dimentry=NULL, *nrlor, *iptr, dimtmp, count=0;
553 unsigned int row, lor=0, ind, fac;
554 unsigned short int *nrlor_c, *nrlor_l, *usiptr, *usiptr_c;
555 unsigned short int x_coordinate=0, y_coordinate=0, value=0;
556 float *sqrsum=NULL, *fptr, sqrtmp;
557 FILE *fp;
558
559 if(PRMAT_VERBOSE) printf("\n PRMAT:prmatReadMatrix(%s,mat) \n",fname);
560 if(mat->status==PRMAT_STATUS_UNINITIALIZED) return(1);
561 prmatEmpty(mat);
562
563 fp=fopen(fname,"rb");
564 if(fp==NULL) return(1);
565
566 //read first the statical parts of the structure
567 if(fread(&(mat->status),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
568 if(PRMAT_VERBOSE) printf("PRMAT: status: %i \n",mat->status);
569 if(fread(&(mat->type),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
570 if(PRMAT_VERBOSE) printf("PRMAT: scanner type: %i \n",mat->type);
571 if(fread(&(mat->viewNr),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
572 if(fread(&(mat->binNr),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
573 if(fread(&(mat->imgDim),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
574 if(PRMAT_VERBOSE)
575 printf("PRMAT: scanner geometrics: (%i,%i,%i) \n",
576 mat->viewNr,mat->binNr,mat->imgDim);
577 if(fread(&(mat->mode),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
578 if(PRMAT_VERBOSE) printf("PRMAT: discretisation mode: %i \n",mat->mode);
579 if(fread(fov,sizeof(int),1,fp)==0) {fclose(fp); return(2);}
580 if(fread((fov+1),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
581 mat->prmatfov=calloc(2,sizeof(int));
582 mat->prmatfov[0]=fov[0];
583 mat->prmatfov[1]=fov[1];
584 if(PRMAT_VERBOSE)
585 printf("PRMAT: FOV: (%i,%i) \n", mat->prmatfov[0],mat->prmatfov[1]);
586 // Read min, max, sum and scaling factor.
587 if(fread(&(mat->min),sizeof(float),1,fp)==0) {fclose(fp); return(2);}
588 if(PRMAT_VERBOSE) printf("PRMAT: min: %f \n",mat->min);
589 if(fread(&(mat->max),sizeof(float),1,fp)==0) {fclose(fp); return(2);}
590 if(PRMAT_VERBOSE) printf("PRMAT: max: %f \n",mat->max);
591 if(fread(&(mat->factor_sum),sizeof(float),1,fp)==0) {fclose(fp); return(2);}
592 if(PRMAT_VERBOSE) printf("PRMAT: sum of all factors: %f \n",mat->factor_sum);
593 if(fread(&(mat->scaling_factor),sizeof(float),1,fp)==0) {fclose(fp); return(2);}
594 if(PRMAT_VERBOSE) printf("PRMAT: scaling factor: %f \n",mat->scaling_factor);
595
596 // If projection matrix has been occupied.
597 if(mat->status >= PRMAT_STATUS_BS_OCCUPIED){
598 if(PRMAT_VERBOSE) printf("PRMAT: reading projection matrix \n");
599 if(fread(&(mat->dimr),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
600 if(PRMAT_VERBOSE)
601 printf("PRMAT: number of rows in the projection matrix: %i \n",mat->dimr);
602 //read square sums
603 sqrsum=calloc(mat->dimr,sizeof(float));
604 for(row=0, fptr=sqrsum;row<(mat->dimr); row++, fptr++) {
605 if(fread(&sqrtmp,sizeof(float),1,fp)==0) {fclose(fp); return(2);}
606 *fptr=sqrtmp;
607 }
608 //read dime
609 dimentry=(unsigned int*)calloc(mat->dimr,sizeof(int));
610 count = 0;
611 for(row=0,iptr=dimentry;row<(mat->dimr);row++,iptr++){
612 if(fread(&dimtmp,sizeof(int),1,fp)==0) {fclose(fp); return(2);}
613 *iptr=dimtmp;
614 count += dimtmp;
615 }
616
617 //ready to allocate; NOTE that dime is also set in function prmatAllocate()
618 prmatAllocate(mat,1,mat->dimr,dimentry);
619 if(PRMAT_VERBOSE)
620 printf("PRMAT:prmatAllocate(mat) done in prmatReadMatrix(%s,mat)\n",fname);
621
622 //now we can set square sums
623 for(row=0, fptr=sqrsum;row<(mat->dimr);row++, fptr++){
624 mat->factor_sqr_sum[row]=*fptr;
625 }
626 //read the actual data _factdata
627 for(row=0;row<(mat->dimr);row++){
628 //read coordinates and values in every row
629 for(fac=0;fac<prmatGetPixels(mat,row);fac++){
630 if(fread(&x_coordinate,sizeof(unsigned short int),1,fp)==0) {
631 fclose(fp); return(2);}
632 mat->fact[row][fac][0]=x_coordinate;
633 if(fread(&y_coordinate,sizeof(unsigned short int),1,fp)==0) {
634 fclose(fp); return(2);}
635 mat->fact[row][fac][1]=y_coordinate;
636 if(fread(&value,sizeof(unsigned short int),1,fp)==0) {
637 fclose(fp); return(2);}
638 mat->fact[row][fac][2]=value;
639 }
640 }
641 }// END OF READING PROJECTIONS
642
643 // If look-up table has been occupied.
644 if(mat->status == PRMAT_STATUS_LU_OCCUPIED){
645 if(PRMAT_VERBOSE) printf("PRMAT: reading look-up table \n");
646 if(fread(&(mat->nrp),sizeof(int),1,fp)==0) {fclose(fp); return(2);}
647 if(PRMAT_VERBOSE)
648 printf("PRMAT: number of pixels inside the FOV: %i \n",mat->nrp);
649 //read nrlor
650 nrlor_c=(unsigned short int*)calloc(mat->nrp,sizeof(unsigned short int));
651 nrlor_l=(unsigned short int*)calloc(mat->nrp,sizeof(unsigned short int));
652
653 //first coordinates of pixels.
654 usiptr = nrlor_c;
655 for(row=0; row<mat->nrp; row++, usiptr++){
656 // Read next coordinate from file.
657 if(fread(usiptr,sizeof(unsigned short int),1,fp)==0) {fclose(fp); return(2);}
658 }
659 //then number of lors hitting a pixel
660 usiptr = nrlor_l;
661 for(row=0; row<mat->nrp; row++, usiptr++){
662 // Read next lornr from file.
663 if(fread(usiptr,sizeof(unsigned short int),1,fp)==0) {fclose(fp); return(2);}
664 }
665
666 if(PRMAT_VERBOSE){
667 // Get number of lors in lut.
668 usiptr = nrlor_l;
669 count = 0;
670 for(row=0; row<mat->nrp; row++, usiptr++){
671 count += *usiptr;
672 }
673 printf("PRMAT: nr of lors in lut: %i \n",count);
674 //printf(" nr of lors in ave: %i \n",count/mat->nrp);
675 }
676
677 // Copy list usi format to integer list.
678 nrlor = (unsigned int*)calloc(mat->nrp,sizeof(int));
679 usiptr = nrlor_l;
680 iptr = nrlor;
681 for(row=0; row<mat->nrp; row++, iptr++){
682 *iptr = (int)*usiptr++;
683 }
684
685 // Now we can allocate memory for look-up table.
686 prmatAllocate(mat, 0, mat->nrp, nrlor);
687 if(PRMAT_VERBOSE)
688 printf("PRMAT:prmatAllocate(mat) done in prmatReadMatrix(%s,mat)\n",fname);
689 // And fill mat->lines.
690 usiptr_c = nrlor_c;
691 usiptr = nrlor_l;
692 for(row=0;row<mat->nrp;row++ , usiptr++, usiptr_c++){
693 mat->lines[row][0] = *usiptr_c;
694 mat->lines[row][1] = *usiptr;
695 }
696
697 // Read the data _linesdata.
698 for(row=0;row<prmatGetPIX(mat);row++){
699 for(ind=0; ind<prmatGetRays(mat,row); ind++){
700 if(fread(&lor,sizeof(unsigned int),1,fp)==0) {fclose(fp); return(2);}
701 mat->lines[row][ind+2] = lor;
702 }
703 }
704
705 free((unsigned short int*)nrlor_l);
706 free((unsigned short int*)nrlor_c);
707 }// END OF READING LOOK-UP TABLE
708
709 if(PRMAT_VERBOSE) printf("PRMAT: prmatReadMatrix() done. \n");
710 free((float*)sqrsum); free((int*)dimentry);
711
712 fclose(fp);
713
714 return(0);
715}
716/*****************************************************************************/
717
718/*****************************************************************************/
Header file for libtpcrec.
int PRMAT_TEST
If not 0 drive in test mode.
Definition prmat.c:8
int PRMAT_VERBOSE
If not 0 drive in verbose mode.
Definition prmat.c:9
unsigned int prmatGetNV(PRMAT *mat)
Definition prmat.c:175
unsigned int prmatGetPIX(PRMAT *mat)
Definition prmat.c:210
unsigned int prmatGetRays(PRMAT *mat, int row)
Definition prmat.c:237
float prmatGetFactorSum(PRMAT *mat)
Definition prmat.c:397
unsigned int prmatGetBinView(PRMAT *mat, int row, int ind)
Definition prmat.c:253
float prmatGetMinor(PRMAT *mat)
Definition prmat.c:364
unsigned int prmatGetRows(PRMAT *mat)
Definition prmat.c:267
void prmatEmpty(PRMAT *mat)
Definition prmat.c:56
void prmatInit(PRMAT *mat)
Definition prmat.c:22
float prmatGetFactorSqrSum(PRMAT *mat, int row)
Definition prmat.c:409
unsigned int prmatGetYCoord(PRMAT *mat, int row, int pix)
Definition prmat.c:327
unsigned int prmatGetXCoord(PRMAT *mat, int row, int pix)
Definition prmat.c:312
unsigned int prmatGetPixCoord(PRMAT *mat, int row)
Definition prmat.c:223
unsigned int prmatGetCoord(PRMAT *mat, int row, int pix)
Definition prmat.c:297
int prmatSaveMatrix(PRMAT *mat)
Definition prmat.c:428
float prmatGetMin(PRMAT *mat)
Definition prmat.c:375
unsigned int prmatGetID(PRMAT *mat)
Definition prmat.c:197
float prmatGetMajor(PRMAT *mat)
Definition prmat.c:353
int prmatReadMatrix(char *fname, PRMAT *mat)
Definition prmat.c:550
int prmatAllocate(PRMAT *mat, int set, unsigned int rows, unsigned int *coords)
Definition prmat.c:105
float prmatGetFactor(PRMAT *mat, int row, int pix)
Definition prmat.c:342
unsigned int prmatGetPixels(PRMAT *mat, int row)
Definition prmat.c:282
unsigned int prmatGetNB(PRMAT *mat)
Definition prmat.c:186
float prmatGetMax(PRMAT *mat)
Definition prmat.c:386
unsigned int ** lines
Definition libtpcrec.h:194
float max
Maximal factor value in the projection matrix.
Definition libtpcrec.h:181
float min
Minimal factor value in the projection matrix.
Definition libtpcrec.h:179
char type
Scanner information on the prmat. 0=ECAT931 1=GE Advance.
Definition libtpcrec.h:166
int * prmatfov
Definition libtpcrec.h:177
char status
Prmat status.
Definition libtpcrec.h:164
float * factor_sqr_sum
Square sums of factors in each row in the projection matrix.
Definition libtpcrec.h:202
unsigned short int *** fact
Definition libtpcrec.h:208
float scaling_factor
Scaling factor for factors (notice that factors are stored in integers).
Definition libtpcrec.h:185
unsigned int * dime
Number of pixels hit by a line for every line.
Definition libtpcrec.h:204
unsigned int imgDim
Scanner geometrics, field imgDim.
Definition libtpcrec.h:172
float factor_sum
The sum of all factors in the projection matrix.
Definition libtpcrec.h:183
unsigned int dimr
Dimension of rows (lines of response) in the projection matrix.
Definition libtpcrec.h:200
unsigned int nrp
Number of pixels inside the fov. i.e. number of rows in the look-up table.
Definition libtpcrec.h:189
unsigned int viewNr
Scanner geometrics, field viewNr.
Definition libtpcrec.h:168
unsigned int ** _linesdata
Hidden pointer for the actual data.
Definition libtpcrec.h:196
int mode
Discretisation model utilised.
Definition libtpcrec.h:174
unsigned int binNr
Scanner geometrics, field binNr.
Definition libtpcrec.h:170
unsigned short int *** _factdata
Hidden pointer for the actual data.
Definition libtpcrec.h:210