TPCCLIB
Loading...
Searching...
No Matches
tpcnifti.h
Go to the documentation of this file.
1
14#ifndef _TPCNIFTI_H_
15#define _TPCNIFTI_H_
16/*****************************************************************************/
17
18/*****************************************************************************/
19#include "tpcclibConfig.h"
20/*****************************************************************************/
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24#include <math.h>
25/*****************************************************************************/
26#include "tpcextensions.h"
27#include "tpcift.h"
28#include "tpcfileutil.h"
29/*****************************************************************************/
30
31/*****************************************************************************/
33#define NIFTI1_HEADER_SIZE 348
35#define NIFTI1_HEADER_EXTENDER_SIZE 4
37#define NIFTI2_HEADER_SIZE 540
39#define NIFTI2_HEADER_EXTENDER_SIZE 4
41#define ANALYZE_HEADER_SIZE 348
42/*****************************************************************************/
44#define NIFTI_UNITS_UNKNOWN 0
46#define NIFTI_UNITS_METER 1
48#define NIFTI_UNITS_MM 2
50#define NIFTI_UNITS_MICRON 4
52#define NIFTI_UNITS_SEC 8
54#define NIFTI_UNITS_MSEC 16
56#define NIFTI_UNITS_USEC 24
58#define NIFTI_UNITS_HERTZ 32
60#define NIFTI_UNITS_PPM 40
62#define NIFTI_UNITS_RADS 48
63/*****************************************************************************/
65#define ANALYZE_DT_NONE 0
67#define ANALYZE_DT_UNKNOWN 0
69#define ANALYZE_DT_BINARY 1
71#define ANALYZE_DT_UNSIGNED_CHAR 2
73#define ANALYZE_DT_SIGNED_SHORT 4
75#define ANALYZE_DT_SIGNED_INT 8
77#define ANALYZE_DT_FLOAT 16
79#define ANALYZE_DT_COMPLEX 32
81#define ANALYZE_DT_DOUBLE 64
83#define ANALYZE_DT_RGB 128
85#define ANALYZE_DT_ALL 255
86
88#define NIFTI_DT_NONE ANALYZE_DT_NONE
90#define NIFTI_DT_UNKNOWN ANALYZE_DT_UNKNOWN
92#define NIFTI_DT_BINARY ANALYZE_DT_BINARY
94#define NIFTI_DT_UNSIGNED_CHAR ANALYZE_DT_UNSIGNED_CHAR
96#define NIFTI_DT_SIGNED_SHORT ANALYZE_DT_SIGNED_SHORT
98#define NIFTI_DT_SIGNED_INT ANALYZE_DT_SIGNED_INT
100#define NIFTI_DT_FLOAT ANALYZE_DT_FLOAT
102#define NIFTI_DT_COMPLEX ANALYZE_DT_COMPLEX
104#define NIFTI_DT_DOUBLE ANALYZE_DT_DOUBLE
106#define NIFTI_DT_RGB ANALYZE_DT_RGB
108#define NIFTI_DT_ALL ANALYZE_DT_ALL
110#define NIFTI_DT_SIGNED_CHAR 256
112#define NIFTI_DT_UNSIGNED_SHORT 512
114#define NIFTI_DT_UNSIGNED_INT 768
116#define NIFTI_DT_LONG_LONG 1024
118#define NIFTI_DT_UNSIGNED_LONG_LONG 1280
120#define NIFTI_DT_LONG_DOUBLE 1536
122#define NIFTI_DT_DOUBLE_PAIR 1792
124#define NIFTI_DT_LONG_DOUBLE_PAIR 2048
126#define NIFTI_DT_RGBA 2304
127/*****************************************************************************/
129#define NIFTI_INTENT_NONE 0
131#define NIFTI_INTENT_CORREL 2
133#define NIFTI_INTENT_TTEST 3
135#define NIFTI_INTENT_FTEST 4
137#define NIFTI_INTENT_ZSCORE 5
139#define NIFTI_INTENT_CHISQ 6
141#define NIFTI_INTENT_BETA 7
143#define NIFTI_INTENT_BINOM 8
145#define NIFTI_INTENT_GAMMA 9
147#define NIFTI_INTENT_POISSON 10
149#define NIFTI_INTENT_NORMAL 11
151#define NIFTI_INTENT_FTEST_NONC 12
153#define NIFTI_INTENT_CHISQ_NONC 13
155#define NIFTI_INTENT_LOGISTIC 14
157#define NIFTI_INTENT_LAPLACE 15
159#define NIFTI_INTENT_UNIFORM 16
161#define NIFTI_INTENT_TTEST_NONC 17
163#define NIFTI_INTENT_WEIBULL 18
165#define NIFTI_INTENT_CHI 19
167#define NIFTI_INTENT_INVGAUSS 20
169#define NIFTI_INTENT_EXTVAL 21
171#define NIFTI_INTENT_PVAL 22
173#define NIFTI_INTENT_LOGPVAL 23
175#define NIFTI_INTENT_LOG10PVAL 24
177#define NIFTI_INTENT_ESTIMATE 1001
179#define NIFTI_INTENT_LABEL 1002
181#define NIFTI_INTENT_NEURONAME 1003
183#define NIFTI_INTENT_GENMATRIX 1004
185#define NIFTI_INTENT_SYMMATRIX 1005
187#define NIFTI_INTENT_DISPVECT 1006
189#define NIFTI_INTENT_VECTOR 1007
191#define NIFTI_INTENT_POINTSET 1008
193#define NIFTI_INTENT_TRIANGLE 1009
195#define NIFTI_INTENT_QUATERNION 1010
197#define NIFTI_INTENT_DIMLESS 1011
198/*****************************************************************************/
200#define NIFTI_XFORM_UNKNOWN 0
202#define NIFTI_XFORM_SCANNER_ANAT 1
204#define NIFTI_XFORM_ALIGNED_ANAT 2
206#define NIFTI_XFORM_TALAIRACH 3
208#define NIFTI_XFORM_MNI_152 4
209/*****************************************************************************/
210
211/*****************************************************************************/
213typedef struct {
218 char data_type[10];
220 char db_name[18];
224 short int session_error;
229
233 short int dim[8];
241 short int intent_code;
243 short int datatype;
245 short int bitpix;
247 short int slice_start;
249 float pixdim[8];
257 short int slice_end;
263 float cal_max;
265 float cal_min;
269 float toffset;
271 int glmax;
273 int glmin;
274
276 char descrip[80];
278 char aux_file[24];
281 short int qform_code;
283 short int sform_code;
297 float srow_x[4];
299 float srow_y[4];
301 float srow_z[4];
303 char intent_name[16];
306 char magic[4];
308
310typedef struct {
315 char magic[8];
317 int16_t datatype;
319 int16_t bitpix;
323 int64_t dim[8];
325 double intent_p1;
327 double intent_p2;
329 double intent_p3;
331 double pixdim[8];
333 int64_t vox_offset;
335 double scl_slope;
337 double scl_inter;
339 double cal_max;
341 double cal_min;
345 double toffset;
347 int64_t slice_start;
349 int64_t slice_end;
351 char descrip[80];
353 char aux_file[24];
360 double quatern_b;
362 double quatern_c;
364 double quatern_d;
366 double qoffset_x;
368 double qoffset_y;
370 double qoffset_z;
372 double srow_x[4];
374 double srow_y[4];
376 double srow_z[4];
384 char intent_name[16];
388 char unused_str[15];
390
394typedef struct {
398 char extension[4];
400
414/*****************************************************************************/
415
416/*****************************************************************************/
418typedef struct {
423 char data_type[10];
425 char db_name[18];
430 short int session_error;
437 short int dim[8];
439 short int unused8;
441 short int unused9;
443 short int unused10;
445 short int unused11;
447 short int unused12;
449 short int unused13;
451 short int unused14;
454 short int datatype;
456 short int bitpix;
458 short int dim_un0;
460 float pixdim[8];
465 float funused1;
467 float funused2;
469 float funused3;
471 float cal_max;
473 float cal_min;
477 float verified;
479 int glmax;
481 int glmin;
483 char descrip[80];
485 char aux_file[24];
488 char orient;
490 char originator[10];
492 char generated[10];
494 char scannum[10];
496 char patient_id[10];
498 char exp_date[10];
500 char exp_time[10];
502 char hist_un0[3];
504 int views;
512 int omax;
514 int omin;
516 int smax;
518 int smin;
520
522typedef struct {
528/*****************************************************************************/
529
530/*****************************************************************************/
531/* niftiname */
532extern void niftiBasename(char *filename);
533/*****************************************************************************/
534
535/*****************************************************************************/
536/* niftiio */
537extern int niftiExists(
538 const char *filename, char *hdrfile, char *imgfile, char *siffile, NIFTI_DSR *header,
539 TPCSTATUS *status
540);
541extern int niftiReadHeader(const char *filename, NIFTI_DSR *dsr, int verbose);
542extern int niftiWriteHeader(const char *filename, NIFTI_DSR *dsr, int verbose);
543/*****************************************************************************/
544
545/*****************************************************************************/
546/* analyzeio */
547extern int anaExists(
548 const char *filename, char *hdrfile, char *imgfile, char *siffile, ANALYZE_DSR *header,
549 TPCSTATUS *status
550);
551extern int anaReadHeader(const char *filename, ANALYZE_DSR *dsr, int verbose);
552/*****************************************************************************/
553
554/*****************************************************************************/
555#endif /* TPCNIFTI */
int byte_order
Definition tpcnifti.h:526
ANALYZE_HEADER h
Definition tpcnifti.h:524
short int bitpix
Definition tpcnifti.h:456
short int unused10
Definition tpcnifti.h:443
short int unused8
Definition tpcnifti.h:439
short int dim_un0
Definition tpcnifti.h:458
float compressed
Definition tpcnifti.h:475
short int unused9
Definition tpcnifti.h:441
short int session_error
Definition tpcnifti.h:430
short int unused11
Definition tpcnifti.h:445
short int unused14
Definition tpcnifti.h:451
short int unused13
Definition tpcnifti.h:449
short int datatype
Definition tpcnifti.h:454
float vox_offset
Definition tpcnifti.h:463
short int unused12
Definition tpcnifti.h:447
float quatern_d
Definition tpcnifti.h:289
float quatern_c
Definition tpcnifti.h:287
short int qform_code
Definition tpcnifti.h:281
float qoffset_x
Definition tpcnifti.h:291
short int slice_start
Definition tpcnifti.h:247
short int slice_end
Definition tpcnifti.h:257
float slice_duration
Definition tpcnifti.h:267
short int datatype
Definition tpcnifti.h:243
float intent_p2
Definition tpcnifti.h:237
float intent_p1
Definition tpcnifti.h:235
float intent_p3
Definition tpcnifti.h:239
short int bitpix
Definition tpcnifti.h:245
short int sform_code
Definition tpcnifti.h:283
float vox_offset
Definition tpcnifti.h:251
float qoffset_y
Definition tpcnifti.h:293
float scl_inter
Definition tpcnifti.h:255
float qoffset_z
Definition tpcnifti.h:295
short int intent_code
Definition tpcnifti.h:241
float quatern_b
Definition tpcnifti.h:285
float scl_slope
Definition tpcnifti.h:253
short int session_error
Definition tpcnifti.h:224
int64_t vox_offset
Definition tpcnifti.h:333
int16_t datatype
Definition tpcnifti.h:317
double slice_duration
Definition tpcnifti.h:343
double cal_min
Definition tpcnifti.h:341
double intent_p2
Definition tpcnifti.h:327
int64_t slice_start
Definition tpcnifti.h:347
double qoffset_y
Definition tpcnifti.h:368
double intent_p3
Definition tpcnifti.h:329
int64_t slice_end
Definition tpcnifti.h:349
double scl_inter
Definition tpcnifti.h:337
double scl_slope
Definition tpcnifti.h:335
double intent_p1
Definition tpcnifti.h:325
double quatern_d
Definition tpcnifti.h:364
double qoffset_z
Definition tpcnifti.h:370
double qoffset_x
Definition tpcnifti.h:366
double toffset
Definition tpcnifti.h:345
double quatern_c
Definition tpcnifti.h:362
int16_t bitpix
Definition tpcnifti.h:319
double cal_max
Definition tpcnifti.h:339
double quatern_b
Definition tpcnifti.h:360
NIFTI_2_HEADER h2
Definition tpcnifti.h:406
NIFTI_EXTENDER e
Definition tpcnifti.h:408
NIFTI_1_HEADER h1
Definition tpcnifti.h:404
int byte_order
Definition tpcnifti.h:412
Header file for library libtpcextensions.
Header file for libtpcfileutil.
Header file for library libtpcift.
int anaExists(const char *filename, char *hdrfile, char *imgfile, char *siffile, ANALYZE_DSR *header, TPCSTATUS *status)
Definition analyzeio.c:16
int anaReadHeader(const char *filename, ANALYZE_DSR *dsr, int verbose)
Definition analyzeio.c:144
void niftiBasename(char *filename)
Definition niftiname.c:14
int niftiExists(const char *filename, char *hdrfile, char *imgfile, char *siffile, NIFTI_DSR *header, TPCSTATUS *status)
Definition niftiio.c:17
int niftiWriteHeader(const char *filename, NIFTI_DSR *dsr, int verbose)
Definition niftiio.c:445
int niftiReadHeader(const char *filename, NIFTI_DSR *dsr, int verbose)
Definition niftiio.c:146