6 #ifndef _NIFTI_IO_HEADER_ 7 #define _NIFTI_IO_HEADER_ 15 #ifndef DONT_INCLUDE_ANALYZE_STRUCT 16 #define DONT_INCLUDE_ANALYZE_STRUCT 72 typedef 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);
347 size_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 ) ;
393 struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image* nim);
417 int nifti_copy_extensions (nifti_image *nim_dest,
const nifti_image *nim_src);
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;
490 } nifti_global_options;
496 char const *
const name;
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 void nifti_image_free(nifti_image *nim)
Definition: nifti1_io.c:5054
char const * nifti_intent_string(int ii)
Definition: nifti1_io.c:1307
const char * nifti_datatype_to_string(int dtype)
Definition: nifti1_io.c:7426
int slice_start
Definition: nifti1_io.h:126
char * nifti_findimgname(const char *fname, int nifti_type)
Definition: nifti1_io.c:2846
Official definition of the nifti1 header. Written by Bob Cox, SSCC, NIMH.
void nifti_set_iname_offset(nifti_image *nim)
Definition: nifti1_io.c:5639
nifti_image * nifti_image_from_ascii(const char *str, int *bytes_read)
Definition: nifti1_io.c:6387
float nifti_mat33_colnorm(mat33 A)
Definition: nifti1_io.c:1858
mat44 qto_xyz
Definition: nifti1_io.h:136
void nifti_set_skip_blank_ext(int skip)
Definition: nifti1_io.c:2721
int nifti_disp_matrix_orient(const char *mesg, mat44 mat)
Definition: nifti1_io.c:1133
float nifti_mat33_determ(mat33 R)
Definition: nifti1_io.c:1828
char * nifti_makehdrname(const char *prefix, int nifti_type, int check, int comp)
Definition: nifti1_io.c:2931
void swap_nifti_header(struct nifti_1_header *h, int is_nifti)
Definition: nifti1_io.c:2267
int is_nifti_file(const char *hname)
Definition: nifti1_io.c:3456
analyze_75_orient_code analyze75_orient
Definition: nifti1_io.h:168
int nifti_is_valid_ecode(int ecode)
Definition: nifti1_io.c:4744
void old_swap_nifti_header(struct nifti_1_header *h, int is_nifti)
Definition: nifti1_io.c:2386
int disp_nifti_1_header(const char *info, const nifti_1_header *hp)
Definition: nifti1_io.c:3523
void nifti_swap_8bytes(size_t n, void *ar)
Definition: nifti1_io.c:2178
int nifti_is_inttype(int dt)
Definition: nifti1_io.c:1219
char const * nifti_xform_string(int xx)
Definition: nifti1_io.c:1284
Definition: nifti1_io.h:175
float intent_p3
Definition: nifti1_io.h:153
float scl_inter
Definition: nifti1_io.h:113
int phase_dim
Definition: nifti1_io.h:122
float dy
Definition: nifti1_io.h:104
char * nifti_find_file_extension(const char *name)
Definition: nifti1_io.c:2590
int nifti_datatype_from_string(const char *name)
Definition: nifti1_io.c:7406
float dx
Definition: nifti1_io.h:103
void nifti_datatype_sizes(int datatype, int *nbyper, int *swapsize)
Definition: nifti1_io.c:1414
int nifti_read_collapsed_image(nifti_image *nim, const int dims [8], void **data)
Definition: nifti1_io.c:6768
int swapsize
Definition: nifti1_io.h:162
void nifti_image_write(nifti_image *nim)
Definition: nifti1_io.c:5875
float dt
Definition: nifti1_io.h:106
char * nifti_makeimgname(const char *prefix, int nifti_type, int check, int comp)
Definition: nifti1_io.c:3001
void nifti_mat44_to_orientation(mat44 R, int *icod, int *jcod, int *kcod)
Definition: nifti1_io.c:1967
int nifti_image_load(nifti_image *nim)
Load the image blob into a previously initialized nifti_image.
Definition: nifti1_io.c:4892
int nifti_is_valid_datatype(int dtype)
Definition: nifti1_io.c:3365
High level data structure for open nifti datasets in the nifti1_io API. Note that this structure is n...
Definition: nifti1_io.h:88
size_t nvox
Definition: nifti1_io.h:99
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:3930
int nifti_disp_type_list(int which)
Definition: nifti1_io.c:7509
nifti_image * nifti_image_read_bricks(const char *hname, int nbricks, const int *blist, nifti_brick_list *NBL)
Definition: nifti1_io.c:532
Definition: nifti1_io.h:62
void nifti_swap_4bytes(size_t n, void *ar)
Definition: nifti1_io.c:2157
int nv
Definition: nifti1_io.h:96
int datatype
Definition: nifti1_io.h:101
nifti_image * nifti_make_new_nim(const int dims[], int datatype, int data_fill)
Definition: nifti1_io.c:5389
int nifti_update_dims_from_array(nifti_image *nim)
Definition: nifti1_io.c:616
int nifti_test_datatype_sizes(int verb)
Definition: nifti1_io.c:7470
char * nifti_findhdrname(const char *fname)
Definition: nifti1_io.c:2747
int nifti_is_gzfile(const char *fname)
Definition: nifti1_io.c:2656
int nifti_free_extensions(nifti_image *nim)
Definition: nifti1_io.c:5076
float du
Definition: nifti1_io.h:107
int nu
Definition: nifti1_io.h:95
int valid_nifti_extensions(const nifti_image *nim)
Definition: nifti1_io.c:4688
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:1538
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:5824
nifti_1_header * nifti_read_header(const char *hname, int *swapped, int check)
Definition: nifti1_io.c:3963
int nifti_compiled_with_zlib(void)
Definition: nifti1_io.c:2674
float cal_max
Definition: nifti1_io.h:116
float slice_duration
Definition: nifti1_io.h:128
int is_valid_nifti_type(int nifti_type)
Definition: nifti1_io.c:3347
int nw
Definition: nifti1_io.h:97
void nifti_image_unload(nifti_image *nim)
Definition: nifti1_io.c:5036
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:1738
float dv
Definition: nifti1_io.h:108
int nifti_hdr_looks_good(const nifti_1_header *hdr)
Definition: nifti1_io.c:4056
float dw
Definition: nifti1_io.h:109
char const * nifti_datatype_string(int dt)
Definition: nifti1_io.c:1187
int ndim
Definition: nifti1_io.h:90
nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype)
Definition: nifti1_io.c:5310
znzFile nifti_image_write_hdr_img(nifti_image *nim, int write_data, const char *opts)
Definition: nifti1_io.c:5683
mat33 nifti_mat33_inverse(mat33 R)
Definition: nifti1_io.c:1796
int qform_code
Definition: nifti1_io.h:118
int nifti_add_extension(nifti_image *nim, const char *data, int len, int ecode)
Definition: nifti1_io.c:4496
int freq_dim
Definition: nifti1_io.h:121
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:5721
int nifti_nim_has_valid_dims(nifti_image *nim, int complain)
Definition: nifti1_io.c:6618
mat33 nifti_mat33_mul(mat33 A, mat33 B)
Definition: nifti1_io.c:1873
int time_units
Definition: nifti1_io.h:145
int nifti_type_and_names_match(nifti_image *nim, int show_warn)
Definition: nifti1_io.c:3125
int nifti_set_filenames(nifti_image *nim, const char *prefix, int check, int set_byte_order)
Definition: nifti1_io.c:3073
int iname_offset
Definition: nifti1_io.h:161
int sform_code
Definition: nifti1_io.h:119
Definition: nifti1_io.h:58
float nifti_mat33_rownorm(mat33 A)
Definition: nifti1_io.c:1843
mat44 sto_xyz
Definition: nifti1_io.h:139
void nifti_set_allow_upper_fext(int allow)
Definition: nifti1_io.c:2731
void nifti_disp_lib_hist(void)
Definition: nifti1_io.c:453
void nifti_swap_Nbytes(size_t n, int siz, void *ar)
Definition: nifti1_io.c:2246
int nifti_get_filesize(const char *pathname)
Definition: nifti1_io.c:2436
int * nifti_get_intlist(int nvals, const char *str)
Definition: nifti1_io.c:7233
int byteorder
Definition: nifti1_io.h:163
int nifti_datatype_is_valid(int dtype, int for_nifti)
Definition: nifti1_io.c:7447
nifti_image * nifti_convert_nhdr2nim(struct nifti_1_header nhdr, const char *fname)
Definition: nifti1_io.c:3617
void nifti_disp_lib_version(void)
Definition: nifti1_io.c:463
int intent_code
Definition: nifti1_io.h:150
float intent_p1
Definition: nifti1_io.h:151
nifti_image * nifti_read_ascii_image(znzFile fp, char *fname, int flen, int read_data)
Definition: nifti1_io.c:4318
void nifti_swap_2bytes(size_t n, void *ar)
Definition: nifti1_io.c:2140
int slice_code
Definition: nifti1_io.h:125
int nz
Definition: nifti1_io.h:93
void nifti_image_infodump(const nifti_image *nim)
Definition: nifti1_io.c:5103
mat33 nifti_mat33_polar(mat33 A)
Definition: nifti1_io.c:1892
int nifti_type
Definition: nifti1_io.h:147
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:4176
void nifti_set_debug_level(int level)
Definition: nifti1_io.c:2711
size_t nifti_get_volsize(const nifti_image *nim)
Definition: nifti1_io.c:2465
nifti_image * nifti_copy_nim_info(const nifti_image *src)
Definition: nifti1_io.c:5908
int nifti_set_type_from_names(nifti_image *nim)
Definition: nifti1_io.c:3397
size_t nifti_read_buffer(znzFile fp, void *datatptr, size_t ntot, nifti_image *nim)
Definition: nifti1_io.c:4954
int nifti_image_load_bricks(nifti_image *nim, int nbricks, const int *blist, nifti_brick_list *NBL)
Definition: nifti1_io.c:720
float toffset
Definition: nifti1_io.h:142
char const * nifti_units_string(int uu)
Definition: nifti1_io.c:1256
void nifti_image_write_bricks(nifti_image *nim, const nifti_brick_list *NBL)
Definition: nifti1_io.c:5891
int nt
Definition: nifti1_io.h:94
int nifti_nim_is_valid(nifti_image *nim, int complain)
Definition: nifti1_io.c:6585
char const * nifti_slice_string(int ss)
Definition: nifti1_io.c:1363
int nifti_short_order(void)
Definition: nifti1_io.c:6347
char * nifti_image_to_ascii(const nifti_image *nim)
Definition: nifti1_io.c:6108
float scl_slope
Definition: nifti1_io.h:112
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:1467
int ny
Definition: nifti1_io.h:92
void nifti_swap_16bytes(size_t n, void *ar)
Definition: nifti1_io.c:2199
float cal_min
Definition: nifti1_io.h:115
mat44 qto_ijk
Definition: nifti1_io.h:137
int nifti_read_subregion_image(nifti_image *nim, int *start_index, int *region_size, void **data)
Definition: nifti1_io.c:6873
float dz
Definition: nifti1_io.h:105
int nifti_swap_as_analyze(nifti_analyze75 *h)
Definition: nifti1_io.c:2328
char * fname
Definition: nifti1_io.h:159
nifti1_extension * ext_list
Definition: nifti1_io.h:167
void nifti_free_NBL(nifti_brick_list *NBL)
Definition: nifti1_io.c:784
Definition: nifti1_io.h:187
int nifti_validfilename(const char *fname)
Definition: nifti1_io.c:2551
char * iname
Definition: nifti1_io.h:160
int nbyper
Definition: nifti1_io.h:100
void * data
Definition: nifti1_io.h:164
nifti_image * nifti_simple_init_nim(void)
Definition: nifti1_io.c:5267
mat44 nifti_mat44_inverse(mat44 R)
Definition: nifti1_io.c:1669
int slice_end
Definition: nifti1_io.h:127
int slice_dim
Definition: nifti1_io.h:123
int valid_nifti_brick_list(nifti_image *nim, int nbricks, const int *blist, int disp_error)
Definition: nifti1_io.c:1026
char * nifti_makebasename(const char *fname)
Definition: nifti1_io.c:2688
char * nifti_strdup(const char *str)
Definition: nifti1_io.c:1158
int nifti_write_all_data(znzFile fp, nifti_image *nim, const nifti_brick_list *NBL)
Definition: nifti1_io.c:5155
Data structure defining the fields of a header extension.
Definition: nifti1.h:293
char const * nifti_orientation_string(int ii)
Definition: nifti1_io.c:1388
mat44 sto_ijk
Definition: nifti1_io.h:140
int num_ext
Definition: nifti1_io.h:166
float intent_p2
Definition: nifti1_io.h:152
float quatern_b
Definition: nifti1_io.h:132
int nx
Definition: nifti1_io.h:91
int xyz_units
Definition: nifti1_io.h:144
int nifti_is_complete_filename(const char *fname)
Definition: nifti1_io.c:2507