TPCCLIB
Loading...
Searching...
No Matches
tpcimage.h
Go to the documentation of this file.
1
6#ifndef _TPCIMAGE_H_
7#define _TPCIMAGE_H_
8/*****************************************************************************/
9
10/*****************************************************************************/
11#include "tpcclibConfig.h"
12/*****************************************************************************/
13#include <stdio.h>
14#include <stdlib.h>
15#include <string.h>
16#include <math.h>
17/*****************************************************************************/
18#include "tpcextensions.h"
19#include "tpcift.h"
20#include "tpcisotope.h"
21#include "tpctac.h" // SIF is TAC
22/*****************************************************************************/
23#include "tpcecat.h"
24#include "tpcdcm.h"
25#include "tpcnifti.h"
26/*****************************************************************************/
27
28/*****************************************************************************/
50/*****************************************************************************/
51
52/*****************************************************************************/
64/*****************************************************************************/
65
66/*****************************************************************************/
78/*****************************************************************************/
79
80/*****************************************************************************/
82typedef struct {
83
85 char studyNr[MAX_STUDYNR_LEN+1];
86
89
92
94 char scanStart[20];
95
98
101
106
107 /* Coordination */
108
110 unsigned short int dimt;
112 unsigned short int dimx;
114 unsigned short int dimy;
116 unsigned short int dimz;
117
119 float sizex;
121 float sizey;
123 float sizez;
124
126 float gapx;
128 float gapy;
130 float gapz;
131
133 short int xform[2];
135 float quatern[6];
137 float srow[12];
139 float iop[6];
141 float ipp[3];
144 float mt[12];
145
146 /* Pixel data */
147
149
150 float *_t;
152 float **_x;
154 float ***_y;
156 float ****_z;
158
159 /* Pointers for data to be used */
161 float ****m;
174 float *p;
175
176 /*
177 * Frame times
178 */
180 float *x1;
182 float *x2;
184 float *x;
185
186 /*
187 * Frame weights
188 */
193 float *weight;
195 float *prompts;
197 float *randoms;
198
199 /*
200 * Data units
201 */
206
211
212} IMG;
213/*****************************************************************************/
214
215/*****************************************************************************/
216/* image */
217extern void imgInit(IMG *image);
218extern void imgFree(IMG *image);
219extern int imgAllocate(
220 IMG *img, const unsigned int dimz, const unsigned int dimy,
221 const unsigned int dimx, const unsigned int dimt, TPCSTATUS *status
222);
223extern char *imgContentDescr(imgcontent c);
224extern char *imgModalityDescr(imgmodality c);
225extern int imgHasData(IMG *img);
226extern int imgHasTimes(IMG *img);
227extern int imgHasCounts(IMG *img);
228extern int imgHasWeights(IMG *img);
229extern void imgContents(IMG *img, FILE *fp);
230extern unsigned long long imgNaNs(IMG *img, int fix);
231extern int imgMinMax(IMG *img, float *minvalue, float *maxvalue);
232extern int imgXRange(IMG *img, double *xmin, double *xmax);
233/*****************************************************************************/
234
235/*****************************************************************************/
236/* imageheader */
237extern int imgCopyHeader(IMG *img1, IMG *img2);
238extern int imgFillOHeader(IMG *img, TPCSTATUS *status);
239/*****************************************************************************/
240
241/*****************************************************************************/
242/* imageio */
243extern char *imgFormatDescr(imgformat c);
244extern char *imgDefaultExtension(imgformat c);
245extern int imgRead(IMG *img, const char *fname, TPCSTATUS *status);
246extern int imgWrite(IMG *img, const char *fname, TPCSTATUS *status);
247extern imgformat imgFormatFromFName(const char *fname, TPCSTATUS *status);
248extern imgformat imgFormatIdentify(const char *s);
249/*****************************************************************************/
250
251/*****************************************************************************/
252/* imagedcm */
253extern int imgReadDICOM(IMG *img, const char *fname, TPCSTATUS *status);
254extern int imgWriteDICOM(IMG *img, const char *fname, TPCSTATUS *status);
255/*****************************************************************************/
256
257/*****************************************************************************/
258/* imagenii */
259extern int niftiCreateFNames(
260 const char *filename, char *hdrfile, char *imgfile, char *siffile, int fileformat
261);
262extern int imgReadNifti(IMG *img, const char *fname, TPCSTATUS *status);
263extern int imgWriteNifti(IMG *img, const char *fname, TPCSTATUS *status);
264extern int imgSetNiftiHeader(IMG *img, NIFTI_DSR *dsr, int verbose);
265extern int imgGetNiftiHeader(IMG *img, NIFTI_DSR *dsr, int verbose);
266/*****************************************************************************/
267
268/*****************************************************************************/
269/* imagesif */
270extern int imgToSIF(IMG *img, TAC *sif, int copy_header, int copy_frames, int copy_counts, int verbose);
271extern int imgFromSIF(IMG *img, TAC *sif, int copy_header, int copy_frames, int copy_counts, int verbose);
272/*****************************************************************************/
273
274/*****************************************************************************/
275/* imagecomp */
276extern int imgCompareMatrixSize(IMG *d1, IMG *d2);
277extern int imgCompareUnit(IMG *d1, IMG *d2, TPCSTATUS *status);
278extern int imgCompareConc(
279 IMG *d1, IMG *d2, const float test_abs, const float test_rel, TPCSTATUS *status);
280extern int imgCompareTimes(
281 IMG *d1, IMG *d2, const float test_abs, const float test_rel, TPCSTATUS *status);
282/*****************************************************************************/
283
284/*****************************************************************************/
285#endif /* TPCIMAGE */
Definition tpcift.h:43
Definition tpcimage.h:82
float sizex
Definition tpcimage.h:119
unsigned short int dimx
Definition tpcimage.h:112
float * x1
Definition tpcimage.h:180
imgmodality modality
Definition tpcimage.h:100
unit cunit
Definition tpcimage.h:203
float gapx
Definition tpcimage.h:126
float **** m
Definition tpcimage.h:161
imgformat format
Definition tpcimage.h:103
float * x2
Definition tpcimage.h:182
float * prompts
Definition tpcimage.h:195
unsigned short int dimt
Definition tpcimage.h:110
float sizey
Definition tpcimage.h:121
float * weight
Definition tpcimage.h:193
weights weighting
Definition tpcimage.h:191
IFT ih
Definition tpcimage.h:208
imgcontent content
Definition tpcimage.h:97
unsigned short int dimz
Definition tpcimage.h:116
unsigned short int dimy
Definition tpcimage.h:114
float * p
Definition tpcimage.h:174
float * x
Definition tpcimage.h:184
decaycorrection decayCorrection
Definition tpcimage.h:91
IFT oh
Definition tpcimage.h:210
float gapy
Definition tpcimage.h:128
float * randoms
Definition tpcimage.h:197
isotope isot
Definition tpcimage.h:88
float gapz
Definition tpcimage.h:130
imgformat oformat
Definition tpcimage.h:105
float sizez
Definition tpcimage.h:123
unit tunit
Definition tpcimage.h:205
Definition tpctac.h:87
Header file for libtpcdcm.
Header file for libtpcecat.
Header file for library libtpcextensions.
weights
Is data weighted, or are weight factors available with data?
unit
#define MAX_STUDYNR_LEN
Define max study number length.
Header file for library libtpcift.
int imgHasData(IMG *img)
Definition image.c:218
int imgFillOHeader(IMG *img, TPCSTATUS *status)
Definition imageheader.c:61
char * imgModalityDescr(imgmodality c)
Definition image.c:27
int imgCopyHeader(IMG *img1, IMG *img2)
Definition imageheader.c:18
int imgSetNiftiHeader(IMG *img, NIFTI_DSR *dsr, int verbose)
Definition imagenii.c:576
int imgCompareMatrixSize(IMG *d1, IMG *d2)
Definition imagecomp.c:18
void imgFree(IMG *image)
Definition image.c:107
int imgReadDICOM(IMG *img, const char *fname, TPCSTATUS *status)
Definition imagedcm.c:23
void imgContents(IMG *img, FILE *fp)
Definition image.c:293
int niftiCreateFNames(const char *filename, char *hdrfile, char *imgfile, char *siffile, int fileformat)
Definition imagenii.c:17
imgformat imgFormatFromFName(const char *fname, TPCSTATUS *status)
Definition imageio.c:394
int imgWriteNifti(IMG *img, const char *fname, TPCSTATUS *status)
Definition imagenii.c:390
unsigned long long imgNaNs(IMG *img, int fix)
Definition image.c:373
int imgHasWeights(IMG *img)
Definition image.c:278
int imgCompareTimes(IMG *d1, IMG *d2, const float test_abs, const float test_rel, TPCSTATUS *status)
Definition imagecomp.c:144
int imgCompareUnit(IMG *d1, IMG *d2, TPCSTATUS *status)
Definition imagecomp.c:39
char * imgContentDescr(imgcontent c)
Definition image.c:51
int imgWriteDICOM(IMG *img, const char *fname, TPCSTATUS *status)
Definition imagedcm.c:335
int imgRead(IMG *img, const char *fname, TPCSTATUS *status)
Definition imageio.c:82
imgformat imgFormatIdentify(const char *s)
Definition imageio.c:466
int imgCompareConc(IMG *d1, IMG *d2, const float test_abs, const float test_rel, TPCSTATUS *status)
Definition imagecomp.c:79
int imgHasTimes(IMG *img)
Definition image.c:235
int imgHasCounts(IMG *img)
Definition image.c:251
int imgMinMax(IMG *img, float *minvalue, float *maxvalue)
Definition image.c:396
int imgToSIF(IMG *img, TAC *sif, int copy_header, int copy_frames, int copy_counts, int verbose)
Definition imagesif.c:18
imgmodality
Definition tpcimage.h:56
@ IMG_MODALITY_MRI
MRI.
Definition tpcimage.h:61
@ IMG_MODALITY_CT
CT.
Definition tpcimage.h:60
@ IMG_MODALITY_SPECT
SPECT.
Definition tpcimage.h:59
@ IMG_MODALITY_LAST
End of list.
Definition tpcimage.h:62
@ IMG_MODALITY_UNKNOWN
Unknown modality.
Definition tpcimage.h:57
@ IMG_MODALITY_PET
PET.
Definition tpcimage.h:58
int imgAllocate(IMG *img, const unsigned int dimz, const unsigned int dimy, const unsigned int dimx, const unsigned int dimt, TPCSTATUS *status)
Definition image.c:126
int imgReadNifti(IMG *img, const char *fname, TPCSTATUS *status)
Definition imagenii.c:72
int imgWrite(IMG *img, const char *fname, TPCSTATUS *status)
Definition imageio.c:214
imgformat
Definition tpcimage.h:32
@ IMG_FORMAT_POLARMAP
ECAT polar map.
Definition tpcimage.h:38
@ IMG_FORMAT_E7
ECAT 7.* 3D.
Definition tpcimage.h:36
@ IMG_FORMAT_ANA_L
Analyze little-endian.
Definition tpcimage.h:40
@ IMG_FORMAT_DICOM
DICOM.
Definition tpcimage.h:34
@ IMG_FORMAT_E63
ECAT 6.3.
Definition tpcimage.h:35
@ IMG_FORMAT_INTERFILE
Interfile.
Definition tpcimage.h:41
@ IMG_FORMAT_ANA
Analyze big-endian.
Definition tpcimage.h:39
@ IMG_FORMAT_NIFTI_1D
NIfTI-1 dual-file format.
Definition tpcimage.h:42
@ IMG_FORMAT_NIFTI_2S
NIfTI-2 single-file format.
Definition tpcimage.h:45
@ IMG_FORMAT_UNKNOWN
Unknown format.
Definition tpcimage.h:33
@ IMG_FORMAT_LAST
End of list.
Definition tpcimage.h:48
@ IMG_FORMAT_E7_2D
ECAT 7.* 2D.
Definition tpcimage.h:37
@ IMG_FORMAT_NIFTI_1S
NIfTI-1 single-file format.
Definition tpcimage.h:43
@ IMG_FORMAT_MICROPET
MicroPET.
Definition tpcimage.h:46
@ IMG_FORMAT_FLAT
Flat format.
Definition tpcimage.h:47
@ IMG_FORMAT_NIFTI_2D
NIfTI-2 dual-file format.
Definition tpcimage.h:44
imgcontent
Definition tpcimage.h:70
@ IMG_CONTENT_LAST
End of list.
Definition tpcimage.h:76
@ IMG_CONTENT_RAW
Sinogram, normalization.
Definition tpcimage.h:73
@ IMG_CONTENT_UNKNOWN
Unknown data content.
Definition tpcimage.h:71
@ IMG_CONTENT_POLARMAP
Polarmap.
Definition tpcimage.h:75
@ IMG_CONTENT_IMAGE
Image data.
Definition tpcimage.h:72
@ IMG_CONTENT_ATTN
Attenuation data.
Definition tpcimage.h:74
int imgFromSIF(IMG *img, TAC *sif, int copy_header, int copy_frames, int copy_counts, int verbose)
Definition imagesif.c:126
char * imgFormatDescr(imgformat c)
Definition imageio.c:36
char * imgDefaultExtension(imgformat c)
Definition imageio.c:67
int imgXRange(IMG *img, double *xmin, double *xmax)
Definition image.c:430
int imgGetNiftiHeader(IMG *img, NIFTI_DSR *dsr, int verbose)
Definition imagenii.c:794
void imgInit(IMG *image)
Definition image.c:64
Header file for library libtpcisotope.
decaycorrection
Definition tpcisotope.h:78
isotope
Definition tpcisotope.h:50
Header file for libtpcnifti.
Header file for library libtpctac.