00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #ifndef _IMG_H
00066 #define _IMG_H
00067
00068 #include "studynr.h"
00069
00071 #define IMG_STATUS_UNINITIALIZED 0
00072 #define IMG_STATUS_INITIALIZED 1
00073 #define IMG_STATUS_OCCUPIED 2
00074 #define IMG_STATUS_ERROR 3
00075
00076 #define IMG_ERR_OK 0
00077 #define IMG_ERR_CALLING 1
00078 #define IMG_ERR_OOM 2
00079
00080 #define IMG_TYPE_IMAGE 1
00081 #define IMG_TYPE_RAW 2
00082 #define IMG_TYPE_POLARMAP 3
00083
00084 #define IMG_UNKNOWN 0
00085 #define IMG_E63 1
00086 #define IMG_E7 2
00087 #define IMG_E7_2D 3
00088 #define IMG_POLARMAP 9
00089 #define IMG_ANA 11
00090 #define IMG_ANA_L 12
00091 #define IMG_INTERFILE 21
00092 #define IMG_NIFTI_1D 31
00093 #define IMG_NIFTI_1S 32
00094 #define IMG_MICROPET 41
00095
00096 #define SCANNER_UNKNOWN 0
00097 #define SCANNER_ECAT931 12
00098 #define SCANNER_ADVANCE 12096
00099 #define SCANNER_HRPLUS 3
00100 #define SCANNER_HRRT 4
00101
00102 #define SCANNER_MRI 5
00103 #define SCANNER_STEVCT_PET 6
00104 #define SCANNER_STEVCT_CT 7
00105
00106 #define SCANNER_PRIMATE 2000
00107 #define SCANNER_RODENT 2001
00108 #define SCANNER_MICROPET2 2002
00109 #define SCANNER_FOCUS_220 2500
00110 #define SCANNER_FOCUS_120 2501
00111 #define SCANNER_INVEON_DEDICATED_PET 5000
00112 #define SCANNER_INVEON_MM_PET 5500
00113 #define SCANNER_MR_PET_HEAD_INSERT 6000
00114 #define SCANNER_TUEBINGEN_PET_MR 8000
00115
00116 #define MAX_POLARMAP_NUM_RINGS 32
00117
00118 enum {STATUS_OK,STATUS_FAULT,STATUS_NOMEMORY,STATUS_NOFILE,STATUS_UNKNOWNFORMAT,
00119 STATUS_UNSUPPORTED,STATUS_MISSINGMATRIX,STATUS_NOWRITEPERM,STATUS_DISKFULL,
00120 STATUS_NOMATLIST,STATUS_INVALIDMATLIST,STATUS_VARMATSIZE,STATUS_NOMAINHEADER,
00121 STATUS_NOSUBHEADER, STATUS_NOMATRIX, STATUS_UNSUPPORTEDAXIALCOMP,
00122 STATUS_NOIMGDATAFILE, STATUS_NOHEADERFILE, STATUS_INVALIDHEADER,
00123 STATUS_NOIMGDATA, STATUS_NOSIFDATA, STATUS_WRONGSIFDATA,
00124 STATUS_CANTWRITEIMGFILE, STATUS_CANTWRITEHEADERFILE, STATUS_WRONGFILETYPE,
00125 STATUS_CANNOTERASE, STATUS_CANNOTREAD, STATUS_CANNOTWRITE,
00126 STATUS_UNSUPPORTEDPOLARMAP, STATUS_INVALIDPOLARMAP};
00127
00128 int IMG_TEST;
00129
00130 typedef struct {
00132 int x;
00134 int y;
00136 int z;
00138 int f;
00139 } IMG_PIXEL;
00140 typedef struct {
00142 int x1, x2;
00144 int y1, y2;
00146 int z1, z2;
00148 int f1, f2;
00149 } IMG_RANGE;
00150
00151
00152
00156 typedef struct {
00157
00158
00159
00160
00164 char status;
00166 const char *statmsg;
00167
00168
00169
00170
00172 char unit;
00174 char studyNr[MAX_STUDYNR_LEN+1];
00176 char patientName[32];
00178 char patientID[16];
00180 char radiopharmaceutical[32];
00182 float isotopeHalflife;
00184 char decayCorrected;
00186 time_t scanStart;
00188 int orientation;
00190 char userProcessCode[11];
00192 char studyDescription[32];
00193
00194
00195
00196
00198 char type;
00200 float zoom;
00202 float axialFOV;
00204 float transaxialFOV;
00206 float sampleDistance;
00208 float sizex;
00210 float sizey;
00212 float sizez;
00214 float gapx;
00216 float gapy;
00218 float gapz;
00220 float resolutionx;
00222 float resolutiony;
00224 float resolutionz;
00226 int _dataType;
00229 int _fileFormat;
00231 int scanner;
00232
00233
00234
00235
00239 int polarmap_num_rings;
00244 int polarmap_sectors_per_ring[MAX_POLARMAP_NUM_RINGS];
00247 float polarmap_ring_position[MAX_POLARMAP_NUM_RINGS];
00250 short int polarmap_ring_angle[MAX_POLARMAP_NUM_RINGS];
00252 short int polarmap_start_angle;
00253
00254
00255
00256
00257
00259 unsigned short int dimt;
00261 unsigned short int dimx;
00263 unsigned short int dimy;
00265 unsigned short int dimz;
00267 float *_pxl;
00268 float **_col;
00269 float ***_row;
00270 float ****_pln;
00271 float *_header;
00272
00274 float ****m;
00276 float ****plane;
00278 float ***row;
00280 float **column;
00282 float *pixel;
00284 int *planeNumber;
00285
00286
00287
00288
00290 float *start;
00292 float *end;
00294 float *mid;
00295
00296
00297
00298
00300 char isWeight;
00302 float *weight;
00304 float *sd;
00306 float *prompts;
00308 float *randoms;
00309
00310
00311
00312
00314 float *decayCorrFactor;
00315
00317 int errstatus;
00318
00319 } IMG;
00320
00321
00322
00323
00324
00325
00326
00327 extern void imgInit(IMG *image);
00328 extern void imgEmpty(IMG *image);
00329 extern int imgAllocate(IMG *image, int planes, int rows, int columns, int frames);
00330 extern int imgAllocateWithHeader(
00331 IMG *image, int planes, int rows, int columns, int frames, IMG *image_from);
00332
00333 extern char *imgStatus(int status_index);
00334 extern void imgSetStatus(IMG *img, int status_index);
00335 extern void imgInfo(IMG *image);
00336 extern int imgCopyhdr(IMG *image1, IMG *image2);
00337 extern int imgExtractRange(IMG *img1, IMG_RANGE r, IMG *img2);
00338
00339
00340
00341 #endif
00342