6#ifndef _NIFTI_IO_HEADER_
7#define _NIFTI_IO_HEADER_
15#ifndef DONT_INCLUDE_ANALYZE_STRUCT
16#define DONT_INCLUDE_ANALYZE_STRUCT
72typedef enum _analyze75_orient_code {
73 a75_transverse_unflipped = 0,
74 a75_coronal_unflipped = 1,
75 a75_sagittal_unflipped = 2,
76 a75_transverse_flipped = 3,
77 a75_coronal_flipped = 4,
78 a75_sagittal_flipped = 5,
79 a75_orient_unknown = 6
80} analyze_75_orient_code;
133 qoffset_x , qoffset_y , qoffset_z ,
154 char intent_name[16] ;
194 short int session_error;
298 int *start_index,
int *region_size,
335 const int * blist,
int disp_error);
347size_t nifti_write_buffer(
znzFile fp,
const void * buffer,
size_t numbytes);
351 const char * opts,
int write_data,
int leave_open);
357 float *qb,
float *qc,
float *qd,
358 float *qx,
float *qy,
float *qz,
359 float *dx,
float *dy,
float *dz,
float *qfac ) ;
362 float qx,
float qy,
float qz,
363 float dx,
float dy,
float dz,
float qfac );
366 float r21,
float r22,
float r23 ,
367 float r31,
float r32,
float r33 ) ;
429#define NIFTI_ECODE_IGNORE 0
431#define NIFTI_ECODE_DICOM 2
433#define NIFTI_ECODE_AFNI 4
436#define NIFTI_ECODE_COMMENT 6
438#define NIFTI_ECODE_XCEDE 8
443#define NIFTI_ECODE_JIMDIMINFO 10
447#define NIFTI_ECODE_WORKFLOW_FWDS 12
452#define NIFTI_ECODE_FREESURFER 14
454#define NIFTI_ECODE_PYPICKLE 16
459#define NIFTI_ECODE_MIND_IDENT 18
460#define NIFTI_ECODE_B_VALUE 20
461#define NIFTI_ECODE_SPHERICAL_DIRECTION 22
462#define NIFTI_ECODE_DT_COMPONENT 24
463#define NIFTI_ECODE_SHC_DEGREEORDER 26
465#define NIFTI_ECODE_VOXBO 28
467#define NIFTI_ECODE_CARET 30
472#define NIFTI_MAX_ECODE 30
475#define NIFTI_FTYPE_ANALYZE 0
476#define NIFTI_FTYPE_NIFTI1_1 1
477#define NIFTI_FTYPE_NIFTI1_2 2
478#define NIFTI_FTYPE_ASCII 3
479#define NIFTI_MAX_FTYPE 3
489 int allow_upper_fext;
500#define LNI_FERR(func,msg,file) \
501 fprintf(stderr,"** ERROR (%s): %s '%s'\n",func,msg,file)
505#define swap_2(s) nifti_swap_2bytes(1,&(s))
506#define swap_4(v) nifti_swap_4bytes(1,&(v))
515# define IS_GOOD_FLOAT(x) isfinite(x)
516# define FIXED_FLOAT(x) (isfinite(x) ? (x) : 0)
518# define IS_GOOD_FLOAT(x) 1
519# define FIXED_FLOAT(x) (x)
523#define ASSIF(p,v) if( (p)!=NULL ) *(p) = (v)
530#define REVERSE_ORDER(x) (3-(x))
532#define LNI_MAX_NIA_EXT_LEN 100000
short datatype
Definition nifti1.h:165
Official definition of the nifti1 header. Written by Bob Cox, SSCC, NIMH.
nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype)
Definition nifti1_io.c:5284
nifti_image * nifti_copy_nim_info(const nifti_image *src)
Definition nifti1_io.c:5882
znzFile nifti_image_write_hdr_img(nifti_image *nim, int write_data, const char *opts)
Definition nifti1_io.c:5657
size_t nifti_get_volsize(const nifti_image *nim)
Definition nifti1_io.c:2464
int nifti_swap_as_analyze(nifti_analyze75 *h)
Definition nifti1_io.c:2327
int nifti_read_collapsed_image(nifti_image *nim, const int dims[8], void **data)
Definition nifti1_io.c:6742
int * nifti_get_intlist(int nvals, const char *str)
Definition nifti1_io.c:7207
char * nifti_strdup(const char *str)
Definition nifti1_io.c:1157
void nifti_set_skip_blank_ext(int skip)
Definition nifti1_io.c:2709
nifti_image * nifti_simple_init_nim(void)
Definition nifti1_io.c:5241
znzFile nifti_image_write_hdr_img2(nifti_image *nim, int write_opts, const char *opts, znzFile imgfile, const nifti_brick_list *NBL)
Definition nifti1_io.c:5695
int is_nifti_file(const char *hname)
Definition nifti1_io.c:3438
int nifti_set_filenames(nifti_image *nim, const char *prefix, int check, int set_byte_order)
Definition nifti1_io.c:3054
int nifti_read_subregion_image(nifti_image *nim, int *start_index, int *region_size, void **data)
Definition nifti1_io.c:6847
char * nifti_find_file_extension(const char *name)
Definition nifti1_io.c:2583
int nifti_is_inttype(int dt)
Definition nifti1_io.c:1218
int nifti_image_load(nifti_image *nim)
Load the image blob into a previously initialized nifti_image.
Definition nifti1_io.c:4866
void nifti_image_free(nifti_image *nim)
Definition nifti1_io.c:5028
int nifti_disp_matrix_orient(const char *mesg, mat44 mat)
Definition nifti1_io.c:1132
mat33 nifti_mat33_polar(mat33 A)
Definition nifti1_io.c:1891
size_t nifti_read_buffer(znzFile fp, void *datatptr, size_t ntot, nifti_image *nim)
Definition nifti1_io.c:4928
nifti_image * nifti_read_ascii_image(znzFile fp, char *fname, int flen, int read_data)
Definition nifti1_io.c:4292
int valid_nifti_brick_list(nifti_image *nim, int nbricks, const int *blist, int disp_error)
Definition nifti1_io.c:1025
mat33 nifti_mat33_mul(mat33 A, mat33 B)
Definition nifti1_io.c:1872
int nifti_type_and_names_match(nifti_image *nim, int show_warn)
Definition nifti1_io.c:3106
mat44 nifti_quatern_to_mat44(float qb, float qc, float qd, float qx, float qy, float qz, float dx, float dy, float dz, float qfac)
Definition nifti1_io.c:1466
float nifti_mat33_colnorm(mat33 A)
Definition nifti1_io.c:1857
void swap_nifti_header(struct nifti_1_header *h, int is_nifti)
Definition nifti1_io.c:2266
char * nifti_units_string(int uu)
Definition nifti1_io.c:1255
void nifti_swap_4bytes(size_t n, void *ar)
Definition nifti1_io.c:2156
nifti_image * nifti_image_read_bricks(const char *hname, int nbricks, const int *blist, nifti_brick_list *NBL)
Definition nifti1_io.c:531
int nifti_datatype_is_valid(int dtype, int for_nifti)
Definition nifti1_io.c:7421
int is_valid_nifti_type(int nifti_type)
Definition nifti1_io.c:3329
int nifti_set_type_from_names(nifti_image *nim)
Definition nifti1_io.c:3379
void nifti_swap_16bytes(size_t n, void *ar)
Definition nifti1_io.c:2198
void nifti_swap_8bytes(size_t n, void *ar)
Definition nifti1_io.c:2177
int nifti_compiled_with_zlib(void)
Definition nifti1_io.c:2666
void old_swap_nifti_header(struct nifti_1_header *h, int is_nifti)
Definition nifti1_io.c:2385
int nifti_is_gzfile(const char *fname)
Definition nifti1_io.c:2648
char * nifti_datatype_to_string(int dtype)
Definition nifti1_io.c:7400
int nifti_image_load_bricks(nifti_image *nim, int nbricks, const int *blist, nifti_brick_list *NBL)
Definition nifti1_io.c:719
int nifti_validfilename(const char *fname)
Definition nifti1_io.c:2550
void nifti_mat44_to_quatern(mat44 R, float *qb, float *qc, float *qd, float *qx, float *qy, float *qz, float *dx, float *dy, float *dz, float *qfac)
Definition nifti1_io.c:1537
void nifti_set_allow_upper_fext(int allow)
Definition nifti1_io.c:2719
void nifti_image_write_bricks(nifti_image *nim, const nifti_brick_list *NBL)
Definition nifti1_io.c:5865
mat44 nifti_make_orthog_mat44(float r11, float r12, float r13, float r21, float r22, float r23, float r31, float r32, float r33)
Definition nifti1_io.c:1737
int nifti_nim_is_valid(nifti_image *nim, int complain)
Definition nifti1_io.c:6559
nifti_image * nifti_image_read(const char *hname, int read_data)
Read a nifti header and optionally the data, creating a nifti_image.
Definition nifti1_io.c:4150
char * nifti_intent_string(int ii)
Definition nifti1_io.c:1306
int nifti_hdr_looks_good(const nifti_1_header *hdr)
Definition nifti1_io.c:4030
void nifti_image_unload(nifti_image *nim)
Definition nifti1_io.c:5010
float nifti_mat33_rownorm(mat33 A)
Definition nifti1_io.c:1842
void nifti_swap_2bytes(size_t n, void *ar)
Definition nifti1_io.c:2139
float nifti_mat33_determ(mat33 R)
Definition nifti1_io.c:1827
znzFile nifti_image_open(const char *hname, char *opts, nifti_image **nim)
Read in NIFTI-1 or ANALYZE-7.5 file (pair) header information into a nifti_image struct.
Definition nifti1_io.c:3904
void nifti_disp_lib_version(void)
Definition nifti1_io.c:462
void nifti_swap_Nbytes(size_t n, int siz, void *ar)
Definition nifti1_io.c:2245
void nifti_image_infodump(const nifti_image *nim)
Definition nifti1_io.c:5077
char * nifti_slice_string(int ss)
Definition nifti1_io.c:1362
int nifti_disp_type_list(int which)
Definition nifti1_io.c:7483
void nifti_image_write(nifti_image *nim)
Definition nifti1_io.c:5849
int nifti_is_valid_datatype(int dtype)
Definition nifti1_io.c:3347
void nifti_free_NBL(nifti_brick_list *NBL)
Definition nifti1_io.c:783
nifti_image * nifti_convert_nhdr2nim(struct nifti_1_header nhdr, const char *fname)
Definition nifti1_io.c:3599
char * nifti_xform_string(int xx)
Definition nifti1_io.c:1283
char * nifti_image_to_ascii(const nifti_image *nim)
Definition nifti1_io.c:6082
void nifti_disp_lib_hist(void)
Definition nifti1_io.c:452
int nifti_write_all_data(znzFile fp, nifti_image *nim, const nifti_brick_list *NBL)
Definition nifti1_io.c:5129
mat44 nifti_mat44_inverse(mat44 R)
Definition nifti1_io.c:1668
char * nifti_findhdrname(const char *fname)
Definition nifti1_io.c:2735
char * nifti_datatype_string(int dt)
Definition nifti1_io.c:1186
mat33 nifti_mat33_inverse(mat33 R)
Definition nifti1_io.c:1795
nifti_image * nifti_make_new_nim(const int dims[], int datatype, int data_fill)
Definition nifti1_io.c:5363
char * nifti_orientation_string(int ii)
Definition nifti1_io.c:1387
nifti_1_header * nifti_read_header(const char *hname, int *swapped, int check)
Definition nifti1_io.c:3937
struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image *nim)
Definition nifti1_io.c:5407
int nifti_is_complete_filename(const char *fname)
Definition nifti1_io.c:2506
int nifti_datatype_from_string(const char *name)
Definition nifti1_io.c:7380
znzFile nifti_write_ascii_image(nifti_image *nim, const nifti_brick_list *NBL, const char *opts, int write_data, int leave_open)
Definition nifti1_io.c:5798
void nifti_set_debug_level(int level)
Definition nifti1_io.c:2699
int nifti_get_filesize(const char *pathname)
Definition nifti1_io.c:2435
void nifti_mat44_to_orientation(mat44 R, int *icod, int *jcod, int *kcod)
Definition nifti1_io.c:1966
int nifti_nim_has_valid_dims(nifti_image *nim, int complain)
Definition nifti1_io.c:6592
char * nifti_makeimgname(const char *prefix, int nifti_type, int check, int comp)
Definition nifti1_io.c:2985
char * nifti_makebasename(const char *fname)
Definition nifti1_io.c:2680
int nifti_short_order(void)
Definition nifti1_io.c:6321
int valid_nifti_extensions(const nifti_image *nim)
Definition nifti1_io.c:4662
char * nifti_findimgname(const char *fname, int nifti_type)
Definition nifti1_io.c:2833
void nifti_datatype_sizes(int datatype, int *nbyper, int *swapsize)
Definition nifti1_io.c:1413
char * nifti_makehdrname(const char *prefix, int nifti_type, int check, int comp)
Definition nifti1_io.c:2918
int nifti_add_extension(nifti_image *nim, const char *data, int len, int ecode)
Definition nifti1_io.c:4470
int nifti_test_datatype_sizes(int verb)
Definition nifti1_io.c:7444
void nifti_set_iname_offset(nifti_image *nim)
Definition nifti1_io.c:5613
int nifti_update_dims_from_array(nifti_image *nim)
Definition nifti1_io.c:615
int disp_nifti_1_header(const char *info, const nifti_1_header *hp)
Definition nifti1_io.c:3505
nifti_image * nifti_image_from_ascii(const char *str, int *bytes_read)
Definition nifti1_io.c:6361
int nifti_free_extensions(nifti_image *nim)
Definition nifti1_io.c:5050
int nifti_is_valid_ecode(int ecode)
Definition nifti1_io.c:4718
Definition nifti1_io.h:62
Definition nifti1_io.h:58
Data structure defining the fields of a header extension.
Definition nifti1.h:293
Definition nifti1_io.h:187
Definition nifti1_io.h:175
Definition nifti1_io.h:472
High level data structure for open nifti datasets in the nifti1_io API. Note that this structure is n...
Definition nifti1_io.h:88
int slice_code
Definition nifti1_io.h:125
nifti1_extension * ext_list
Definition nifti1_io.h:167
float slice_duration
Definition nifti1_io.h:128
mat44 qto_xyz
Definition nifti1_io.h:136
float intent_p1
Definition nifti1_io.h:151
mat44 sto_ijk
Definition nifti1_io.h:140
float quatern_b
Definition nifti1_io.h:132
int num_ext
Definition nifti1_io.h:166
char * fname
Definition nifti1_io.h:159
int time_units
Definition nifti1_io.h:145
size_t nvox
Definition nifti1_io.h:99
float intent_p3
Definition nifti1_io.h:153
int freq_dim
Definition nifti1_io.h:121
int datatype
Definition nifti1_io.h:101
int intent_code
Definition nifti1_io.h:150
int byteorder
Definition nifti1_io.h:163
int ny
Definition nifti1_io.h:92
int xyz_units
Definition nifti1_io.h:144
float dv
Definition nifti1_io.h:108
mat44 sto_xyz
Definition nifti1_io.h:139
int phase_dim
Definition nifti1_io.h:122
float cal_max
Definition nifti1_io.h:116
mat44 qto_ijk
Definition nifti1_io.h:137
int nbyper
Definition nifti1_io.h:100
float scl_inter
Definition nifti1_io.h:113
float cal_min
Definition nifti1_io.h:115
int nv
Definition nifti1_io.h:96
int iname_offset
Definition nifti1_io.h:161
int nz
Definition nifti1_io.h:93
float dx
Definition nifti1_io.h:103
void * data
Definition nifti1_io.h:164
int sform_code
Definition nifti1_io.h:119
char * iname
Definition nifti1_io.h:160
float intent_p2
Definition nifti1_io.h:152
float du
Definition nifti1_io.h:107
int nt
Definition nifti1_io.h:94
int nu
Definition nifti1_io.h:95
float dt
Definition nifti1_io.h:106
float dw
Definition nifti1_io.h:109
int nx
Definition nifti1_io.h:91
float dz
Definition nifti1_io.h:105
int nifti_type
Definition nifti1_io.h:147
int slice_end
Definition nifti1_io.h:127
int swapsize
Definition nifti1_io.h:162
int ndim
Definition nifti1_io.h:90
int slice_start
Definition nifti1_io.h:126
int qform_code
Definition nifti1_io.h:118
int nw
Definition nifti1_io.h:97
analyze_75_orient_code analyze75_orient
Definition nifti1_io.h:168
float toffset
Definition nifti1_io.h:142
int slice_dim
Definition nifti1_io.h:123
float scl_slope
Definition nifti1_io.h:112
float dy
Definition nifti1_io.h:104
Definition nifti1_io.h:478