TPCCLIB
Loading...
Searching...
No Matches
libtpcimgio.h
Go to the documentation of this file.
1
5#ifndef _LIBTPCIMGIO_H
6#define _LIBTPCIMGIO_H
7/*****************************************************************************/
8
9/*****************************************************************************/
10#include "tpcclibConfig.h"
11/*****************************************************************************/
12//#include <omp.h>
13/*****************************************************************************/
14#include <stdio.h>
15#include <string.h>
16#include <math.h>
17#include <stdint.h>
18#include <stdlib.h>
19#include <strings.h>
20#include <ctype.h>
21#include <float.h>
22#include <unistd.h>
23#include <locale.h>
24#include <time.h>
25/* For Windows/MinGW */
26#ifdef HAVE_DIRECT_H
27#include <direct.h>
28#endif
29/*****************************************************************************/
30#include "libtpcmisc.h"
31/*****************************************************************************/
32
33/*****************************************************************************/
34#ifndef BACKUP_EXTENSION
36#define BACKUP_EXTENSION ".bak"
37#endif
38/*****************************************************************************/
39
40/*****************************************************************************/
41/* Analyze */
42
44#define ANALYZE_HEADER_KEY_SIZE 40
45#define ANALYZE_HEADER_IMGDIM_SIZE 108
46#define ANALYZE_HEADER_HISTORY_SIZE 200
47#define ANALYZE_FLIP_DEFAULT 1
49
51#define ANALYZE_DT_NONE 0
53#define ANALYZE_DT_UNKNOWN 0
55#define ANALYZE_DT_BINARY 1
57#define ANALYZE_DT_UNSIGNED_CHAR 2
59#define ANALYZE_DT_SIGNED_SHORT 4
61#define ANALYZE_DT_SIGNED_INT 8
63#define ANALYZE_DT_FLOAT 16
65#define ANALYZE_DT_COMPLEX 32
67#define ANALYZE_DT_DOUBLE 64
69#define ANALYZE_DT_RGB 128
71#define ANALYZE_DT_ALL 255
72
74extern int ANALYZE_TEST;
75
77typedef struct {
81 char data_type[10];
83 char db_name[18];
88 short int session_error;
91 char regular;
95
97typedef struct {
100 short int dim[8];
102 short int unused8;
104 short int unused9;
106 short int unused10;
108 short int unused11;
110 short int unused12;
112 short int unused13;
114 short int unused14;
122 short int datatype;
124 short int bitpix;
126 short int dim_un0;
128 float pixdim[8];
134 float funused1;
136 float funused2;
138 float funused3;
140 float cal_max;
142 float cal_min;
146 float verified;
148 int glmax;
150 int glmin;
152
154typedef struct {
156 char descrip[80];
158 char aux_file[24];
162 char orient;
164 char originator[10];
166 char generated[10];
168 char scannum[10];
170 char patient_id[10];
172 char exp_date[10];
174 char exp_time[10];
176 char hist_un0[3];
178 int views;
186 int omax;
188 int omin;
190 int smax;
192 int smin;
194
195
207/*****************************************************************************/
208
209/*****************************************************************************/
210/* ECAT 7.x */
211
212#ifndef MatBLKSIZE
214#define MatBLKSIZE 512
215#endif
216#ifndef MatFirstDirBlk
218#define MatFirstDirBlk 2
219#endif
220
222#define ECAT7V_MAGICNR "MATRIX72v"
223#define ECAT7S_MAGICNR "MATRIX7011"
224#define ECAT7_SW_VERSION 72
226
228#define ECAT7_BYTE 1
230#define ECAT7_VAXI2 2
232#define ECAT7_VAXI4 3
234#define ECAT7_VAXR4 4
236#define ECAT7_IEEER4 5
238#define ECAT7_SUNI2 6
240#define ECAT7_SUNI4 7
242#define M68K_I2 SUN_I2
244#define M68K_I4 SUN_I4
245
247#define ECAT7_UNKNOWN 0
249#define ECAT7_2DSCAN 1
251#define ECAT7_IMAGE16 2
253#define ECAT7_ATTEN 3
255#define ECAT7_2DNORM 4
257#define ECAT7_POLARMAP 5
259#define ECAT7_VOLUME8 6
261#define ECAT7_VOLUME16 7
263#define ECAT7_PROJ 8
265#define ECAT7_PROJ16 9
267#define ECAT7_IMAGE8 10
269#define ECAT7_3DSCAN 11
271#define ECAT7_3DSCAN8 12
273#define ECAT7_3DNORM 13
275#define ECAT7_3DSCANFIT 14
276
278#define ECAT7_Feet_First_Prone 0
280#define ECAT7_Head_First_Prone 1
282#define ECAT7_Feet_First_Supine 2
284#define ECAT7_Head_First_Supine 3
286#define ECAT7_Feet_First_Decubitus_Right 4
288#define ECAT7_Head_First_Decubitus_Right 5
290#define ECAT7_Feet_First_Decubitus_Left 6
292#define ECAT7_Head_First_Decubitus_Left 7
294#define ECAT7_Unknown_Orientation 8
295
297extern char ecat7errmsg[128];
299extern int ECAT7_TEST;
300
304typedef struct ecat7_mainheader { /* 512 bytes, if packed (not aligned) */
306 char magic_number[14];
310 short int sw_version;
312 short int system_type;
314 short int file_type;
334 short int wobble_speed;
344 short int coin_samp_mode;
356 char study_type[12];
358 char patient_id[16];
360 char patient_name[32];
389 short int num_planes;
391 short int num_frames;
393 short int num_gates;
395 short int num_bed_pos;
399 float bed_position[15];
403 short int lwr_sctr_thres;
405 short int lwr_true_thres;
407 short int upr_true_thres;
413 float bin_size;
420 float dosage;
424 char data_units[32];
426 short int septa_state;
428 short int fill_cti[6];
430
432typedef struct ecat7_imageheader {
434 short int data_type;
436 short int num_dimensions;
438 short int x_dimension;
440 short int y_dimension;
442 short int z_dimension;
444 float x_offset;
446 float y_offset;
448 float z_offset;
454 short int image_min;
456 short int image_max;
468 short int filter_code;
498 short int filter_order;
504 char annotation[40];
506 float mt_1_1;
508 float mt_1_2;
510 float mt_1_3;
512 float mt_2_1;
514 float mt_2_2;
516 float mt_2_3;
518 float mt_3_1;
520 float mt_3_2;
522 float mt_3_3;
528 short int rfilter_code;
530 short int rfilter_order;
536 short int zfilter_code;
538 short int zfilter_order;
540 float mt_1_4;
542 float mt_2_4;
544 float mt_3_4;
546 short int scatter_type;
548 short int recon_type;
550 short int recon_views;
552 short int fill_cti[87];
554 short int fill_user[49];
556
626
696
698typedef struct ecat7_2Dnormheader {
700 short int data_type;
702 short int num_dimensions;
704 short int num_r_elements;
706 short int num_angles;
708 short int num_z_elements;
714 float norm_min;
716 float norm_max;
724 short int storage_order;
726 short int span;
728 short int z_elements[64];
730 short int fill_cti[123];
732 short int fill_user[50];
734
736typedef struct ecat7_attenheader {
738 short int data_type;
740 short int num_dimensions;
744 short int num_r_elements;
746 short int num_angles;
748 short int num_z_elements;
762 float x_offset;
764 float y_offset;
766 float x_radius;
768 float y_radius;
786 short int storage_order;
788 short int span;
790 short int z_elements[64];
792 short int fill_cti[86];
794 short int fill_user[50];
796
798typedef struct ecat7_normheader {
800 short int data_type;
802 short int num_r_elements;
812 short int uld;
814 short int lld;
816 short int scatter_energy;
822 float ring_dtcor1[32];
824 float ring_dtcor2[32];
828 short int span;
830 short int max_ring_diff;
832 short int fill_cti[48];
834 short int fill_user[50];
836
838typedef struct ecat7_polmapheader {
840 short int data_type;
842 short int polar_map_type;
844 short int num_rings;
846 short int sectors_per_ring[32];
848 float ring_position[32];
850 short int ring_angle[32];
852 short int start_angle;
854 short int long_axis_left[3];
856 short int long_axis_right[3];
858 short int position_data;
860 short int image_min;
862 short int image_max;
874 short int quant_units;
876 char annotation[40];
888 short int fill_cti[27];
890 short int fill_user[27];
892
894typedef struct {
896 int id;
904
914
916typedef struct {
918 int frame;
920 int plane;
922 int gate;
924 int data;
926 int bed;
928/*****************************************************************************/
929
930/*****************************************************************************/
931/* ECAT 6.3 */
932
934#define MatBLKSIZE 512
936#define MatFirstDirBlk 2
937
939#define BYTE_TYPE 1
941#define VAX_I2 2
943#define VAX_I4 3
945#define VAX_R4 4
947#define IEEE_R4 5
949#define SUN_I2 6
951#define SUN_I4 7
952
954#define RAW_DATA 1
956#define IMAGE_DATA 2
958#define ATTN_DATA 3
960#define NORM_DATA 4
961
963#define ECAT63_SYSTEM_TYPE_DEFAULT 931
965extern char ecat63errmsg[128];
967extern int ECAT63_TEST;
968
970typedef struct {
979} MatDir;
980
982typedef struct {
989} MATRIXLIST;
990
992typedef struct {
994 int frame;
996 int plane;
998 int gate;
1000 int data;
1002 int bed;
1003} Matval;
1004
1006typedef struct ecat63_mainheader {
1008 char ecat_format[14];
1010 char fill1[14];
1014 short int sw_version;
1016 short int data_type;
1018 short int system_type;
1020 short int file_type;
1022 char node_id[10];
1050 short int wobble_speed;
1071 char study_name[12];
1073 char patient_id[16];
1079 char patient_age[10];
1095 short int bed_type;
1097 short int septa_type;
1102 short int num_planes;
1105 short int num_frames;
1108 short int num_gates;
1111 short int num_bed_pos;
1115 float bed_offset[15];
1129 short int fill2[20];
1131
1227
1229typedef struct ecat63_scanheader {
1231 char fill1[126];
1233 short int data_type;
1235 short int unused1[2];
1237 short int dimension_1;
1239 short int dimension_2;
1241 short int smoothing;
1245 short int unused2[3];
1249 short int unused3[8];
1259 short int unused4;
1263 short int unused5[3];
1265 short int scan_min;
1267 short int scan_max;
1277 short int unused6[52];
1279 float cor_singles[16];
1281 float uncor_singles[16];
1295 short int fill2[22];
1297
1299typedef struct ecat63_normheader {
1301 char fill1[126];
1303 short int data_type;
1305 short int unused1[2];
1307 short int dimension_1;
1309 short int dimension_2;
1311 short int unused2[23];
1316 short int unused3[6];
1320 short int unused4[85];
1322 short int norm_hour;
1324 short int unused5;
1326 short int norm_minute;
1328 short int unused6;
1330 short int norm_second;
1332 short int unused7;
1334 short int norm_day;
1336 short int unused8;
1338 short int norm_month;
1340 short int unused9;
1342 short int norm_year;
1344 short int unused10;
1346 short int unused11[58];
1348
1350typedef struct ecat63_attnheader {
1352 char fill1[126];
1354 short int data_type;
1358 short int unused1;
1360 short int dimension_1;
1362 short int dimension_2;
1364 short int unused2[23];
1382 short int unused3[149];
1384
1386typedef struct matdirnode {
1396 struct matdirnode *next;
1397} MatDirNode ;
1398
1400typedef struct matdirlist {
1407} MatDirList;
1408
1410typedef struct matrixdata {
1414 char *shptr;
1425} MatrixData ;
1426
1428typedef struct matrix_file {
1434 FILE *fptr ;
1435} Matrix_file;
1436/*****************************************************************************/
1437
1438/*****************************************************************************/
1439/* SIF */
1440
1442extern char siferrmsg[128];
1444extern int SIF_TEST;
1445
1447typedef struct {
1449 time_t scantime;
1461 double *x1;
1463 double *x2;
1465 double *prompts;
1467 double *randoms;
1469 double *trues;
1471 double *weights;
1472} SIF;
1473/*****************************************************************************/
1474
1475/*****************************************************************************/
1476/* IMG */
1477
1479#define IMG_STATUS_UNINITIALIZED 0
1481#define IMG_STATUS_INITIALIZED 1
1483#define IMG_STATUS_OCCUPIED 2
1485#define IMG_STATUS_ERROR 3
1486
1488#define IMG_ERR_OK 0
1490#define IMG_ERR_CALLING 1
1492#define IMG_ERR_OOM 2
1493
1495#define IMG_TYPE_UNKNOWN 0
1497#define IMG_TYPE_IMAGE 1
1499#define IMG_TYPE_RAW 2
1501#define IMG_TYPE_POLARMAP 3
1503#define IMG_TYPE_ATTN 4
1504
1506#define IMG_UNKNOWN 0
1508#define IMG_E63 1
1510#define IMG_E7 2
1512#define IMG_E7_2D 3
1514#define IMG_POLARMAP 9
1516#define IMG_ANA 11
1518#define IMG_ANA_L 12 /* little endian variant */
1520#define IMG_INTERFILE 21
1522#define IMG_NIFTI_1D 31 /* dual file format */
1524#define IMG_NIFTI_1S 32 /* single file format */
1526#define IMG_MICROPET 41
1528#define IMG_FLAT 61
1530#define IMG_DICOM 100
1531
1533#define IMG_DC_UNKNOWN 0
1535#define IMG_DC_CORRECTED 1
1537#define IMG_DC_NONCORRECTED 2
1538
1540#define IMG_MODALITY_UNKNOWN 0
1542#define IMG_MODALITY_PET 1
1544#define IMG_MODALITY_MRI 2
1546#define IMG_MODALITY_CT 3
1548#define IMG_MODALITY_SPECT 4
1549
1551#define SCANNER_UNKNOWN 0
1553#define SCANNER_ECAT931 12
1555#define SCANNER_ADVANCE 12096
1557#define SCANNER_HRPLUS 3
1559#define SCANNER_HRRT 4
1560/* these may change later */
1562#define SCANNER_MRI 5
1564#define SCANNER_STEVCT_PET 6
1566#define SCANNER_STEVCT_CT 7
1568#define SCANNER_DMI_PET 8
1569/* Concorde/MicropET scanners */
1571#define SCANNER_PRIMATE 2000
1573#define SCANNER_RODENT 2001
1575#define SCANNER_MICROPET2 2002
1577#define SCANNER_FOCUS_220 2500
1579#define SCANNER_FOCUS_120 2501
1581#define SCANNER_INVEON_DEDICATED_PET 5000
1583#define SCANNER_INVEON_MM_PET 5500
1585#define SCANNER_MR_PET_HEAD_INSERT 6000
1587#define SCANNER_TUEBINGEN_PET_MR 8000
1588
1590#define MAX_POLARMAP_NUM_RINGS 32
1591
1593enum {STATUS_OK,STATUS_FAULT,STATUS_NOMEMORY,STATUS_NOFILE,STATUS_UNKNOWNFORMAT,
1594 STATUS_UNSUPPORTED,STATUS_MISSINGMATRIX,STATUS_NOWRITEPERM,STATUS_DISKFULL,
1595 STATUS_NOMATLIST,STATUS_INVALIDMATLIST,STATUS_VARMATSIZE,STATUS_NOMAINHEADER,
1596 STATUS_NOSUBHEADER, STATUS_NOMATRIX, STATUS_UNSUPPORTEDAXIALCOMP,
1597 STATUS_NOIMGDATAFILE, STATUS_NOHEADERFILE, STATUS_INVALIDHEADER,
1598 STATUS_NOIMGDATA, STATUS_NOSIFDATA, STATUS_WRONGSIFDATA,
1599 STATUS_CANTWRITEIMGFILE, STATUS_CANTWRITEHEADERFILE, STATUS_WRONGFILETYPE,
1600 STATUS_CANNOTERASE, STATUS_CANNOTREAD, STATUS_CANNOTWRITE,
1601 STATUS_UNSUPPORTEDPOLARMAP, STATUS_INVALIDPOLARMAP};
1602
1604extern int IMG_TEST;
1605
1607typedef struct {
1609 int x;
1611 int y;
1613 int z;
1615 int f;
1616} IMG_PIXEL;
1617
1619typedef struct {
1621 long long int pxlNr;
1623 long long int _pxlNr;
1626} IMG_PIXELS;
1627
1629typedef struct {
1631 int x1;
1633 int x2;
1635 int y1;
1637 int y2;
1639 int z1;
1641 int z2;
1643 int f1;
1645 int f2;
1646} IMG_RANGE;
1647
1649typedef struct {
1651 int x;
1653 int y;
1655 int z;
1657 int t;
1658} VOXEL_4D;
1659
1661typedef struct {
1662
1663 /*
1664 * State of image
1665 */
1671 const char *statmsg;
1672
1673 /*
1674 * Information on the study
1675 */
1677 char unit;
1683 char patientName[32];
1685 char patientID[16];
1703
1704 /*
1705 * Information on the image
1706 */
1708 char type;
1710 float zoom;
1718 float sizex;
1720 float sizey;
1722 float sizez;
1724 float gapx;
1726 float gapy;
1728 float gapz;
1745 short int xform[2];
1748 float quatern[18];
1751 float mt[12];
1754
1755 /*
1756 * Definitions for polar map
1757 */
1776
1777 /*
1778 * Image data
1779 */
1780 /* Dimensions */
1782 unsigned short int dimt;
1784 unsigned short int dimx;
1786 unsigned short int dimy;
1788 unsigned short int dimz;
1790
1791 float *_pxl;
1793 float **_col;
1795 float ***_row;
1797 float ****_pln;
1799 float *_header;
1801 /* Pointers for data to be used */
1803 float ****m;
1805 float ****plane;
1807 float ***row;
1809 float **column;
1811 float *pixel;
1814
1815 /*
1816 * Frame times
1817 */
1819 float *start;
1821 float *end;
1823 float *mid;
1824
1825 /*
1826 * Frame weights
1827 */
1831 float *weight;
1833 float *sd;
1835 float *prompts;
1837 float *randoms;
1838
1839 /*
1840 * Decay correction factors for each frame
1841 */
1844
1847
1848} IMG;
1849/*****************************************************************************/
1850
1851/*****************************************************************************/
1852/* IMG units (deprecated) */
1854#define IMGUNIT_UNKNOWN CUNIT_UNKNOWN
1855#define IMGUNIT_CPS CUNIT_CPS
1856#define IMGUNIT_COUNTS CUNIT_COUNTS
1857#define IMGUNIT_KBQ_PER_ML CUNIT_KBQ_PER_ML
1858#define IMGUNIT_SEC_KBQ_PER_ML CUNIT_SEC_KBQ_PER_ML
1859#define IMGUNIT_PER_SEC CUNIT_PER_SEC
1860#define IMGUNIT_PER_MIN CUNIT_PER_MIN
1861#define IMGUNIT_ML_PER_ML CUNIT_ML_PER_ML
1862#define IMGUNIT_ML_PER_DL CUNIT_ML_PER_DL
1863#define IMGUNIT_ML_PER_ML_PER_MIN CUNIT_ML_PER_ML_PER_MIN
1864#define IMGUNIT_ML_PER_DL_PER_MIN CUNIT_ML_PER_DL_PER_MIN
1865#define IMGUNIT_UNITLESS CUNIT_UNITLESS
1866#define IMGUNIT_NCI_PER_ML CUNIT_NCI_PER_ML
1867#define IMGUNIT_MBQ_PER_ML CUNIT_MBQ_PER_ML
1868#define IMGUNIT_BQ_PER_ML CUNIT_BQ_PER_ML
1869#define IMGUNIT_UCI_PER_ML CUNIT_UCI_PER_ML
1870#define IMGUNIT_UMOL_PER_MIN_PER_100G CUNIT_UMOL_PER_MIN_PER_100G
1871#define IMGUNIT_MG_PER_MIN_PER_100G CUNIT_MG_PER_MIN_PER_100G
1873/*****************************************************************************/
1874
1875/*****************************************************************************/
1876/* Definitions for VOL, structure for 3D image volume */
1877
1879extern int VOL_TEST;
1880
1882typedef struct {
1884 int x;
1886 int y;
1888 int z;
1889} VOL_PIXEL;
1890
1892typedef struct {
1894 int x1;
1896 int x2;
1898 int y1;
1900 int y2;
1902 int z1;
1904 int z2;
1905} VOL_RANGE;
1906
1908typedef struct {
1912 char *statmsg;
1916 float sizex;
1918 float sizey;
1920 float sizez;
1922 unsigned short int dimx;
1924 unsigned short int dimy;
1926 unsigned short int dimz;
1928
1929 float *_vxl;
1931 float *_col;
1933 float **_row;
1935 float ***_pln;
1937
1938 float ***v;
1940 float ***plane;
1942 float **row;
1944 float *column;
1946 float *voxel;
1947} VOL;
1948
1950typedef struct {
1954 char *statmsg;
1958 float sizex;
1960 float sizey;
1962 float sizez;
1964 unsigned short int dimx;
1966 unsigned short int dimy;
1968 unsigned short int dimz;
1972
1973 short int *_vxl;
1975 short int *_col;
1977 short int **_row;
1979 short int ***_pln;
1981
1982 short int ***v;
1984 short int ***plane;
1986 short int **row;
1988 short int *column;
1990 short int *voxel;
1991} SVOL;
1992/*****************************************************************************/
1993
1994/*****************************************************************************/
1995/* MicroPET */
1996#ifndef MAX_MICROPET_LINE_LEN
1998#define MAX_MICROPET_LINE_LEN 1024
1999#endif
2001extern int MICROPET_TEST;
2002/*****************************************************************************/
2003
2004/*****************************************************************************/
2005/* NifTI */
2006
2008#define NIFTI_HEADER_SIZE 348
2010#define NIFTI_HEADER_EXTENDER_SIZE 4
2011
2013#define NIFTI_UNITS_UNKNOWN 0
2015#define NIFTI_UNITS_METER 1
2017#define NIFTI_UNITS_MM 2
2019#define NIFTI_UNITS_MICRON 4
2021#define NIFTI_UNITS_SEC 8
2023#define NIFTI_UNITS_MSEC 16
2025#define NIFTI_UNITS_USEC 24
2027#define NIFTI_UNITS_HERTZ 32
2029#define NIFTI_UNITS_PPM 40
2031#define NIFTI_UNITS_RADS 48
2032
2033
2035#define NIFTI_DT_NONE 0
2037#define NIFTI_DT_UNKNOWN 0
2039#define NIFTI_DT_BINARY 1
2041#define NIFTI_DT_UNSIGNED_CHAR 2
2043#define NIFTI_DT_SIGNED_SHORT 4
2045#define NIFTI_DT_SIGNED_INT 8
2047#define NIFTI_DT_FLOAT 16
2049#define NIFTI_DT_COMPLEX 32
2051#define NIFTI_DT_DOUBLE 64
2053#define NIFTI_DT_RGB 128
2055#define NIFTI_DT_ALL 255
2057#define NIFTI_DT_SIGNED_CHAR 256
2059#define NIFTI_DT_UNSIGNED_SHORT 512
2061#define NIFTI_DT_UNSIGNED_INT 768
2063#define NIFTI_DT_LONG_LONG 1024
2065#define NIFTI_DT_UNSIGNED_LONG_LONG 1280
2067#define NIFTI_DT_LONG_DOUBLE 1536
2069#define NIFTI_DT_DOUBLE_PAIR 1792
2071#define NIFTI_DT_LONG_DOUBLE_PAIR 2048
2073#define NIFTI_DT_RGBA 2304
2074
2075
2077#define NIFTI_INTENT_NONE 0
2079#define NIFTI_INTENT_CORREL 2
2081#define NIFTI_INTENT_TTEST 3
2083#define NIFTI_INTENT_FTEST 4
2085#define NIFTI_INTENT_ZSCORE 5
2087#define NIFTI_INTENT_CHISQ 6
2089#define NIFTI_INTENT_BETA 7
2091#define NIFTI_INTENT_BINOM 8
2093#define NIFTI_INTENT_GAMMA 9
2095#define NIFTI_INTENT_POISSON 10
2097#define NIFTI_INTENT_NORMAL 11
2099#define NIFTI_INTENT_FTEST_NONC 12
2101#define NIFTI_INTENT_CHISQ_NONC 13
2103#define NIFTI_INTENT_LOGISTIC 14
2105#define NIFTI_INTENT_LAPLACE 15
2107#define NIFTI_INTENT_UNIFORM 16
2109#define NIFTI_INTENT_TTEST_NONC 17
2111#define NIFTI_INTENT_WEIBULL 18
2113#define NIFTI_INTENT_CHI 19
2115#define NIFTI_INTENT_INVGAUSS 20
2117#define NIFTI_INTENT_EXTVAL 21
2119#define NIFTI_INTENT_PVAL 22
2121#define NIFTI_INTENT_LOGPVAL 23
2123#define NIFTI_INTENT_LOG10PVAL 24
2125#define NIFTI_INTENT_ESTIMATE 1001
2127#define NIFTI_INTENT_LABEL 1002
2129#define NIFTI_INTENT_NEURONAME 1003
2131#define NIFTI_INTENT_GENMATRIX 1004
2133#define NIFTI_INTENT_SYMMATRIX 1005
2135#define NIFTI_INTENT_DISPVECT 1006
2137#define NIFTI_INTENT_VECTOR 1007
2139#define NIFTI_INTENT_POINTSET 1008
2141#define NIFTI_INTENT_TRIANGLE 1009
2143#define NIFTI_INTENT_QUATERNION 1010
2145#define NIFTI_INTENT_DIMLESS 1011
2146
2148#define NIFTI_XFORM_UNKNOWN 0
2150#define NIFTI_XFORM_SCANNER_ANAT 1
2152#define NIFTI_XFORM_ALIGNED_ANAT 2
2154#define NIFTI_XFORM_TALAIRACH 3
2156#define NIFTI_XFORM_MNI_152 4
2157
2158
2159
2161typedef struct {
2165 char data_type[10];
2167 char db_name[18];
2171 short int session_error;
2176
2180 short int dim[8];
2188 short int intent_code;
2190 short int datatype;
2192 short int bitpix;
2194 short int slice_start;
2196 float pixdim[8];
2204 short int slice_end;
2210 float cal_max;
2212 float cal_min;
2216 float toffset;
2221
2223 char descrip[80];
2225 char aux_file[24];
2228 short int qform_code;
2230 short int sform_code;
2244 float srow_x[4];
2246 float srow_y[4];
2248 float srow_z[4];
2250 char intent_name[16];
2254 char magic[4];
2256
2260typedef struct {
2264 char extension[4];
2266
2276/*****************************************************************************/
2277
2278/*****************************************************************************/
2279/* analyze */
2280extern int anaExists(const char *dbname);
2281extern int anaExistsNew(const char *dbname, char *hdrfile, char *imgile, char *siffile);
2282extern int anaRemove(const char *dbname);
2283extern void anaRemoveFNameExtension(char *fname);
2284extern int anaDatabaseExists(const char *dbname, char *hdrfile, char *imgfile, char *siffile);
2285extern int anaMakeSIFName(const char *dbname, char *siffile);
2286extern int anaFlipping();
2287extern int anaReadHeader(char *filename, ANALYZE_DSR *h);
2288extern int anaReadImagedata(FILE *fp, ANALYZE_DSR *h, int frame, float *data);
2289extern int anaWriteHeader(char *filename, ANALYZE_DSR *h);
2290extern int anaPrintHeader(ANALYZE_DSR *h, FILE *fp);
2291extern int anaEditHeader(ANALYZE_DSR *h, char *field, char *value);
2292/*****************************************************************************/
2293
2294/*****************************************************************************/
2295/* ecat7 */
2296
2297/* Read functions */
2298extern int ecat7ReadMainheader(FILE *fp, ECAT7_mainheader *h);
2299extern int ecat7ReadImageheader(FILE *fp, int blk, ECAT7_imageheader *h);
2300extern int ecat7ReadAttenheader(FILE *fp, int blk, ECAT7_attenheader *h);
2301extern int ecat7ReadPolmapheader(FILE *fp, int blk, ECAT7_polmapheader *h);
2302extern int ecat7ReadNormheader(FILE *fp, int blk, ECAT7_normheader *h);
2303extern int ecat7ReadScanheader(FILE *fp, int blk, ECAT7_scanheader *h);
2304extern int ecat7Read2DScanheader(FILE *fp, int blk, ECAT7_2Dscanheader *h);
2305extern int ecat7Read2DNormheader(FILE *fp, int blk, ECAT7_2Dnormheader *h);
2306extern int ecat7ReadMatrixdata(FILE *fp, int start_block, int block_nr, char *data, int dtype);
2307extern float ecat7rFloat(void *bufi, int isvax, int islittle);
2308extern int ecat7rInt(void *bufi, int isvax, int islittle);
2309extern int ecat7ReadImageMatrix(FILE *fp, int first_block, int last_block,
2310 ECAT7_imageheader *h, float **fdata);
2311extern int ecat7Read2DScanMatrix(FILE *fp, int first_block, int last_block,
2312 ECAT7_2Dscanheader *h, float **fdata);
2313extern int ecat7ReadScanMatrix(FILE *fp, int first_block, int last_block,
2314 ECAT7_scanheader *h, float **fdata);
2315extern int ecat7ReadPolarmapMatrix(FILE *fp, int first_block, int last_block,
2316 ECAT7_polmapheader *h, float **fdata);
2317extern int ecat7pxlbytes(short int data_type);
2318
2319/* Matrix list functions */
2320extern void ecat7InitMatlist(ECAT7_MATRIXLIST *mlist);
2321extern void ecat7EmptyMatlist(ECAT7_MATRIXLIST *mlist);
2322extern int ecat7ReadMatlist(FILE *fp, ECAT7_MATRIXLIST *ml, int verbose);
2323extern void ecat7PrintMatlist(ECAT7_MATRIXLIST *ml);
2324extern int ecat7EnterMatrix(FILE *fp, int matrix_id, int block_nr);
2325extern int ecat7_val_to_id(int frame, int plane, int gate, int data, int bed);
2326extern void ecat7_id_to_val(int matrix_id, ECAT7_Matval *matval);
2329extern int ecat7CheckMatlist(ECAT7_MATRIXLIST *ml);
2330extern int ecat7DeleteLateFrames(ECAT7_MATRIXLIST *ml, int frame_nr);
2331extern int ecat7GetPlaneAndFrameNr(
2332 ECAT7_MATRIXLIST *mlist, ECAT7_mainheader *h, int *plane_nr, int *frame_nr);
2333extern int ecat7GetMatrixBlockSize(ECAT7_MATRIXLIST *mlist, int *blk_nr);
2334extern int ecat7GetNums(ECAT7_MATRIXLIST *ml, ECAT7_mainheader *mh, FILE *fp,
2335 short int *num_planes, short int *num_frames, short int *num_gates, short int *num_bed_pos);
2336extern int ecat7GatherMatlist(ECAT7_MATRIXLIST *ml, short int do_planes,
2337 short int do_frames, short int do_gates, short int do_beds);
2338
2339/* Write functions */
2340extern int ecat7WriteMainheader(FILE *fp, ECAT7_mainheader *h);
2341extern int ecat7WriteImageheader(FILE *fp, int blk, ECAT7_imageheader *h);
2342extern int ecat7WriteAttenheader(FILE *fp, int blk, ECAT7_attenheader *h);
2343extern int ecat7WritePolmapheader(FILE *fp, int blk, ECAT7_polmapheader *h);
2344extern int ecat7WriteNormheader(FILE *fp, int blk, ECAT7_normheader *h);
2345extern int ecat7WriteScanheader(FILE *fp, int blk, ECAT7_scanheader *h);
2346extern int ecat7Write2DScanheader(FILE *fp, int blk, ECAT7_2Dscanheader *h);
2347extern int ecat7Write2DNormheader(FILE *fp, int blk, ECAT7_2Dnormheader *h);
2348extern int ecat7WritePolarmapMatrix(FILE *fp, int matrix_id, ECAT7_polmapheader *h, float *fdata);
2349extern int ecat7WriteMatrixdata(FILE *fp, int start_block, char *data, long long pxl_nr, int pxl_size);
2350/*extern void ecat7wFloat(float *bufi, void *bufo, int tovax, int islittle);*/
2351/*extern void ecat7wInt(int *bufi, void *bufo, int tovax, int islittle);*/
2352extern FILE *ecat7Create(const char *fname, ECAT7_mainheader *h);
2353extern int ecat7WriteImageMatrix(FILE *fp, int matrix_id, ECAT7_imageheader *h, float *fdata);
2354extern int ecat7Write2DScanMatrix(FILE *fp, int matrix_id, ECAT7_2Dscanheader *h, float *fdata);
2355extern int ecat7WriteScanMatrix(FILE *fp, int matrix_id, ECAT7_scanheader *h, float *fdata);
2356extern int ecat7_is_scaling_needed(float amax, float *data, long long nr);
2357
2358/* Printing functions */
2359extern void ecat7PrintMainheader(ECAT7_mainheader *h, FILE *fp);
2360extern void ecat7PrintImageheader(ECAT7_imageheader *h, FILE *fp);
2361extern void ecat7PrintScanheader(ECAT7_scanheader *h, FILE *fp);
2362extern void ecat7PrintAttenheader(ECAT7_attenheader *h, FILE *fp);
2363extern void ecat7PrintPolmapheader(ECAT7_polmapheader *h, FILE *fp);
2364extern void ecat7PrintNormheader(ECAT7_normheader *h, FILE *fp);
2365extern void ecat7Print2DScanheader(ECAT7_2Dscanheader *h, FILE *fp);
2366extern void ecat7Print2DNormheader(ECAT7_2Dnormheader *h, FILE *fp);
2367extern int ecat7PrintSubheader(ECAT7_mainheader mh, FILE *fp, int plane, int frame, FILE *ofp);
2368
2369/* Descriptive strings for printing */
2370extern char* ecat7filetype(short int file_type);
2371extern char* ecat7acquisitiontype(short int acquisition_type);
2372extern char* ecat7datatype(short int data_type);
2373
2374/* Header edit functions */
2375extern int ecat7EditMHeader(ECAT7_mainheader *h, char *field, char *value, int verbose);
2376extern int ecat7EditSHeader(ECAT7_scanheader *h, char *field, char *value, int verbose);
2377extern int ecat7EditVHeader(ECAT7_imageheader *h, char *field, char *value, int verbose);
2378/*****************************************************************************/
2379
2380/*****************************************************************************/
2381/* ECAT 6.3 */
2382
2383/* ECAT 6.3 Read functions */
2384extern int ecat63ReadMainheader(FILE *fp, ECAT63_mainheader *h);
2385extern int ecat63ReadImageheader(FILE *fp, int blk, ECAT63_imageheader *h, int verbose, char *errmsg);
2386extern int ecat63ReadScanheader(FILE *fp, int blk, ECAT63_scanheader *h, int verbose, char *errmsg);
2387extern int ecat63ReadAttnheader(FILE *fp, int blk, ECAT63_attnheader *h, int verbose, char *errmsg);
2388extern int ecat63ReadNormheader(FILE *fp, int blk, ECAT63_normheader *h, int verbose, char *errmsg);
2389extern int ecat63ReadMatdata(FILE *fp, int strtblk, int blkNr, char *data, int dtype);
2390extern int ecat63ReadImageMatrix(FILE *fp, int strtblk, int lastblk, ECAT63_imageheader *h, float **f);
2391extern int ecat63ReadScanMatrix(FILE *fp, int strtblk, int lastblk, ECAT63_scanheader *h, float **f);
2392extern int ecat63ReadAttnMatrix(FILE *fp, int strtblk, int lastblk, ECAT63_attnheader *h, float **f);
2393extern float ecat63rFloat(void *bufi, int isvax, int islittle);
2394extern int ecat63rInt(void *bufi, int isvax, int islittle);
2395extern int ecat63pxlbytes(short int data_type);
2396
2397/* ECAT 6.3 Matrix list functions */
2398extern void ecat63InitMatlist(MATRIXLIST *mlist);
2399extern void ecat63EmptyMatlist(MATRIXLIST *mlist);
2400extern int ecat63ReadMatlist(FILE *fp, MATRIXLIST *ml, int verbose);
2401extern void ecat63PrintMatlist(MATRIXLIST *ml);
2402extern int mat_numcod(int frame, int plane, int gate, int data, int bed);
2403extern void mat_numdoc(int matnum, Matval *matval);
2404extern int ecat63Matenter(FILE *fp, int matnum, int blkNr);
2405extern void ecat63SortMatlistByPlane(MATRIXLIST *ml);
2406extern void ecat63SortMatlistByFrame(MATRIXLIST *ml);
2407extern int ecat63CheckMatlist(MATRIXLIST *ml);
2408extern int ecat63DeleteLateFrames(MATRIXLIST *ml, int frame_nr);
2409extern int ecat63GetMatrixBlockSize(MATRIXLIST *mlist, int *blk_nr);
2410extern int ecat63GetPlaneAndFrameNr(
2411 MATRIXLIST *mlist, ECAT63_mainheader *h, int *plane_nr, int *frame_nr);
2412extern int ecat63GetNums(
2413 MATRIXLIST *ml, short int *num_planes, short int *num_frames,
2414 short int *num_gates, short int *num_bed_pos);
2415extern int ecat63GatherMatlist(
2416 MATRIXLIST *ml, short int do_planes, short int do_frames,
2417 short int do_gates, short int do_beds);
2418
2419/* ECAT 6.3 Write functions */
2420extern int ecat63WriteMainheader(FILE *fp, ECAT63_mainheader *h);
2421extern int ecat63WriteImageheader(FILE *fp, int block, ECAT63_imageheader *h);
2422extern int ecat63WriteScanheader(FILE *fp, int block, ECAT63_scanheader *h);
2423extern int ecat63WriteAttnheader(FILE *fp, int block, ECAT63_attnheader *h);
2424extern int ecat63WriteNormheader(FILE *fp, int block, ECAT63_normheader *h);
2425extern FILE *ecat63Create(const char *fname, ECAT63_mainheader *h);
2426extern int ecat63WriteMatdata(FILE *fp, int strtblk, char *data, long long pxlNr, int pxlSize);
2427extern int ecat63WriteScan(FILE *fp, int matnum, ECAT63_scanheader *h, void *data);
2428extern int ecat63WriteImage(FILE *fp, int matnum, ECAT63_imageheader *h, void *data);
2429extern int ecat63WriteNorm(FILE *fp, int matnum, ECAT63_normheader *h, void *data);
2430extern int ecat63WriteAttn(FILE *fp, int matnum, ECAT63_attnheader *h, void *data);
2431extern int ecat63WriteImageMatrix(FILE *fp, int matnum, ECAT63_imageheader *h, float *fdata);
2432extern int ecat63WriteScanMatrix(FILE *fp, int matnum, ECAT63_scanheader *h, float *fdata);
2433extern void ecat63wFloat(float *bufi, void *bufo, int tovax, int islittle);
2434extern void ecat63wInt(int *bufi, void *bufo, int tovax, int islittle);
2435extern int ecat63_is_scaling_needed(float amax, float *data, long long nr);
2436extern struct tm* ecat63ScanstarttimeToTm(const ECAT63_mainheader *h, struct tm *tm);
2437extern time_t ecat63Scanstarttime(const ECAT63_mainheader *h);
2438
2439/* ECAT 6.3 Printing functions */
2440extern void ecat63PrintMainheader(ECAT63_mainheader *h, FILE *fp);
2441extern void ecat63PrintImageheader(ECAT63_imageheader *h, FILE *fp);
2442extern void ecat63PrintScanheader(ECAT63_scanheader *h, FILE *fp);
2443extern void ecat63PrintAttnheader(ECAT63_attnheader *h, FILE *fp);
2444extern void ecat63PrintNormheader(ECAT63_normheader *h, FILE *fp);
2445extern int ecat6PrintSubheader(ECAT63_mainheader mh, FILE *fp, int plane, int frame, FILE *ofp);
2446extern char *ecat63Datatype(short int dtype);
2447extern char *ecat63Unit(short int dunit);
2448extern void float2parts(float *buf);
2449extern char* ecat63ScanstarttimeInt(const ECAT63_mainheader *h, char *buf);
2450
2451/* Header edit functions */
2454extern int ecat63EditMHeader(ECAT63_mainheader *h, char *field, char *value, int verbose);
2455/*****************************************************************************/
2456
2457/*****************************************************************************/
2458/* IMG data functions */
2459
2460/* Initialization and memory handling of img data */
2461extern void imgInit(IMG *image);
2462extern void imgEmpty(IMG *image);
2463extern int imgAllocate(IMG *image, int planes, int rows, int columns, int frames);
2464extern int imgAllocateWithHeader(IMG *image, int planes, int rows, int columns, int frames, IMG *image_from);
2465extern int imgDup(IMG *img1, IMG *img2);
2466
2467/* Retrieving image information */
2468extern char *imgStatus(int status_index);
2469extern void imgSetStatus(IMG *img, int status_index);
2470extern void imgInfo(IMG *image);
2471extern int imgCopyhdr(IMG *image1, IMG *image2);
2472extern int imgExtractRange(IMG *img1, IMG_RANGE r, IMG *img2);
2473extern int imgExistentTimes(IMG *img);
2474extern int imgExistentCounts(IMG *img);
2475extern unsigned long long imgNaNs(IMG *img, int fix);
2476/*****************************************************************************/
2477
2478/*****************************************************************************/
2479/* IMG vs SIF */
2480extern int sif2img(
2481 SIF *sif, IMG *img, int copy_header, int copy_frames, int copy_counts, int verbose
2482);
2483extern int img2sif(
2484 IMG *img, SIF *sif, int copy_header, int copy_frames, int copy_counts, int verbose
2485);
2486/*****************************************************************************/
2487
2488/*****************************************************************************/
2489/* IMG decay correction */
2490extern int imgDecayCorrection(IMG *img, int mode);
2491extern char *imgIsotope(IMG *img);
2492extern int imgSetDecayCorrFactors(IMG *image, int mode);
2493extern int imgBranchingCorrection(IMG *image, int mode, int verbose, char *status);
2494/*****************************************************************************/
2495
2496/*****************************************************************************/
2497/* IMG file i/o */
2498
2499/* General */
2500extern int imgRead(const char *fname, IMG *img);
2501//int extern imgReadMainHeader(const char *fname, IMG *img);
2502extern int imgWrite(const char *fname, IMG *img);
2503extern int imgReadHeader(const char *fname, IMG *img, int format);
2504//extern int imgReadNextFrame(char *fname, IMG *img);
2505extern int imgReadFrame(const char *fname, int frame_to_read, IMG *img, int frame_index);
2506extern int imgWriteFrame(const char *fname, int frame_to_write, IMG *img, int frame_index);
2507extern void imgFormatFromFName(IMG *img, const char *fname);
2508extern int imgFormatDetermine(
2509 const char *fname, char *basename, char *hdrfile, char *imgfile, char *siffile, int *file_format,
2510 int *scanner, int *type, int *modality, int verbose
2511);
2512
2513/* ECAT 6.3 and IMG */
2514extern int ecat63ReadAllToImg(const char *fname, IMG *img);
2515extern int ecat63WriteAllImg(const char *fname, IMG *img);
2516extern int ecat63ReadPlaneToImg(const char *fname, IMG *img);
2517extern int ecat63AddImg(const char *fname, IMG *img);
2518extern void imgGetEcat63MHeader(IMG *img, ECAT63_mainheader *h);
2519extern void imgSetEcat63MHeader(IMG *img, ECAT63_mainheader *h);
2522extern int imgReadEcat63Header(const char *fname, IMG *img);
2523extern int imgReadEcat63FirstFrame(const char *fname, IMG *img);
2524extern int imgReadEcat63Frame(const char *fname, int frame_to_read, IMG *img, int frame_index);
2525extern int imgWriteEcat63Frame(const char *fname, int frame_to_write, IMG *img, int frame_index);
2526extern void imgSetEcat63SHeader(IMG *img, void *h);
2527
2528/* ECAT 7.x and IMG */
2529extern int imgReadEcat7(const char *fname, IMG *img);
2530extern int imgWriteEcat7(const char *fname, IMG *img);
2531extern int imgWrite2DEcat7(const char *fname, IMG *img);
2532extern int imgWritePolarmap(const char *fname, IMG *img);
2533
2534extern void imgGetEcat7MHeader(IMG *img, ECAT7_mainheader *h);
2535extern void imgSetEcat7MHeader(IMG *img, ECAT7_mainheader *h);
2536extern int imgReadEcat7Header(const char *fname, IMG *img);
2537extern int imgEcat7Supported(ECAT7_mainheader *h);
2538extern int imgReadEcat7Frame(const char *fname, int frame_to_read, IMG *img, int frame_index);
2539extern int imgReadEcat7FirstFrame(const char *fname, IMG *img);
2541extern int imgWriteEcat7Frame(const char *fname, int frame_to_write, IMG *img, int frame_index);
2542extern void imgSetEcat7SHeader(IMG *img, void *h);
2543
2544/* Analyze format and IMG */
2545extern int imgReadAnalyze(const char *dbname, IMG *img);
2546extern int imgWriteAnalyze(const char *dbname, IMG *img);
2547extern int imgReadAnalyzeHeader(const char *dbname, IMG *img);
2548extern int imgGetAnalyzeHeader(IMG *img, ANALYZE_DSR *h);
2549extern int imgSetAnalyzeHeader(IMG *img, const char *dbname, ANALYZE_DSR *h, float fmin, float fmax);
2550extern int imgReadAnalyzeFrame(const char *dbname, int frame_to_read, IMG *img, int frame_index);
2551extern int imgReadAnalyzeFirstFrame(const char *fname, IMG *img);
2552extern int imgWriteAnalyzeFrame(
2553 const char *fname, int frame_to_write, IMG *img, int frame_index, float fmin, float fmax
2554);
2555
2556/* MicroPET format and IMG */
2557extern int imgMicropetToEcat7(char *upetname, char *ecatfile, int verbose);
2558extern int imgMicropetPETToEcat7(FILE *fph, FILE *fpi, char *ecatfile, int verbose);
2559extern int imgMicropetCTToEcat7(FILE *fph, FILE *fpi, char *ecatfile, int verbose);
2560extern int imgGetMicropetMainHeader(FILE *fp, IMG *img, float *calibration_factor, int verbose);
2561extern int imgGetMicropetFrameHeader(FILE *fp, IMG *img, int frame_index, int verbose);
2562extern int imgGetMicropetSIF(FILE *fp, SIF *sif);
2563extern int imgGetMicropetHeader(IMG *img);
2564extern int imgReadMicropetHeader(const char *dbname, IMG *img);
2565extern int imgReadMicropetFrame(const char *fname, int frame_to_read, IMG *img, int frame_index);
2566extern int imgReadMicropetFirstFrame(const char *fname, IMG *img);
2567extern int imgReadMicropet(const char *fname, IMG *img);
2568
2569/* NifTI and IMG */
2570extern int imgReadNifti(const char *filename, IMG *img, int verbose);
2571extern int imgReadNiftiFirstFrame(const char *filename, IMG *img, int verbose);
2572extern int imgReadNiftiHeader(const char *filename, IMG *img, int verbose);
2573extern int imgGetNiftiHeader(IMG *img, NIFTI_DSR *h, int verbose);
2574extern int imgReadNiftiFrame(
2575 const char *filename, int frame_to_read, IMG *img, int frame_index, int verbose
2576);
2577extern int imgSetNiftiHeader(
2578 IMG *img, const char *dbname, NIFTI_DSR *dsr, float fmin, float fmax, int verbose
2579);
2580extern int imgWriteNiftiFrame(
2581 const char *dbname, int frame_to_write, IMG *img, int frame_index,
2582 float fmin, float fmax, int verbose
2583);
2584extern int imgWriteNifti(const char *dbname, IMG *img, int save_sif, int verbose);
2585/*****************************************************************************/
2586
2587/*****************************************************************************/
2588/* imgcomp */
2589extern int imgMatch(IMG *img1, IMG *img2, float accuracy);
2590extern int imgMatchMatrix(IMG *img1, IMG *img2, double accuracy);
2591extern int imgMatchHeader(IMG *img1, IMG *img2);
2592extern int imgMatchTransform(IMG *img1, IMG *img2);
2593extern int imgMatchFrames(IMG *img1, IMG *img2);
2594extern int imgMatchPlanes(IMG *img1, IMG *img2);
2595extern int imgMaxDifference(
2596 IMG *img1, IMG *img2, VOXEL_4D *absdiff, float *abs_max, VOXEL_4D *reldiff, float *rel_max
2597);
2598extern int imgSS(IMG *img1, IMG *img2, double *ss);
2599extern int imgMatchMatrixSize(IMG *img1, IMG *img2);
2600/*****************************************************************************/
2601
2602/*****************************************************************************/
2603/* imgminmax */
2604extern int imgMax(IMG *img, float *maxvalue);
2605extern int imgAbsMax(IMG *img, float *maxvalue);
2606extern int imgRangeMinMax(
2607 IMG *img, IMG_RANGE *r, IMG_PIXEL *maxp, float *maxv, IMG_PIXEL *minp, float *minv
2608);
2609extern int imgMinMax(IMG *img, float *minvalue, float *maxvalue);
2610extern int imgFrameMinMax(IMG *img, int frame, float *minvalue, float *maxvalue);
2611extern int imgReadMinMax(const char *fname, float *fmin, float *fmax);
2612extern int imgSmoothMax(IMG *img, float *maxvalue, IMG_PIXEL *p);
2613extern int imgGetPeak(IMG *img, float beforeTime, IMG_PIXEL *p, int verbose);
2614extern int imgGetMaxFrame(IMG *img, IMG *mimg, int verbose);
2615extern int imgGetMaxTime(IMG *img, IMG *mimg, const int w, int verbose);
2616extern int imgAvg(IMG *img, IMG_RANGE *r, float *avg);
2617extern float f_kth_smallest(float *data, long long int n, long long int k);
2618extern float fmedian(float *data, long long int n);
2619extern float fmean(float *data, long long int n, float *sd);
2620extern void fMinMaxFin(float *data, long long int n, float *fmin, float *fmax);
2621/*****************************************************************************/
2622
2623/*****************************************************************************/
2624/* imgunits */
2625extern int imgUnitId(char *unit);
2626extern void imgUnitFromEcat(IMG *img, int ecat_unit);
2627extern void imgUnitFromEcat7(IMG *img, ECAT7_mainheader *h);
2628extern int imgUnitToEcat6(IMG *img);
2629extern void imgUnitToEcat7(IMG *img, ECAT7_mainheader *h);
2630extern char *imgUnit(int dunit);
2631extern int imgSetUnit(IMG *img, char *unit);
2632/*****************************************************************************/
2633
2634/*****************************************************************************/
2635/* interfile */
2636extern int interfile_read(char headerName[256], char searchWord[256],
2637 char returnValue[256], char errorMessage[300]);
2638extern int interfileIsHeader(const char *hdrfile, char *imgfile);
2639extern int interfileExists(
2640 const char *fname, char *hdrfile, char *imgfile, int verbose);
2641/*****************************************************************************/
2642
2643/*****************************************************************************/
2644/* micropet */
2645extern int upetHeaderReadParameter(FILE *fp, char *parameter, char *value);
2646extern int upetIsHeader(char *hdrfile);
2647extern int upetExists(const char *upetname, char *hdrfile, char *imgfile, int verbose);
2648extern int upetGetImageDimensions(FILE *fp, int *z, int *x, int *y, int *f);
2649extern int upetScanStart(FILE *fp, time_t *scant);
2650extern int upetReadImagedata(FILE *fp, IFT *ift, int frame, float *data);
2651/*****************************************************************************/
2652
2653/*****************************************************************************/
2654/* nifti */
2655extern int niftiExists(
2656 const char *dbname, char *hdrfile, char *imgile, char *siffile,
2657 NIFTI_DSR *header, int verbose, char *status
2658);
2659extern int niftiCreateFNames(
2660 const char *filename, char *hdrfile, char *imgfile, char *siffile,
2661 int fileformat
2662);
2663extern int niftiRemove(
2664 const char *dbname, int fileformat, int verbose
2665);
2666extern int niftiReadHeader(
2667 char *filename, NIFTI_DSR *h, int verbose, char *status
2668);
2669extern int niftiPrintHeader(NIFTI_DSR *h, FILE *fp);
2670extern void niftiRemoveFNameExtension(char *fname);
2671extern int niftiReadImagedata(
2672 FILE *fp, NIFTI_DSR *h, int frame, float *data, int verbose, char *status
2673);
2674extern int niftiWriteHeader(
2675 char *filename, NIFTI_DSR *dsr, int verbose, char *status
2676);
2677/*****************************************************************************/
2678
2679/*****************************************************************************/
2680/* sif */
2681//extern void libsif_printdate(FILE *fp);
2682extern int sifRead(char *filename, SIF *data);
2683extern int sifWrite(SIF *data, char *filename);
2684extern void sifPrint(SIF *data);
2685extern void sifEmpty(SIF *data);
2686extern void sifInit(SIF *data);
2687extern int sifSetmem(SIF *data, int frameNr);
2688extern void sifWeight(SIF *data, double halflife);
2689extern void sifWeightByFrames(SIF *data, double halflife);
2690extern void sifWeightNorm(SIF *data);
2691extern void sifModerateTrues(SIF *sif, double limit);
2692extern void sifModerateWeights(SIF *sif, double limit);
2693extern int sifExistentCounts(SIF *sif);
2694/* Deprecated */
2696#define readSIF sifRead
2697#define writeSIF sifWrite
2698#define printSIF sifPrint
2699#define emptySIF sifEmpty
2700#define weightSIF sifWeight
2701#define initSIF sifInit
2702#define setmemSIF sifSetmem
2704/*****************************************************************************/
2705
2706/*****************************************************************************/
2707/* ecat7ift */
2709typedef struct {
2711 int mnum;
2717 float *f;
2718} ECAT_MATRIX;
2719
2721typedef struct {
2725 int nr;
2728} ECAT_HEADERS;
2729/* Functions */
2730extern void ematInitiate(ECAT_MATRIX *emat);
2731extern void ehdrInitiate(ECAT_HEADERS *ehdr);
2732extern void ematEmpty(ECAT_MATRIX *emat);
2733extern void ehdrEmpty(ECAT_HEADERS *ehdr);
2734extern int ehdrAllocate(ECAT_HEADERS *ehdr, int nr);
2735extern int ecat7MHeaderToIFT(ECAT7_mainheader *h, IFT *ift, int verbose);
2736extern int ecat7MainheaderFromIFT(ECAT7_mainheader *h, IFT *ift, int verbose);
2737extern int ecat7ImageheaderToIFT(ECAT7_imageheader *h, IFT *ift, int verbose);
2738extern int ecat7ScanheaderToIFT(ECAT7_scanheader *h, IFT *ift, int verbose);
2739extern int ecat7ReadSubheaderToIFT(FILE *fp, ECAT7_mainheader *h, int strtblk,
2740 IFT *ift, int verbose);
2741extern int ecat7WriteSubheaderFromIFT(FILE *fp, ECAT7_mainheader *h, int strtblk,
2742 IFT *ift, int verbose);
2743extern int ecat7ReadHeaders(const char *fname, ECAT_HEADERS *ehdr, int verbose);
2744extern int ecat7WriteHeaders(const char *fname, ECAT_HEADERS *ehdr, int verbose);
2745/*****************************************************************************/
2746
2747/*****************************************************************************/
2748/* ird */
2749extern int string_to_xyzf(const char *str, IMG_PIXEL *v);
2750extern int irdReorder(IMG_RANGE *img_range);
2751extern int irdRead(char *irdfile, IMG_RANGE *img_range, char *status);
2752extern int irdCheck(IMG_RANGE *r, IMG *img);
2753/*****************************************************************************/
2754
2755/*****************************************************************************/
2756/* vol */
2757/* 4-byte floats */
2758extern void volInit(VOL *vol);
2759extern void volEmpty(VOL *vol);
2760extern int volAllocate(VOL *vol, int planes, int rows, int columns);
2761extern int img2vol(IMG *img, VOL *vol, int frame);
2762extern int vol2img(VOL *vol, IMG *img, int frame);
2763extern void volInfo(VOL *vol, FILE *fp);
2764extern void volContents(VOL *vol, VOL_RANGE r, FILE *fp);
2765extern int volMax(
2766 VOL *vol, VOL_RANGE *r,
2767 VOL_PIXEL *maxp, float *maxv, VOL_PIXEL *minp, float *minv
2768);
2769extern int volAvg(VOL *vol, VOL_RANGE *r, float *avg);
2770/* 2-byte short ints */
2771extern void svolInit(SVOL *svol);
2772extern void svolEmpty(SVOL *svol);
2773extern int svolAllocate(SVOL *svol, int planes, int rows, int columns);
2774extern int img2svol(IMG *img, SVOL *svol, int frame);
2775extern int svol2img(SVOL *svol, IMG *img, int frame);
2776extern void svolInfo(SVOL *svol, FILE *fp);
2777/* General */
2778extern int vrdReorder(VOL_RANGE *vol_range);
2779extern int vrdVxlNr(VOL_RANGE *vol_range);
2780extern int vrd2vol(VOL_RANGE *r, VOL *vol, float in, float out, char *status);
2781extern int vrdRead(char *vdffile, VOL_RANGE *vol_range, char *status);
2782extern int string_to_xyz(char *str, int *x, int *y, int *z);
2783/*****************************************************************************/
2784
2785/*****************************************************************************/
2786/* pixel */
2787extern void pxlInit(IMG_PIXELS *pxl);
2788extern void pxlFree(IMG_PIXELS *pxl);
2789extern int pxlAllocate(IMG_PIXELS *pxl, long long int pxlNr);
2790extern int pxlAllocateMore(IMG_PIXELS *pxl, long long int pxlNr);
2791extern int pxlMakeRoom(IMG_PIXELS *list, long long int i, long long int n);
2792extern int pxlAdd(IMG_PIXELS *list, IMG_PIXEL *pxl);
2793extern int pxlGet(IMG_PIXELS *list, long long int i, IMG_PIXEL *pxl);
2794extern long long int pxlAddFromMask(IMG_PIXELS *list, IMG *img);
2795extern void pxlMove(IMG_PIXELS *list, long long int from, long long int to);
2796extern int pxlRm(IMG_PIXELS *list, long long int index);
2797extern long long int pxlRmDuplicates(IMG_PIXELS *list);
2798extern int pxlWrite(IMG_PIXELS *pxl, FILE *fp, char *status);
2799extern int pxlRead(IMG_PIXELS *pxl, const char *fname, char *status);
2800/*****************************************************************************/
2801
2802/*****************************************************************************/
2803/* DICOM */
2804
2806typedef struct DCMTAG {
2810 unsigned short int group;
2812 unsigned short int element;
2813} DCMTAG;
2814
2844
2885
2912
2914typedef struct DCMFILE {
2916 char filename[FILENAME_MAX];
2918 FILE *fp;
2923} DCMFILE;
2924
2928typedef struct DCMMATRIX {
2931 char *filename;
2933 char acqDate[16];
2935 char acqTime[16];
2938 unsigned int frame;
2940 unsigned int plane;
2944 double frameDur;
2945} DCMMATRIX;
2946
2948typedef struct DCMML {
2950 unsigned int nr;
2952 unsigned int anr;
2955} DCMML;
2956/*****************************************************************************/
2957
2958/*****************************************************************************/
2959/* dcm */
2960extern int dcmVerifyMagic(const char *filename, FILE *fp);
2961extern unsigned char dcmVRReserved(dcmvr id);
2962extern dcmvr dcmVRId(const char *s);
2963extern char *dcmVRName(dcmvr id);
2964extern size_t dcmVRVLength(dcmvr id);
2965extern char *dcmVRDescr(dcmvr id);
2966extern char *dcmDA2intl(const char *orig, char *intl);
2967extern char *dcmTM2intl(const char *orig, char *intl);
2968extern char *dcmDT2intl(const char *orig, char *intl);
2969extern unsigned int dcmSOPIdentify(const char *s);
2970extern char *dcmSOPName(unsigned int i);
2971extern char *dcmSOPUID(unsigned int i);
2972extern char *dcmSOPUIDName(const char *s);
2973extern dcmtruid dcmTrUID(const char *s);
2974extern char *dcmTrUIDDescr(dcmtruid id);
2975extern char *dcmTrUIDString(dcmtruid id);
2976extern dcmtruid dcmReadTransferSyntaxUID(FILE *fp);
2977extern int dcmReadFileTag(FILE *fp, DCMTAG *tag);
2978extern int dcmWriteFileTag(FILE *fp, DCMTAG *tag);
2979extern int dcmWriteFileSQDelimItem(FILE *fp);
2980extern int dcmWriteFileSQItemDelimTag(FILE *fp);
2981extern dcmvr dcmReadFileVR(FILE *fp, char *vrstr);
2982extern unsigned int dcmReadFileVL(FILE *fp, unsigned int n);
2983extern int dcmReadFileVRVL(FILE *fp, dcmvr *vr, unsigned int *vl, unsigned int *n);
2984extern int dcmWriteFileVRVL(FILE *fp, dcmvr vr, unsigned int vl, unsigned int *n);
2985
2986extern void dcmfileInit(DCMFILE *d);
2987extern void dcmitemFree(DCMITEM *d);
2988extern void dcmfileFree(DCMFILE *d);
2989extern unsigned short int dcmfileMaxDepth(DCMFILE *df);
2990extern unsigned short int dcmitemMaxDepth(DCMITEM *d);
2991extern unsigned short int dcmitemParentNr(DCMITEM *d);
2992extern char *dcmValueString(DCMITEM *d);
2993extern long int dcmitemGetInt(DCMITEM *d);
2994extern double dcmitemGetReal(DCMITEM *d);
2995extern DCMITEM *dcmFindTag(DCMITEM *d, const short int omit, DCMTAG *tag, const int verbose);
2996extern void dcmitemPrint(DCMITEM *d);
2997extern void dcmTagSet(DCMTAG *tag, unsigned short int group, unsigned short int element);
2998extern int dcmAddItem(
2999 DCMFILE *dcm, DCMITEM *d, short int aschild, DCMTAG tag, dcmvr vr, unsigned int vl,
3000 char *rd, const int verbose
3001);
3002
3003extern int dcmFileReadNextElement(
3004 DCMFILE *dcm, DCMITEM *prev_item, DCMITEM *parent_item, const short int sub,
3005 const short int headerOnly, int verbose
3006);
3007extern int dcmFileRead(
3008 const char *filename, DCMFILE *dcm, const short int headerOnly,
3009 int verbose
3010);
3011extern int dcmFileWrite(const char *filename, DCMFILE *dcm, int verbose);
3012
3013/*****************************************************************************/
3014
3015/*****************************************************************************/
3016#endif // _LIBTPCIMGIO_H
int anaMakeSIFName(const char *dbname, char *siffile)
Definition analyze.c:763
int anaEditHeader(ANALYZE_DSR *h, char *field, char *value)
Definition analyze.c:783
int anaWriteHeader(char *filename, ANALYZE_DSR *h)
Definition analyze.c:283
int anaExistsNew(const char *filename, char *hdrfile, char *imgfile, char *siffile)
Definition analyze.c:43
int anaFlipping()
Definition analyze.c:635
int anaPrintHeader(ANALYZE_DSR *h, FILE *fp)
Definition analyze.c:380
int anaDatabaseExists(const char *dbname, char *hdrfile, char *imgfile, char *siffile)
Definition analyze.c:704
void anaRemoveFNameExtension(char *fname)
Definition analyze.c:687
int ANALYZE_TEST
Definition analyze.c:8
int anaExists(const char *dbname)
Definition analyze.c:17
int anaReadHeader(char *filename, ANALYZE_DSR *h)
Definition analyze.c:129
int anaReadImagedata(FILE *fp, ANALYZE_DSR *h, int frame, float *data)
Definition analyze.c:454
int anaRemove(const char *dbname)
Definition analyze.c:666
int dcmAddItem(DCMFILE *dcm, DCMITEM *d, short int aschild, DCMTAG tag, dcmvr vr, unsigned int vl, char *rd, const int verbose)
Definition dcm.c:1239
dcmtruid dcmReadTransferSyntaxUID(FILE *fp)
Definition dcm.c:502
long int dcmitemGetInt(DCMITEM *d)
Definition dcm.c:1084
unsigned short int dcmitemMaxDepth(DCMITEM *d)
Definition dcm.c:884
unsigned char dcmVRReserved(dcmvr id)
Definition dcm.c:205
unsigned int dcmSOPIdentify(const char *s)
Definition dcm.c:367
int dcmWriteFileVRVL(FILE *fp, dcmvr vr, unsigned int vl, unsigned int *n)
Definition dcm.c:784
char * dcmTrUIDDescr(dcmtruid id)
Definition dcm.c:466
int dcmFileRead(const char *filename, DCMFILE *dcm, const short int headerOnly, int verbose)
Definition dcm.c:1687
size_t dcmVRVLength(dcmvr id)
Definition dcm.c:264
void dcmfileInit(DCMFILE *d)
Definition dcm.c:823
void dcmTagSet(DCMTAG *tag, unsigned short int group, unsigned short int element)
Definition dcm.c:1221
dcmvr dcmVRId(const char *s)
Definition dcm.c:223
DCMITEM * dcmFindTag(DCMITEM *d, const short int omit, DCMTAG *tag, const int verbose)
Definition dcm.c:1163
int dcmFileWrite(const char *filename, DCMFILE *dcm, int verbose)
Definition dcm.c:1758
char * dcmDT2intl(const char *orig, char *intl)
Definition dcm.c:345
void dcmfileFree(DCMFILE *d)
Definition dcm.c:868
char * dcmDA2intl(const char *orig, char *intl)
Definition dcm.c:299
void dcmitemFree(DCMITEM *d)
Definition dcm.c:840
char * dcmTM2intl(const char *orig, char *intl)
Definition dcm.c:322
char * dcmVRName(dcmvr id)
Definition dcm.c:246
dcmvr dcmReadFileVR(FILE *fp, char *vrstr)
Definition dcm.c:655
void dcmitemPrint(DCMITEM *d)
Definition dcm.c:1205
int dcmReadFileTag(FILE *fp, DCMTAG *tag)
Definition dcm.c:553
double dcmitemGetReal(DCMITEM *d)
Definition dcm.c:1120
int dcmReadFileVRVL(FILE *fp, dcmvr *vr, unsigned int *vl, unsigned int *n)
Definition dcm.c:724
char * dcmSOPUIDName(const char *s)
Definition dcm.c:424
int dcmFileReadNextElement(DCMFILE *dcm, DCMITEM *prev_item, DCMITEM *parent_item, const short int sub, const short int headerOnly, int verbose)
Definition dcm.c:1370
int dcmWriteFileSQItemDelimTag(FILE *fp)
Definition dcm.c:634
unsigned short int dcmfileMaxDepth(DCMFILE *df)
Definition dcm.c:903
unsigned int dcmReadFileVL(FILE *fp, unsigned int n)
Definition dcm.c:692
char * dcmTrUIDString(dcmtruid id)
Definition dcm.c:484
unsigned short int dcmitemParentNr(DCMITEM *d)
Definition dcm.c:923
char * dcmValueString(DCMITEM *d)
Definition dcm.c:942
char * dcmVRDescr(dcmvr id)
Definition dcm.c:282
char * dcmSOPUID(unsigned int i)
Definition dcm.c:406
dcmtruid dcmTrUID(const char *s)
Definition dcm.c:445
int dcmWriteFileTag(FILE *fp, DCMTAG *tag)
Definition dcm.c:583
int dcmVerifyMagic(const char *filename, FILE *fp)
Definition dcm.c:157
char * dcmSOPName(unsigned int i)
Definition dcm.c:388
int dcmWriteFileSQDelimItem(FILE *fp)
Definition dcm.c:609
char ecat63errmsg[128]
Definition ecat63h.c:7
int ecat63EditMHeader(ECAT63_mainheader *h, char *field, char *value, int verbose)
Definition ecat63h.c:140
int ECAT63_TEST
Definition ecat63h.c:6
int ecat63CopyMainheader(ECAT63_mainheader *h1, ECAT63_mainheader *h2)
Definition ecat63h.c:16
int ecat63CopyScanheader(ECAT63_scanheader *h1, ECAT63_scanheader *h2)
Definition ecat63h.c:94
int ecat63Matenter(FILE *fp, int matnum, int blkNr)
Definition ecat63ml.c:159
int ecat63ReadMatlist(FILE *fp, MATRIXLIST *ml, int verbose)
Definition ecat63ml.c:46
int ecat63GetPlaneAndFrameNr(MATRIXLIST *mlist, ECAT63_mainheader *h, int *plane_nr, int *frame_nr)
Definition ecat63ml.c:400
void ecat63InitMatlist(MATRIXLIST *mlist)
Definition ecat63ml.c:20
void ecat63EmptyMatlist(MATRIXLIST *mlist)
Definition ecat63ml.c:31
int ecat63GatherMatlist(MATRIXLIST *ml, short int do_planes, short int do_frames, short int do_gates, short int do_beds)
Definition ecat63ml.c:510
int mat_numcod(int frame, int plane, int gate, int data, int bed)
Definition ecat63ml.c:242
int ecat63GetNums(MATRIXLIST *ml, short int *num_planes, short int *num_frames, short int *num_gates, short int *num_bed_pos)
Definition ecat63ml.c:450
int ecat63GetMatrixBlockSize(MATRIXLIST *mlist, int *blk_nr)
Definition ecat63ml.c:366
int ecat63DeleteLateFrames(MATRIXLIST *ml, int frame_nr)
Definition ecat63ml.c:342
void ecat63SortMatlistByPlane(MATRIXLIST *ml)
Definition ecat63ml.c:271
void ecat63PrintMatlist(MATRIXLIST *ml)
Definition ecat63ml.c:130
int ecat63CheckMatlist(MATRIXLIST *ml)
Definition ecat63ml.c:324
void mat_numdoc(int matnum, Matval *matval)
Definition ecat63ml.c:254
void ecat63SortMatlistByFrame(MATRIXLIST *ml)
Definition ecat63ml.c:297
void ecat63PrintMainheader(ECAT63_mainheader *h, FILE *fp)
Definition ecat63p.c:16
char * ecat63Datatype(short int dtype)
Definition ecat63p.c:218
void ecat63PrintImageheader(ECAT63_imageheader *h, FILE *fp)
Definition ecat63p.c:94
void ecat63PrintScanheader(ECAT63_scanheader *h, FILE *fp)
Definition ecat63p.c:137
void ecat63PrintNormheader(ECAT63_normheader *h, FILE *fp)
Definition ecat63p.c:197
void float2parts(float *buf)
Definition ecat63p.c:277
char * ecat63ScanstarttimeInt(const ECAT63_mainheader *h, char *buf)
Convert scan_start_time in ECAT 6.3 main header into a null-terminated string of the form YYYY-MM-DD ...
Definition ecat63p.c:391
void ecat63PrintAttnheader(ECAT63_attnheader *h, FILE *fp)
Definition ecat63p.c:173
char * ecat63Unit(short int dunit)
Definition ecat63p.c:243
int ecat6PrintSubheader(ECAT63_mainheader mh, FILE *fp, int plane, int frame, FILE *ofp)
Definition ecat63p.c:293
float ecat63rFloat(void *bufi, int isvax, int islittle)
Definition ecat63r.c:928
int ecat63rInt(void *bufi, int isvax, int islittle)
Definition ecat63r.c:953
int ecat63ReadNormheader(FILE *fp, int blk, ECAT63_normheader *h, int verbose, char *errmsg)
Definition ecat63r.c:483
int ecat63ReadScanheader(FILE *fp, int blk, ECAT63_scanheader *h, int verbose, char *errmsg)
Definition ecat63r.c:377
int ecat63ReadImageMatrix(FILE *fp, int first_block, int last_block, ECAT63_imageheader *h, float **fdata)
Definition ecat63r.c:627
int ecat63ReadMatdata(FILE *fp, int strtblk, int blkNr, char *data, int dtype)
Definition ecat63r.c:568
int ecat63ReadScanMatrix(FILE *fp, int first_block, int last_block, ECAT63_scanheader *h, float **fdata)
Definition ecat63r.c:731
int ecat63ReadAttnMatrix(FILE *fp, int first_block, int last_block, ECAT63_attnheader *h, float **fdata)
Definition ecat63r.c:830
int ecat63ReadAttnheader(FILE *fp, int blk, ECAT63_attnheader *h, int verbose, char *errmsg)
Definition ecat63r.c:296
int ecat63ReadImageheader(FILE *fp, int blk, ECAT63_imageheader *h, int verbose, char *errmsg)
Definition ecat63r.c:187
int ecat63pxlbytes(short int data_type)
Definition ecat63r.c:973
int ecat63ReadMainheader(FILE *fp, ECAT63_mainheader *h)
Definition ecat63r.c:25
int ecat63WriteScan(FILE *fp, int matnum, ECAT63_scanheader *h, void *data)
Definition ecat63w.c:463
int ecat63_is_scaling_needed(float amax, float *data, long long nr)
Definition ecat63w.c:664
int ecat63WriteImageheader(FILE *fp, int block, ECAT63_imageheader *h)
Definition ecat63w.c:106
int ecat63WriteScanMatrix(FILE *fp, int matnum, ECAT63_scanheader *h, float *fdata)
Definition ecat63w.c:783
int ecat63WriteMatdata(FILE *fp, int strtblk, char *data, long long pxlNr, int pxlSize)
Definition ecat63w.c:620
int ecat63WriteAttnheader(FILE *fp, int block, ECAT63_attnheader *h)
Definition ecat63w.c:190
void ecat63wFloat(float *bufi, void *bufo, int tovax, int islittle)
Definition ecat63w.c:862
int ecat63WriteScanheader(FILE *fp, int block, ECAT63_scanheader *h)
Definition ecat63w.c:242
int ecat63WriteAttn(FILE *fp, int matnum, ECAT63_attnheader *h, void *data)
Definition ecat63w.c:565
int ecat63WriteNorm(FILE *fp, int matnum, ECAT63_normheader *h, void *data)
Definition ecat63w.c:514
int ecat63WriteImageMatrix(FILE *fp, int matnum, ECAT63_imageheader *h, float *fdata)
Definition ecat63w.c:699
int ecat63WriteNormheader(FILE *fp, int block, ECAT63_normheader *h)
Definition ecat63w.c:313
int ecat63WriteImage(FILE *fp, int matnum, ECAT63_imageheader *h, void *data)
Definition ecat63w.c:412
FILE * ecat63Create(const char *fname, ECAT63_mainheader *h)
Definition ecat63w.c:365
void ecat63wInt(int *bufi, void *bufo, int tovax, int islittle)
Definition ecat63w.c:886
struct tm * ecat63ScanstarttimeToTm(const ECAT63_mainheader *h, struct tm *tm)
Convert scan_start_time in ECAT 6.3 main header into a struct tm.
Definition ecat63w.c:902
int ecat63WriteMainheader(FILE *fp, ECAT63_mainheader *h)
Definition ecat63w.c:24
time_t ecat63Scanstarttime(const ECAT63_mainheader *h)
Get calendar time from ECAT 6.3 main header.
Definition ecat63w.c:927
int ecat7EditMHeader(ECAT7_mainheader *h, char *field, char *value, int verbose)
Definition ecat7h.c:16
char ecat7errmsg[128]
Definition ecat7h.c:7
int ecat7EditSHeader(ECAT7_scanheader *h, char *field, char *value, int verbose)
Definition ecat7h.c:199
int ecat7EditVHeader(ECAT7_imageheader *h, char *field, char *value, int verbose)
Definition ecat7h.c:320
int ECAT7_TEST
Definition ecat7h.c:6
int ecat7MainheaderFromIFT(ECAT7_mainheader *h, IFT *ift, int verbose)
Definition ecat7ift.c:221
int ecat7ReadSubheaderToIFT(FILE *fp, ECAT7_mainheader *h, int strtblk, IFT *ift, int verbose)
Definition ecat7ift.c:502
int ecat7MHeaderToIFT(ECAT7_mainheader *h, IFT *ift, int verbose)
Definition ecat7ift.c:85
void ehdrEmpty(ECAT_HEADERS *ehdr)
Definition ecat7ift.c:47
int ecat7WriteHeaders(const char *fname, ECAT_HEADERS *ehdr, int verbose)
Definition ecat7ift.c:755
void ematEmpty(ECAT_MATRIX *emat)
Definition ecat7ift.c:33
int ecat7ScanheaderToIFT(ECAT7_scanheader *h, IFT *ift, int verbose)
Definition ecat7ift.c:408
void ehdrInitiate(ECAT_HEADERS *ehdr)
Definition ecat7ift.c:21
void ematInitiate(ECAT_MATRIX *emat)
Definition ecat7ift.c:12
int ecat7ReadHeaders(const char *fname, ECAT_HEADERS *ehdr, int verbose)
Definition ecat7ift.c:687
int ehdrAllocate(ECAT_HEADERS *ehdr, int nr)
Definition ecat7ift.c:63
int ecat7WriteSubheaderFromIFT(FILE *fp, ECAT7_mainheader *h, int strtblk, IFT *ift, int verbose)
Definition ecat7ift.c:583
int ecat7ImageheaderToIFT(ECAT7_imageheader *h, IFT *ift, int verbose)
Definition ecat7ift.c:251
void ecat7InitMatlist(ECAT7_MATRIXLIST *mlist)
Definition ecat7ml.c:15
void ecat7SortMatlistByFrame(ECAT7_MATRIXLIST *ml)
Definition ecat7ml.c:303
int ecat7GetPlaneAndFrameNr(ECAT7_MATRIXLIST *mlist, ECAT7_mainheader *h, int *plane_nr, int *frame_nr)
Definition ecat7ml.c:372
int ecat7GetMatrixBlockSize(ECAT7_MATRIXLIST *mlist, int *blk_nr)
Definition ecat7ml.c:418
void ecat7SortMatlistByPlane(ECAT7_MATRIXLIST *ml)
Definition ecat7ml.c:277
void ecat7_id_to_val(int matrix_id, ECAT7_Matval *matval)
Definition ecat7ml.c:262
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)
Definition ecat7ml.c:452
int ecat7ReadMatlist(FILE *fp, ECAT7_MATRIXLIST *ml, int verbose)
Definition ecat7ml.c:41
void ecat7EmptyMatlist(ECAT7_MATRIXLIST *mlist)
Definition ecat7ml.c:26
int ecat7EnterMatrix(FILE *fp, int matrix_id, int block_nr)
Definition ecat7ml.c:147
int ecat7_val_to_id(int frame, int plane, int gate, int data, int bed)
Definition ecat7ml.c:245
int ecat7GatherMatlist(ECAT7_MATRIXLIST *ml, short int do_planes, short int do_frames, short int do_gates, short int do_beds)
Definition ecat7ml.c:535
void ecat7PrintMatlist(ECAT7_MATRIXLIST *ml)
Definition ecat7ml.c:112
int ecat7DeleteLateFrames(ECAT7_MATRIXLIST *ml, int frame_nr)
Definition ecat7ml.c:346
int ecat7CheckMatlist(ECAT7_MATRIXLIST *ml)
Definition ecat7ml.c:329
void ecat7PrintNormheader(ECAT7_normheader *h, FILE *fp)
Definition ecat7p.c:327
void ecat7PrintImageheader(ECAT7_imageheader *h, FILE *fp)
Definition ecat7p.c:102
char * ecat7acquisitiontype(short int acquisition_type)
Definition ecat7p.c:468
char * ecat7filetype(short int file_type)
Definition ecat7p.c:447
void ecat7PrintPolmapheader(ECAT7_polmapheader *h, FILE *fp)
Definition ecat7p.c:276
char * ecat7datatype(short int data_type)
Definition ecat7p.c:489
void ecat7PrintAttenheader(ECAT7_attenheader *h, FILE *fp)
Definition ecat7p.c:230
void ecat7Print2DScanheader(ECAT7_2Dscanheader *h, FILE *fp)
Definition ecat7p.c:364
void ecat7PrintMainheader(ECAT7_mainheader *h, FILE *fp)
Definition ecat7p.c:16
int ecat7PrintSubheader(ECAT7_mainheader mh, FILE *fp, int plane, int frame, FILE *ofp)
Definition ecat7p.c:506
void ecat7PrintScanheader(ECAT7_scanheader *h, FILE *fp)
Definition ecat7p.c:181
void ecat7Print2DNormheader(ECAT7_2Dnormheader *h, FILE *fp)
Definition ecat7p.c:415
int ecat7pxlbytes(short int data_type)
Definition ecat7r.c:1274
int ecat7Read2DScanMatrix(FILE *fp, int first_block, int last_block, ECAT7_2Dscanheader *h, float **fdata)
Definition ecat7r.c:959
int ecat7ReadScanheader(FILE *fp, int blk, ECAT7_scanheader *h)
Definition ecat7r.c:536
float ecat7rFloat(void *bufi, int isvax, int islittle)
Definition ecat7r.c:1233
int ecat7ReadPolmapheader(FILE *fp, int blk, ECAT7_polmapheader *h)
Definition ecat7r.c:397
int ecat7ReadMatrixdata(FILE *fp, int start_block, int block_nr, char *data, int dtype)
Definition ecat7r.c:791
int ecat7ReadNormheader(FILE *fp, int blk, ECAT7_normheader *h)
Definition ecat7r.c:472
int ecat7ReadAttenheader(FILE *fp, int blk, ECAT7_attenheader *h)
Definition ecat7r.c:311
int ecat7rInt(void *bufi, int isvax, int islittle)
Definition ecat7r.c:1256
int ecat7ReadMainheader(FILE *fp, ECAT7_mainheader *h)
Definition ecat7r.c:15
int ecat7ReadPolarmapMatrix(FILE *fp, int first_block, int last_block, ECAT7_polmapheader *h, float **fdata)
Definition ecat7r.c:1154
int ecat7Read2DScanheader(FILE *fp, int blk, ECAT7_2Dscanheader *h)
Definition ecat7r.c:631
int ecat7ReadImageMatrix(FILE *fp, int first_block, int last_block, ECAT7_imageheader *h, float **fdata)
Definition ecat7r.c:858
int ecat7ReadImageheader(FILE *fp, int blk, ECAT7_imageheader *h)
Definition ecat7r.c:162
int ecat7Read2DNormheader(FILE *fp, int blk, ECAT7_2Dnormheader *h)
Definition ecat7r.c:725
int ecat7ReadScanMatrix(FILE *fp, int first_block, int last_block, ECAT7_scanheader *h, float **fdata)
Definition ecat7r.c:1055
int ecat7_is_scaling_needed(float amax, float *data, long long nr)
Definition ecat7w.c:604
int ecat7WriteImageMatrix(FILE *fp, int matrix_id, ECAT7_imageheader *h, float *fdata)
Definition ecat7w.c:635
int ecat7WriteScanMatrix(FILE *fp, int matrix_id, ECAT7_scanheader *h, float *fdata)
Definition ecat7w.c:802
int ecat7WriteNormheader(FILE *fp, int blk, ECAT7_normheader *h)
Definition ecat7w.c:330
int ecat7WriteScanheader(FILE *fp, int blk, ECAT7_scanheader *h)
Definition ecat7w.c:383
int ecat7WriteImageheader(FILE *fp, int blk, ECAT7_imageheader *h)
Definition ecat7w.c:113
int ecat7WriteMatrixdata(FILE *fp, int start_block, char *data, long long pxl_nr, int pxl_size)
Definition ecat7w.c:974
int ecat7WritePolarmapMatrix(FILE *fp, int matrix_id, ECAT7_polmapheader *h, float *fdata)
Definition ecat7w.c:888
int ecat7WritePolmapheader(FILE *fp, int blk, ECAT7_polmapheader *h)
Definition ecat7w.c:271
int ecat7Write2DScanheader(FILE *fp, int blk, ECAT7_2Dscanheader *h)
Definition ecat7w.c:450
int ecat7Write2DScanMatrix(FILE *fp, int matrix_id, ECAT7_2Dscanheader *h, float *fdata)
Definition ecat7w.c:719
int ecat7Write2DNormheader(FILE *fp, int blk, ECAT7_2Dnormheader *h)
Definition ecat7w.c:517
FILE * ecat7Create(const char *fname, ECAT7_mainheader *h)
Definition ecat7w.c:567
int ecat7WriteAttenheader(FILE *fp, int blk, ECAT7_attenheader *h)
Definition ecat7w.c:208
int ecat7WriteMainheader(FILE *fp, ECAT7_mainheader *h)
Definition ecat7w.c:16
int IMG_TEST
Definition img.c:6
int imgExistentTimes(IMG *img)
Definition img.c:613
void imgInfo(IMG *image)
Definition img.c:359
unsigned long long imgNaNs(IMG *img, int fix)
Definition img.c:658
int imgExtractRange(IMG *img1, IMG_RANGE r, IMG *img2)
Definition img.c:548
int imgExistentCounts(IMG *img)
Definition img.c:630
char * imgStatus(int status_index)
Definition img.c:330
int imgAllocate(IMG *image, int planes, int rows, int columns, int frames)
Definition img.c:194
int imgCopyhdr(IMG *image1, IMG *image2)
Definition img.c:471
int imgAllocateWithHeader(IMG *image, int planes, int rows, int columns, int frames, IMG *image_from)
Definition img.c:279
void imgSetStatus(IMG *img, int status_index)
Definition img.c:345
int imgDup(IMG *img1, IMG *img2)
Definition img.c:304
void imgEmpty(IMG *image)
Definition img.c:121
void imgInit(IMG *image)
Definition img.c:60
int imgWriteAnalyze(const char *dbname, IMG *img)
Definition img_ana.c:162
int imgGetAnalyzeHeader(IMG *img, ANALYZE_DSR *h)
Definition img_ana.c:427
int imgReadAnalyzeFirstFrame(const char *fname, IMG *img)
Definition img_ana.c:592
int imgReadAnalyzeFrame(const char *fname, int frame_to_read, IMG *img, int frame_index)
Definition img_ana.c:639
int imgReadAnalyzeHeader(const char *dbname, IMG *img)
Definition img_ana.c:360
int imgSetAnalyzeHeader(IMG *img, const char *dbname, ANALYZE_DSR *dsr, float fmin, float fmax)
Definition img_ana.c:486
int imgWriteAnalyzeFrame(const char *dbname, int frame_to_write, IMG *img, int frame_index, float fmin, float fmax)
Definition img_ana.c:751
int imgReadAnalyze(const char *dbname, IMG *img)
Definition img_ana.c:24
int ecat63ReadPlaneToImg(const char *fname, IMG *img)
Definition img_e63.c:550
int imgGetEcat63Fileformat(ECAT63_mainheader *h)
Definition img_e63.c:1288
int imgEcat63Supported(ECAT63_mainheader *h)
Definition img_e63.c:1155
int ecat63WriteAllImg(const char *fname, IMG *img)
Definition img_e63.c:335
void imgSetEcat63SHeader(IMG *img, void *h)
Definition img_e63.c:1872
int imgWriteEcat63Frame(const char *fname, int frame_to_write, IMG *img, int frame_index)
Definition img_e63.c:1711
int imgReadEcat63FirstFrame(const char *fname, IMG *img)
Definition img_e63.c:1457
int ecat63AddImg(const char *fname, IMG *img)
Definition img_e63.c:878
void imgGetEcat63MHeader(IMG *img, ECAT63_mainheader *h)
Definition img_e63.c:1172
int imgReadEcat63Header(const char *fname, IMG *img)
Definition img_e63.c:1318
void imgSetEcat63MHeader(IMG *img, ECAT63_mainheader *h)
Definition img_e63.c:1223
int imgReadEcat63Frame(const char *fname, int frame_to_read, IMG *img, int frame_index)
Definition img_e63.c:1503
int ecat63ReadAllToImg(const char *fname, IMG *img)
Definition img_e63.c:22
int imgWrite2DEcat7(const char *fname, IMG *img)
Definition img_e7.c:526
void imgGetEcat7MHeader(IMG *img, ECAT7_mainheader *h)
Definition img_e7.c:742
int imgWriteEcat7(const char *fname, IMG *img)
Definition img_e7.c:382
int imgReadEcat7Frame(const char *fname, int frame_to_read, IMG *img, int frame_index)
Definition img_e7.c:1103
int imgEcat7Supported(ECAT7_mainheader *h)
Definition img_e7.c:1036
int imgReadEcat7FirstFrame(const char *fname, IMG *img)
Definition img_e7.c:1060
int imgReadEcat7(const char *fname, IMG *img)
Definition img_e7.c:19
int imgReadEcat7Header(const char *fname, IMG *img)
Definition img_e7.c:860
int imgGetEcat7Fileformat(ECAT7_mainheader *h)
Definition img_e7.c:827
int imgWriteEcat7Frame(const char *fname, int frame_to_write, IMG *img, int frame_index)
Definition img_e7.c:1295
int imgWritePolarmap(const char *fname, IMG *img)
Definition img_e7.c:661
void imgSetEcat7MHeader(IMG *img, ECAT7_mainheader *h)
Definition img_e7.c:781
void imgSetEcat7SHeader(IMG *img, void *h)
Definition img_e7.c:1482
int imgSetNiftiHeader(IMG *img, const char *dbname, NIFTI_DSR *dsr, float fmin, float fmax, int verbose)
Definition img_nii.c:471
int imgReadNiftiFirstFrame(const char *filename, IMG *img, int verbose)
Definition img_nii.c:78
int imgReadNiftiHeader(const char *filename, IMG *img, int verbose)
Definition img_nii.c:134
int imgReadNifti(const char *filename, IMG *img, int verbose)
Definition img_nii.c:23
int imgReadNiftiFrame(const char *filename, int frame_to_read, IMG *img, int frame_index, int verbose)
Definition img_nii.c:311
int imgWriteNiftiFrame(const char *dbname, int frame_to_write, IMG *img, int frame_index, float fmin, float fmax, int verbose)
Definition img_nii.c:594
int imgWriteNifti(const char *dbname, IMG *img, int save_sif, int verbose)
Definition img_nii.c:811
int imgGetNiftiHeader(IMG *img, NIFTI_DSR *dsr, int verbose)
Definition img_nii.c:218
int img2sif(IMG *img, SIF *sif, int copy_header, int copy_frames, int copy_counts, int verbose)
Definition img_sif.c:71
int sif2img(SIF *sif, IMG *img, int copy_header, int copy_frames, int copy_counts, int verbose)
Definition img_sif.c:13
int imgMicropetPETToEcat7(FILE *fph, FILE *fpi, char *ecatfile, int verbose)
Definition img_upet.c:85
int imgGetMicropetMainHeader(FILE *fp, IMG *img, float *calibration_factor, int verbose)
Definition img_upet.c:300
int imgGetMicropetHeader(IMG *img)
Definition img_upet.c:583
int imgGetMicropetFrameHeader(FILE *fp, IMG *img, int frame_index, int verbose)
Definition img_upet.c:457
int imgReadMicropetFirstFrame(const char *fname, IMG *img)
Definition img_upet.c:925
int imgMicropetCTToEcat7(FILE *fph, FILE *fpi, char *ecatfile, int verbose)
Definition img_upet.c:196
int imgReadMicropetFrame(const char *fname, int frame_to_read, IMG *img, int frame_index)
Definition img_upet.c:819
int imgMicropetToEcat7(char *upetname, char *ecatfile, int verbose)
Definition img_upet.c:15
int imgGetMicropetSIF(FILE *fp, SIF *sif)
Definition img_upet.c:517
int imgReadMicropetHeader(const char *dbname, IMG *img)
Definition img_upet.c:767
int imgReadMicropet(const char *fname, IMG *img)
Definition img_upet.c:971
int imgMatchPlanes(IMG *img1, IMG *img2)
Definition imgcomp.c:307
int imgSS(IMG *img1, IMG *img2, double *ss)
Definition imgcomp.c:412
int imgMatchMatrix(IMG *img1, IMG *img2, double accuracy)
Definition imgcomp.c:47
int imgMatchHeader(IMG *img1, IMG *img2)
Definition imgcomp.c:128
int imgMatchTransform(IMG *img1, IMG *img2)
Definition imgcomp.c:85
int imgMaxDifference(IMG *img1, IMG *img2, VOXEL_4D *absdiff, float *abs_max, VOXEL_4D *reldiff, float *rel_max)
Definition imgcomp.c:328
int imgMatchFrames(IMG *img1, IMG *img2)
Definition imgcomp.c:286
int imgMatch(IMG *img1, IMG *img2, float accuracy)
Definition imgcomp.c:15
int imgMatchMatrixSize(IMG *d1, IMG *d2)
Definition imgcomp.c:447
char * imgIsotope(IMG *img)
Definition imgdecayc.c:76
int imgBranchingCorrection(IMG *image, int mode, int verbose, char *status)
Definition imgdecayc.c:132
int imgSetDecayCorrFactors(IMG *image, int mode)
Definition imgdecayc.c:87
int imgDecayCorrection(IMG *image, int mode)
Definition imgdecayc.c:16
int imgFormatDetermine(const char *fname, char *basename, char *hdrfile, char *imgfile, char *siffile, int *file_format, int *scanner, int *type, int *modality, int verbose)
Definition imgfile.c:537
int imgRead(const char *fname, IMG *img)
Definition imgfile.c:26
int imgWriteFrame(const char *fname, int frame_to_write, IMG *img, int frame_index)
Definition imgfile.c:393
int imgReadFrame(const char *fname, int frame_to_read, IMG *img, int frame_index)
Definition imgfile.c:270
void imgFormatFromFName(IMG *img, const char *fname)
Definition imgfile.c:484
int imgWrite(const char *fname, IMG *img)
Definition imgfile.c:137
int imgReadHeader(const char *fname, IMG *img, int format)
Definition imgfile.c:200
int imgGetMaxTime(IMG *img, IMG *mimg, const int w, int verbose)
Definition imgminmax.c:345
int imgAvg(IMG *img, IMG_RANGE *r, float *avg)
Definition imgminmax.c:503
float fmean(float *data, long long int n, float *sd)
Definition imgminmax.c:618
void fMinMaxFin(float *data, long long int n, float *fmin, float *fmax)
Definition imgminmax.c:649
int imgReadMinMax(const char *fname, float *fmin, float *fmax)
Definition imgminmax.c:211
int imgFrameMinMax(IMG *img, int frame, float *minvalue, float *maxvalue)
Definition imgminmax.c:171
int imgRangeMinMax(IMG *img, IMG_RANGE *r, IMG_PIXEL *maxp, float *maxv, IMG_PIXEL *minp, float *minv)
Definition imgminmax.c:71
int imgAbsMax(IMG *img, float *maxvalue)
Definition imgminmax.c:44
int imgMinMax(IMG *img, float *minvalue, float *maxvalue)
Definition imgminmax.c:154
int imgGetMaxFrame(IMG *img, IMG *mimg, int verbose)
Definition imgminmax.c:454
int imgGetPeak(IMG *img, float beforeTime, IMG_PIXEL *p, int verbose)
Definition imgminmax.c:294
float f_kth_smallest(float *data, long long int n, long long int k)
Definition imgminmax.c:558
int imgMax(IMG *img, float *maxvalue)
Definition imgminmax.c:15
int imgSmoothMax(IMG *img, float *maxvalue, IMG_PIXEL *p)
Definition imgminmax.c:248
float fmedian(float *data, long long int n)
Definition imgminmax.c:593
int imgUnitToEcat6(IMG *img)
Definition imgunits.c:175
int imgSetUnit(IMG *img, char *unit)
Definition imgunits.c:328
char * imgUnit(int dunit)
Definition imgunits.c:315
int imgUnitId(char *unit)
Definition imgunits.c:14
void imgUnitFromEcat(IMG *img, int ecat_unit)
Definition imgunits.c:95
void imgUnitToEcat7(IMG *img, ECAT7_mainheader *h)
Definition imgunits.c:209
void imgUnitFromEcat7(IMG *img, ECAT7_mainheader *h)
Definition imgunits.c:149
int interfile_read(char headerName[256], char searchWord[256], char returnValue[256], char errorMessage[300])
Definition interfile.c:43
int interfileExists(const char *fname, char *hdrfile, char *imgfile, int verbose)
Definition interfile.c:193
int interfileIsHeader(const char *hdrfile, char *imgfile)
Definition interfile.c:154
int irdRead(char *irdfile, IMG_RANGE *img_range, char *status)
Definition ird.c:75
int irdReorder(IMG_RANGE *img_range)
Definition ird.c:44
int irdCheck(IMG_RANGE *r, IMG *img)
Definition ird.c:152
int string_to_xyzf(const char *str, IMG_PIXEL *v)
Definition ird.c:14
int pxlMakeRoom(IMG_PIXELS *list, long long int i, long long int n)
Definition pixel.c:110
void sifModerateTrues(SIF *sif, double limit)
Definition weight.c:131
int string_to_xyz(char *str, int *x, int *y, int *z)
Definition vol.c:653
void pxlFree(IMG_PIXELS *pxl)
Definition pixel.c:28
void svolInit(SVOL *svol)
Definition vol.c:50
void volContents(VOL *vol, VOL_RANGE r, FILE *fp)
Definition vol.c:464
void sifModerateWeights(SIF *sif, double limit)
Definition weight.c:167
int sifWrite(SIF *data, char *filename)
Definition sifio.c:145
int vrdReorder(VOL_RANGE *vol_range)
Definition vol.c:607
int pxlAllocateMore(IMG_PIXELS *pxl, long long int pxlNr)
Definition pixel.c:74
int niftiWriteHeader(char *filename, NIFTI_DSR *dsr, int verbose, char *status)
Definition nifti.c:959
int MICROPET_TEST
Definition micropet.c:6
int VOL_TEST
Definition vol.c:6
int svolAllocate(SVOL *svol, int planes, int rows, int columns)
Definition vol.c:204
int upetScanStart(FILE *fp, time_t *scant)
Definition micropet.c:194
void volInit(VOL *vol)
Definition vol.c:26
dcmvr
@ DCM_VR_INVALID
Invalid DICOM value representation.
@ DCM_VR_DT
DICOM date time, max 26 bytes.
@ DCM_VR_UI
DICOM unique identifier (UID), max 64 bytes.
@ DCM_VR_FD
DICOM floating point double precision, 8 bytes fixed.
@ DCM_VR_UC
DICOM unlimited characters.
@ DCM_VR_PN
DICOM person name, max 64 chars per component group.
@ DCM_VR_CS
DICOM code (control) string, max 16 bytes.
@ DCM_VR_SS
DICOM signed short (16-bit integer), 2 bytes fixed.
@ DCM_VR_SH
DICOM short string, max 16 chars.
@ DCM_VR_OF
DICOM other float (32-bit) stream, endian sensitive.
@ DCM_VR_UT
DICOM unlimited text, character string.
@ DCM_VR_US
DICOM unsigned short (16-bit) integer, 2 bytes fixed.
@ DCM_VR_TM
DICOM time HHMMSS.FFFFFF, max 14 bytes.
@ DCM_VR_OB
DICOM other byte string, even bytes, endian insensitive.
@ DCM_VR_AS
DICOM age string, 4 bytes fixed.
@ DCM_VR_ST
DICOM short text, max 1024 chars.
@ DCM_VR_AT
DICOM attribute tag, 4 bytes fixed.
@ DCM_VR_LT
DICOM long text, max 10240 chars.
@ DCM_VR_DA
DICOM date in format YYYYMMDD, 8 bytes fixed.
@ DCM_VR_UL
DICOM unsigned long (32-bit) integer, 4 bytes fixed.
@ DCM_VR_UN
DICOM unknown, any valid length of another VR.
@ DCM_VR_DS
DICOM decimal string, max 16 bytes.
@ DCM_VR_OW
DICOM other word (16-bit) stream, even bytes, endian sensitive.
@ DCM_VR_IS
DICOM integer string, max 12 bytes.
@ DCM_VR_AE
DICOM application entity, max 16 bytes.
@ DCM_VR_UR
DICOM URI or URL, string of characters.
@ DCM_VR_LO
DICOM long string, max 64 chars.
@ DCM_VR_SQ
DICOM sequence of zero or more elements (used for nested data).
@ DCM_VR_FL
DICOM floating point single precision, 4 bytes fixed.
@ DCM_VR_SL
DICOM signed long (32-bit integer), 4 bytes fixed.
@ DCM_VR_OL
DICOM other long (32-bit) stream, endian sensitive.
@ DCM_VR_OD
DICOM other double (64-bit) stream, endian sensitive.
int niftiCreateFNames(const char *filename, char *hdrfile, char *imgfile, char *siffile, int fileformat)
Definition nifti.c:44
void svolEmpty(SVOL *svol)
Definition vol.c:103
void niftiRemoveFNameExtension(char *fname)
Definition nifti.c:23
int pxlGet(IMG_PIXELS *list, long long int i, IMG_PIXEL *pxl)
Definition pixel.c:163
void sifInit(SIF *data)
Definition sif.c:17
int niftiPrintHeader(NIFTI_DSR *h, FILE *fp)
Definition nifti.c:616
int volMax(VOL *vol, VOL_RANGE *r, VOL_PIXEL *maxp, float *maxv, VOL_PIXEL *minp, float *minv)
Definition vol.c:492
int niftiReadImagedata(FILE *fp, NIFTI_DSR *h, int frame, float *data, int verbose, char *status)
Definition nifti.c:734
int SIF_TEST
Definition sif.c:6
int upetGetImageDimensions(FILE *fp, int *z, int *x, int *y, int *f)
Definition micropet.c:154
int svol2img(SVOL *svol, IMG *img, int frame)
Definition vol.c:385
int volAllocate(VOL *vol, int planes, int rows, int columns)
Definition vol.c:139
int upetIsHeader(char *hdrfile)
Definition micropet.c:55
void sifWeightByFrames(SIF *data, double halflife)
Calculate weights for frames in SIF data based on frame lengths. Weights are normalized to have an av...
Definition weight.c:72
int niftiExists(const char *dbname, char *hdrfile, char *imgile, char *siffile, NIFTI_DSR *header, int verbose, char *status)
Definition nifti.c:160
void sifPrint(SIF *data)
Definition sifio.c:234
int sifExistentCounts(SIF *sif)
Definition weight.c:207
int upetHeaderReadParameter(FILE *fp, char *parameter, char *value)
Definition micropet.c:16
int upetExists(const char *upetname, char *hdrfile, char *imgfile, int verbose)
Definition micropet.c:86
int niftiReadHeader(char *filename, NIFTI_DSR *h, int verbose, char *status)
Definition nifti.c:408
void volInfo(VOL *vol, FILE *fp)
Definition vol.c:415
void sifWeight(SIF *data, double halflife)
Calculate weights for frames in SIF data based on true counts. Weights are normalized to have an aver...
Definition weight.c:28
int vrdVxlNr(VOL_RANGE *vol_range)
Definition vol.c:634
int pxlAdd(IMG_PIXELS *list, IMG_PIXEL *pxl)
Definition pixel.c:139
void volEmpty(VOL *vol)
Definition vol.c:74
int pxlWrite(IMG_PIXELS *pxl, FILE *fp, char *status)
Definition pixel.c:299
void svolInfo(SVOL *svol, FILE *fp)
Definition vol.c:439
int img2vol(IMG *img, VOL *vol, int frame)
Definition vol.c:267
int pxlRead(IMG_PIXELS *pxl, const char *fname, char *status)
Definition pixel.c:331
int img2svol(IMG *img, SVOL *svol, int frame)
Definition vol.c:305
int volAvg(VOL *vol, VOL_RANGE *r, float *avg)
Definition vol.c:562
int sifSetmem(SIF *data, int frameNr)
Definition sif.c:56
long long int pxlRmDuplicates(IMG_PIXELS *list)
Definition pixel.c:273
int upetReadImagedata(FILE *fp, IFT *ift, int frame, float *data)
Definition micropet.c:243
int vrd2vol(VOL_RANGE *r, VOL *vol, float in, float out, char *status)
Definition vol.c:681
#define MAX_POLARMAP_NUM_RINGS
dcmtruid
@ DCM_TRUID_LEI
Little Endian Implicit VR (DICOM default).
@ DCM_TRUID_JPEG81
Lossy JPEG-LS.
@ DCM_TRUID_JPEG93
Multicomponent JPEG 2000.
@ DCM_TRUID_MPEG100
MPEG-2.
@ DCM_TRUID_JPEG92
Lossless multicomponent JPEG 2000.
@ DCM_TRUID_JPEG91
JPEG 2000.
@ DCM_TRUID_JPEG70
Lossless JPEG.
@ DCM_TRUID_XML
XML encoding.
@ DCM_TRUID_INVALID
Invalid Transfer Syntax UID.
@ DCM_TRUID_MPEG103
MPEG-4 BD-compatible.
@ DCM_TRUID_RFC
RFC 2557.
@ DCM_TRUID_JPEG80
Lossless JPEG-LS.
@ DCM_TRUID_UNKNOWN
Unknown Transfer Syntax UID.
@ DCM_TRUID_BEE
Big Endian Explicit VR.
@ DCM_TRUID_JPEG51
Lossy JPEG 12-bit compression.
@ DCM_TRUID_RLE
Lossless RLE.
@ DCM_TRUID_LEE
Little Endian Explicit VR.
@ DCM_TRUID_JPEG90
Lossless JPEG 2000.
@ DCM_TRUID_JPEG50
Lossy JPEG 8-bit compression.
@ DCM_TRUID_MPEG102
MPEG-4.
void sifEmpty(SIF *data)
Definition sif.c:33
int vrdRead(char *vdffile, VOL_RANGE *vol_range, char *status)
Definition vol.c:742
void pxlInit(IMG_PIXELS *pxl)
Definition pixel.c:14
void pxlMove(IMG_PIXELS *list, long long int from, long long int to)
Definition pixel.c:220
int niftiRemove(const char *dbname, int fileformat, int verbose)
Definition nifti.c:100
void sifWeightNorm(SIF *data)
Definition weight.c:105
int sifRead(char *filename, SIF *data)
Definition sifio.c:21
int vol2img(VOL *vol, IMG *img, int frame)
Definition vol.c:351
int pxlAllocate(IMG_PIXELS *pxl, long long int pxlNr)
Definition pixel.c:44
char siferrmsg[128]
Definition sif.c:7
long long int pxlAddFromMask(IMG_PIXELS *list, IMG *img)
Definition pixel.c:185
int pxlRm(IMG_PIXELS *list, long long int index)
Definition pixel.c:249
Header file for libtpcmisc.
#define MAX_STUDYNR_LEN
Definition libtpcmisc.h:163
ANALYZE_HEADER_HISTORY hist
ANALYZE_HEADER_KEY hk
ANALYZE_HEADER_IMGDIM dime
short int session_error
Definition libtpcimgio.h:88
dcmtruid truid
DCMITEM * item
char filename[FILENAME_MAX]
FILE * fp
dcmtruid truid
struct DCMITEM * child_item
struct DCMITEM * next_item
unsigned int vl
FILE * fp
fpos_t pos
char * rd
struct DCMITEM * prev_item
struct DCMITEM * parent_item
DCMTAG tag
double frameDur
unsigned int plane
double frameStart
char * filename
char acqTime[16]
char acqDate[16]
unsigned int frame
DCMMATRIX * m
unsigned int anr
unsigned int nr
unsigned short int element
unsigned short int group
short int dimension_1
short int dimension_2
short int attenuation_type
short int unused3[149]
short int unused2[23]
short int unused2[12]
short int recon_start_month
short int fill2[26]
short int recon_start_day
short int slice_location
short int processing_code
short int recon_start_min
short int unused6[30]
short int recon_start_year
short int num_dimensions
short int recon_start_hour
short int unused3[2]
short int unused4[12]
short int recon_start_sec
short int unused5[23]
char radiopharmaceutical[32]
short int scan_start_month
short int coin_samp_mode
short int lwr_true_thres
short int compression_code
char patient_height[10]
short int fill2[20]
short int wobble_speed
short int scan_start_second
short int num_bed_pos
short int transaxial_samp_mode
short int rot_source_speed
short int acquisition_type
short int calibration_units
short int scan_start_year
char original_file_name[20]
char study_description[32]
short int scan_start_day
short int transm_source_type
short int scan_start_minute
char user_process_code[10]
char patient_weight[10]
short int lwr_sctr_thres
short int axial_samp_mode
short int scan_start_hour
short int upr_true_thres
char physician_name[32]
short int system_type
short int unused1[2]
short int unused3[6]
short int unused2[23]
short int dimension_1
short int unused4[85]
short int unused11[58]
short int norm_second
short int dimension_2
short int norm_minute
short int unused2[3]
short int dimension_2
short int unused5[3]
short int unused6[52]
float uncor_singles[16]
short int processing_code
short int unused3[8]
short int fill2[22]
short int unused1[2]
short int dimension_1
short int frame_duration_sec
float cor_singles[16]
short int z_elements[64]
short int num_dimensions
short int ring_difference
short int storage_order
short int num_z_elements
short int fill_user[50]
short int norm_quality_factor_code
short int num_r_elements
short int fill_cti[123]
short int corrections_applied
float deadtime_correction_factor
short int num_z_elements
short int num_r_elements
short int fill_user[50]
short int ring_difference
short int physical_planes[8]
short int fill_gate[6]
short int fill_cti[83]
float cor_singles[16]
float uncor_singles[16]
short int num_dimensions
ECAT7_MatDir * matdir
short int num_r_elements
short int z_elements[64]
short int attenuation_type
short int fill_cti[86]
short int num_additional_atten_coeff
short int num_dimensions
float edge_finding_threshold
short int num_z_elements
short int data_type
short int num_angles
short int fill_user[50]
short int storage_order
short int ring_difference
float additional_atten_coeff[8]
short int fill_cti[87]
float filter_scatter_fraction
short int filter_code
short int image_max
short int image_min
short int zfilter_order
short int fill_user[49]
short int rfilter_code
float filter_cutoff_frequency
short int zfilter_code
short int filter_order
short int y_dimension
short int z_dimension
short int recon_type
short int scatter_type
short int recon_views
short int num_dimensions
short int rfilter_order
short int x_dimension
short int data_type
short int file_type
short int compression_code
float bed_position[15]
short int system_type
char facility_name[20]
short int num_frames
char operator_name[32]
short int coin_samp_mode
char data_units[32]
char magic_number[14]
float well_counter_corr_factor
char study_type[12]
char user_process_code[10]
short int angular_compression
short int calibration_units
char patient_name[32]
short int fill_cti[6]
short int septa_state
short int num_gates
short int num_planes
short int lwr_true_thres
char physician_name[32]
short int wobble_speed
short int acquisition_mode
short int calibration_units_label
char serial_number[10]
short int num_bed_pos
float ecat_calibration_factor
short int sw_version
short int transm_source_type
short int acquisition_type
char study_description[32]
short int axial_samp_mode
char patient_id[16]
char radiopharmaceutical[32]
short int patient_orientation
short int upr_true_thres
short int lwr_sctr_thres
char original_file_name[32]
short int num_r_elements
short int data_type
short int num_transaxial_crystals
short int num_geo_corr_planes
short int fill_user[50]
short int crystals_per_ring
short int max_ring_diff
float norm_quality_factor
float ring_dtcor1[32]
short int num_crystal_rings
short int norm_quality_factor_code
float ring_dtcor2[32]
float crystal_dtcor[8]
short int scatter_energy
short int fill_cti[48]
short int fill_cti[27]
short int ring_angle[32]
short int long_axis_left[3]
short int processing_code
short int sectors_per_ring[32]
char polar_map_protocol[20]
short int start_angle
short int polar_map_type
short int position_data
float ring_position[32]
short int quant_units
short int long_axis_right[3]
short int fill_user[27]
short int scan_min
short int num_r_elements
short int num_angles
short int data_type
float deadtime_correction_factor
short int fill_cti[90]
short int num_dimensions
short int axial_compression
short int fill_gate[6]
short int storage_order
float uncor_singles[128]
short int scan_max
short int num_z_elements[64]
short int fill_user[50]
short int ring_difference
short int corrections_applied
ECAT_MATRIX * m
ECAT7_Matval matval
long long int _pxlNr
IMG_PIXEL * p
long long int pxlNr
float * pixel
float sizex
int polarmap_num_rings
unsigned short int dimx
float branchingFraction
char type
float resolutionx
int errstatus
float * sd
char patientName[32]
float resolutiony
char studyDescription[32]
float sampleDistance
short int polarmap_start_angle
float gapx
float **** m
char decayCorrection
float transaxialFOV
short int xform[2]
char unit
float *** row
char status
time_t scanStart
int _fileFormat
float * prompts
char userProcessCode[11]
unsigned short int dimt
int _dataType
int * planeNumber
char patientID[16]
IFT ift
int scanner
float sizey
float * weight
float **** plane
float * start
unsigned short int dimz
int modality
int polarmap_sectors_per_ring[MAX_POLARMAP_NUM_RINGS]
unsigned short int dimy
int orientation
float * end
float calibrationFactor
float mt[12]
float quatern[18]
float ** column
float zoom
char radiopharmaceutical[32]
float * decayCorrFactor
const char * statmsg
float isotopeHalflife
short int polarmap_ring_angle[MAX_POLARMAP_NUM_RINGS]
char studyNr[MAX_STUDYNR_LEN+1]
float gapy
float * randoms
float gapz
float axialFOV
float * mid
char isWeight
float polarmap_ring_position[MAX_POLARMAP_NUM_RINGS]
float sizez
float resolutionz
MatDir * matdir
int matstat
int endblk
int matnum
int strtblk
MatDirNode * first
MatDirNode * last
struct matdirnode * next
MatDirList * dirlist
ECAT63_mainheader * mhptr
char * data_ptr
int frame
int plane
short int qform_code
short int slice_start
short int slice_end
short int datatype
char aux_file[24]
char intent_name[16]
short int bitpix
char data_type[10]
short int sform_code
short int dim[8]
short int intent_code
short int session_error
NIFTI_1_HEADER h
NIFTI_EXTENDER e
double * x1
double * prompts
int frameNr
double * x2
int version
char studynr[MAX_STUDYNR_LEN+1]
time_t scantime
char isotope_name[8]
double * weights
int colNr
double * randoms
double * trues
float sizey
unsigned short int dimx
unsigned short int dimz
int orientation
short int ** row
float sizez
short int * voxel
unsigned short int dimy
short int *** plane
float scale_factor
char status
char * statmsg
short int *** v
float sizex
short int * column
char status
float * column
unsigned short int dimx
unsigned short int dimy
float ** row
int orientation
unsigned short int dimz
float sizex
char * statmsg
float *** plane
float * voxel
float *** v
float sizez
float sizey