Loading...
Searching...
No Matches
nifti1_io.h
Go to the documentation of this file.
#ifndef _NIFTI_IO_HEADER_
#define _NIFTI_IO_HEADER_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#ifndef DONT_INCLUDE_ANALYZE_STRUCT
#define DONT_INCLUDE_ANALYZE_STRUCT /*** not needed herein ***/
#endif
#include "nifti1.h" /*** NIFTI-1 header specification ***/
#include <znzlib.h>
/*=================*/
#ifdef __cplusplus
extern "C" {
#endif
/*=================*/
/*****===================================================================*****/
/***** File nifti1_io.h == Declarations for nifti1_io.c *****/
/*****...................................................................*****/
/***** This code is released to the public domain. *****/
/*****...................................................................*****/
/***** Author: Robert W Cox, SSCC/DIRP/NIMH/NIH/DHHS/USA/EARTH *****/
/***** Date: August 2003 *****/
/*****...................................................................*****/
/***** Neither the National Institutes of Health (NIH), nor any of its *****/
/***** employees imply any warranty of usefulness of this software for *****/
/***** any purpose, and do not assume any liability for damages, *****/
/***** incidental or otherwise, caused by any use of this document. *****/
/*****===================================================================*****/
/*
Modified by: Mark Jenkinson (FMRIB Centre, University of Oxford, UK)
Date: July/August 2004
Mainly adding low-level IO and changing things to allow gzipped files
to be read and written
Full backwards compatability should have been maintained
Modified by: Rick Reynolds (SSCC/DIRP/NIMH, National Institutes of Health)
Date: December 2004
Modified and added many routines for I/O.
*/
/********************** Some sample data structures **************************/
typedef struct {
float m[4][4] ;
} mat44 ;
typedef struct {
float m[3][3] ;
} mat33 ;
/*...........................................................................*/
typedef enum _analyze75_orient_code {
a75_transverse_unflipped = 0,
a75_coronal_unflipped = 1,
a75_sagittal_unflipped = 2,
a75_transverse_flipped = 3,
a75_coronal_flipped = 4,
a75_sagittal_flipped = 5,
a75_orient_unknown = 6
} analyze_75_orient_code;
typedef struct {
int ndim ;
int nx ;
int ny ;
int nz ;
int nt ;
int nu ;
int nv ;
int nw ;
int dim[8] ;
size_t nvox ;
int nbyper ;
int datatype ;
float dx ;
float dy ;
float dz ;
float dt ;
float du ;
float dv ;
float dw ;
float pixdim[8] ;
float scl_slope ;
float scl_inter ;
float cal_min ;
float cal_max ;
int qform_code ;
int sform_code ;
int freq_dim ;
int phase_dim ;
int slice_dim ;
int slice_code ;
int slice_start ;
int slice_end ;
float slice_duration ;
float quatern_b , quatern_c , quatern_d ,
qoffset_x , qoffset_y , qoffset_z ,
qfac ;
mat44 qto_xyz ;
mat44 qto_ijk ;
mat44 sto_xyz ;
mat44 sto_ijk ;
float toffset ;
int xyz_units ;
int time_units ;
int nifti_type ;
int intent_code ;
float intent_p1 ;
float intent_p2 ;
float intent_p3 ;
char intent_name[16] ;
char descrip[80] ;
char aux_file[24] ;
char *fname ;
char *iname ;
int iname_offset ;
int swapsize ;
int byteorder ;
void *data ;
int num_ext ;
nifti1_extension * ext_list ;
analyze_75_orient_code analyze75_orient;
} nifti_image ;
/* struct for return from nifti_image_read_bricks() */
typedef struct {
int nbricks; /* the number of allocated pointers in 'bricks' */
size_t bsize; /* the length of each data block, in bytes */
void ** bricks; /* array of pointers to data blocks */
} nifti_brick_list;
/*****************************************************************************/
/*------------------ NIfTI version of ANALYZE 7.5 structure -----------------*/
/* (based on fsliolib/dbh.h, but updated for version 7.5) */
typedef struct {
/* header info fields - describes the header overlap with NIfTI */
/* ------------------ */
int sizeof_hdr; /* 0 + 4 same */
char data_type[10]; /* 4 + 10 same */
char db_name[18]; /* 14 + 18 same */
int extents; /* 32 + 4 same */
short int session_error; /* 36 + 2 same */
char regular; /* 38 + 1 same */
char hkey_un0; /* 39 + 1 40 bytes */
/* image dimension fields - describes image sizes */
short int dim[8]; /* 0 + 16 same */
short int unused8; /* 16 + 2 intent_p1... */
short int unused9; /* 18 + 2 ... */
short int unused10; /* 20 + 2 intent_p2... */
short int unused11; /* 22 + 2 ... */
short int unused12; /* 24 + 2 intent_p3... */
short int unused13; /* 26 + 2 ... */
short int unused14; /* 28 + 2 intent_code */
short int datatype; /* 30 + 2 same */
short int bitpix; /* 32 + 2 same */
short int dim_un0; /* 34 + 2 slice_start */
float pixdim[8]; /* 36 + 32 same */
float vox_offset; /* 68 + 4 same */
float funused1; /* 72 + 4 scl_slope */
float funused2; /* 76 + 4 scl_inter */
float funused3; /* 80 + 4 slice_end, */
/* slice_code, */
/* xyzt_units */
float cal_max; /* 84 + 4 same */
float cal_min; /* 88 + 4 same */
float compressed; /* 92 + 4 slice_duration */
float verified; /* 96 + 4 toffset */
int glmax,glmin; /* 100 + 8 108 bytes */
/* data history fields - optional */
char descrip[80]; /* 0 + 80 same */
char aux_file[24]; /* 80 + 24 same */
char orient; /* 104 + 1 NO GOOD OVERLAP */
char originator[10]; /* 105 + 10 FROM HERE DOWN... */
char generated[10]; /* 115 + 10 */
char scannum[10]; /* 125 + 10 */
char patient_id[10]; /* 135 + 10 */
char exp_date[10]; /* 145 + 10 */
char exp_time[10]; /* 155 + 10 */
char hist_un0[3]; /* 165 + 3 */
int views; /* 168 + 4 */
int vols_added; /* 172 + 4 */
int start_field; /* 176 + 4 */
int field_skip; /* 180 + 4 */
int omax, omin; /* 184 + 8 */
int smax, smin; /* 192 + 8 200 bytes */
} nifti_analyze75; /* total: 348 bytes */
/*****************************************************************************/
/*--------------- Prototypes of functions defined in this file --------------*/
char const * nifti_datatype_string ( int dt ) ;
char const *nifti_units_string ( int uu ) ;
char const *nifti_intent_string ( int ii ) ;
char const *nifti_xform_string ( int xx ) ;
char const *nifti_slice_string ( int ss ) ;
char const *nifti_orientation_string( int ii ) ;
int nifti_is_inttype( int dt ) ;
mat44 nifti_mat44_inverse( mat44 R ) ;
mat33 nifti_mat33_inverse( mat33 R ) ;
mat33 nifti_mat33_polar ( mat33 A ) ;
float nifti_mat33_rownorm( mat33 A ) ;
float nifti_mat33_colnorm( mat33 A ) ;
float nifti_mat33_determ ( mat33 R ) ;
mat33 nifti_mat33_mul ( mat33 A , mat33 B ) ;
void nifti_swap_2bytes ( size_t n , void *ar ) ;
void nifti_swap_4bytes ( size_t n , void *ar ) ;
void nifti_swap_8bytes ( size_t n , void *ar ) ;
void nifti_swap_16bytes( size_t n , void *ar ) ;
void nifti_swap_Nbytes ( size_t n , int siz , void *ar ) ;
int nifti_datatype_is_valid (int dtype, int for_nifti);
int nifti_datatype_from_string(const char * name);
const char * nifti_datatype_to_string (int dtype);
int nifti_get_filesize( const char *pathname ) ;
void swap_nifti_header ( struct nifti_1_header *h , int is_nifti ) ;
void old_swap_nifti_header( struct nifti_1_header *h , int is_nifti );
int nifti_swap_as_analyze( nifti_analyze75 *h );
/* main read/write routines */
nifti_image *nifti_image_read_bricks(const char *hname , int nbricks,
const int *blist, nifti_brick_list * NBL);
int nifti_image_load_bricks(nifti_image *nim , int nbricks,
const int *blist, nifti_brick_list * NBL);
void nifti_free_NBL( nifti_brick_list * NBL );
nifti_image *nifti_image_read ( const char *hname , int read_data ) ;
int nifti_image_load ( nifti_image *nim ) ;
void nifti_image_unload ( nifti_image *nim ) ;
void nifti_image_free ( nifti_image *nim ) ;
int nifti_read_collapsed_image( nifti_image * nim, const int dims [8],
void ** data );
int nifti_read_subregion_image( nifti_image * nim,
const int *start_index, const int *region_size,
void ** data );
void nifti_image_write ( nifti_image * nim ) ;
void nifti_image_write_bricks(nifti_image * nim,
const nifti_brick_list * NBL);
void nifti_image_infodump( const nifti_image * nim ) ;
void nifti_disp_lib_hist( void ) ; /* to display library history */
void nifti_disp_lib_version( void ) ; /* to display library version */
int nifti_disp_matrix_orient( const char * mesg, mat44 mat );
int nifti_disp_type_list( int which );
char * nifti_image_to_ascii ( const nifti_image * nim ) ;
nifti_image *nifti_image_from_ascii( const char * str, int * bytes_read ) ;
size_t nifti_get_volsize(const nifti_image *nim) ;
/* basic file operations */
int nifti_set_filenames(nifti_image * nim, const char * prefix, int check,
int set_byte_order);
char * nifti_makehdrname (const char * prefix, int nifti_type, int check,
int comp);
char * nifti_makeimgname (const char * prefix, int nifti_type, int check,
int comp);
int is_nifti_file (const char *hname);
char * nifti_find_file_extension(const char * name);
int nifti_is_complete_filename(const char* fname);
int nifti_validfilename(const char* fname);
int disp_nifti_1_header(const char * info, const nifti_1_header * hp ) ;
void nifti_set_debug_level( int level ) ;
void nifti_set_skip_blank_ext( int skip ) ;
void nifti_set_allow_upper_fext( int allow ) ;
int valid_nifti_brick_list(nifti_image * nim , int nbricks,
const int * blist, int disp_error);
/* znzFile operations */
znzFile nifti_image_open(const char * hname, const char * opts, nifti_image ** nim);
znzFile nifti_image_write_hdr_img(nifti_image *nim, int write_data,
const char* opts);
znzFile nifti_image_write_hdr_img2( nifti_image *nim , int write_opts ,
const char* opts, znzFile imgfile, const nifti_brick_list * NBL);
size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot,
nifti_image *nim);
int nifti_write_all_data(znzFile fp, nifti_image * nim,
const nifti_brick_list * NBL);
size_t nifti_write_buffer(znzFile fp, const void * buffer, size_t numbytes);
nifti_image *nifti_read_ascii_image(znzFile fp, char *fname, int flen,
int read_data);
znzFile nifti_write_ascii_image(nifti_image *nim, const nifti_brick_list * NBL,
const char * opts, int write_data, int leave_open);
void nifti_datatype_sizes( int datatype , int *nbyper, int *swapsize ) ;
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 ) ;
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 );
mat44 nifti_make_orthog_mat44( float r11, float r12, float r13 ,
float r21, float r22, float r23 ,
float r31, float r32, float r33 ) ;
int nifti_short_order(void) ; /* CPU byte order */
/* Orientation codes that might be returned from nifti_mat44_to_orientation().*/
#define NIFTI_L2R 1 /* Left to Right */
#define NIFTI_R2L 2 /* Right to Left */
#define NIFTI_P2A 3 /* Posterior to Anterior */
#define NIFTI_A2P 4 /* Anterior to Posterior */
#define NIFTI_I2S 5 /* Inferior to Superior */
#define NIFTI_S2I 6 /* Superior to Inferior */
void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) ;
/*--------------------- Low level IO routines ------------------------------*/
char * nifti_findhdrname (const char* fname);
char * nifti_findimgname (const char* fname , int nifti_type);
int nifti_is_gzfile (const char* fname);
char * nifti_makebasename(const char* fname);
/* other routines */
struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image* nim);
nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype);
nifti_1_header * nifti_read_header(const char *hname, int *swapped, int check);
nifti_image * nifti_copy_nim_info(const nifti_image * src);
nifti_image * nifti_make_new_nim(const int dims[], int datatype,
int data_fill);
nifti_image * nifti_simple_init_nim(void);
nifti_image * nifti_convert_nhdr2nim(struct nifti_1_header nhdr,
const char * fname);
int nifti_hdr_looks_good (const nifti_1_header * hdr);
int nifti_is_valid_datatype (int dtype);
int nifti_is_valid_ecode (int ecode);
int nifti_nim_is_valid (nifti_image * nim, int complain);
int nifti_nim_has_valid_dims (nifti_image * nim, int complain);
int is_valid_nifti_type (int nifti_type);
int nifti_test_datatype_sizes (int verb);
int nifti_type_and_names_match (nifti_image * nim, int show_warn);
int nifti_update_dims_from_array(nifti_image * nim);
void nifti_set_iname_offset (nifti_image *nim);
int nifti_set_type_from_names (nifti_image * nim);
int nifti_add_extension(nifti_image * nim, const char * data, int len,
int ecode );
int nifti_compiled_with_zlib (void);
int nifti_copy_extensions (nifti_image *nim_dest,const nifti_image *nim_src);
int nifti_free_extensions (nifti_image *nim);
int * nifti_get_intlist (int nvals , const char *str);
char * nifti_strdup (const char *str);
int valid_nifti_extensions(const nifti_image *nim);
/*-------------------- Some C convenience macros ----------------------------*/
/* NIfTI-1.1 extension codes:
see http://nifti.nimh.nih.gov/nifti-1/documentation/faq#Q21 */
#define NIFTI_ECODE_IGNORE 0 /* changed from UNKNOWN, 29 June 2005 */
#define NIFTI_ECODE_DICOM 2 /* intended for raw DICOM attributes */
#define NIFTI_ECODE_AFNI 4 /* Robert W Cox: rwcox@nih.gov
https://afni.nimh.nih.gov/afni */
#define NIFTI_ECODE_COMMENT 6 /* plain ASCII text only */
#define NIFTI_ECODE_XCEDE 8 /* David B Keator: dbkeator@uci.edu
http://www.nbirn.net/Resources
/Users/Applications/
/xcede/index.htm */
#define NIFTI_ECODE_JIMDIMINFO 10 /* Mark A Horsfield:
mah5@leicester.ac.uk
http://someplace/something */
#define NIFTI_ECODE_WORKFLOW_FWDS 12 /* Kate Fissell: fissell@pitt.edu
http://kraepelin.wpic.pitt.edu
/~fissell/NIFTI_ECODE_WORKFLOW_FWDS
/NIFTI_ECODE_WORKFLOW_FWDS.html */
#define NIFTI_ECODE_FREESURFER 14 /* http://surfer.nmr.mgh.harvard.edu */
#define NIFTI_ECODE_PYPICKLE 16 /* embedded Python objects
http://niftilib.sourceforge.net
/pynifti */
/* LONI MiND codes: http://www.loni.ucla.edu/twiki/bin/view/Main/MiND */
#define NIFTI_ECODE_MIND_IDENT 18 /* Vishal Patel: vishal.patel@ucla.edu*/
#define NIFTI_ECODE_B_VALUE 20
#define NIFTI_ECODE_SPHERICAL_DIRECTION 22
#define NIFTI_ECODE_DT_COMPONENT 24
#define NIFTI_ECODE_SHC_DEGREEORDER 26 /* end LONI MiND codes */
#define NIFTI_ECODE_VOXBO 28 /* Dan Kimberg: www.voxbo.org */
#define NIFTI_ECODE_CARET 30 /* John Harwell: john@brainvis.wustl.edu
http://brainvis.wustl.edu/wiki
/index.php/Caret:Documentation
:CaretNiftiExtension */
#define NIFTI_ECODE_CIFTI 32 /* CIFTI-2_Main_FINAL_1March2014.pdf */
#define NIFTI_ECODE_VARIABLE_FRAME_TIMING 34
/* 36 is currently unassigned, waiting on NIFTI_ECODE_AGILENT_PROCPAR */
#define NIFTI_ECODE_EVAL 38 /* Munster University Hospital */
/* http://www.mathworks.com/matlabcentral/fileexchange/42997-dicom-to-nifti-converter */
#define NIFTI_ECODE_MATLAB 40 /* MATLAB extension */
/* Quantiphyse extension
https://quantiphyse.readthedocs.io/en/latest/advanced/nifti_extension.html*/
#define NIFTI_ECODE_QUANTIPHYSE 42 /* Quantiphyse extension */
/* Magnetic Resonance Spectroscopy (MRS)
link to come... */
#define NIFTI_ECODE_MRS 44 /* MRS extension */
#define NIFTI_MAX_ECODE 44 /******* maximum extension code *******/
/* nifti_type file codes */
#define NIFTI_FTYPE_ANALYZE 0
#define NIFTI_FTYPE_NIFTI1_1 1
#define NIFTI_FTYPE_NIFTI1_2 2
#define NIFTI_FTYPE_ASCII 3
#define NIFTI_MAX_FTYPE 3 /* this should match the maximum code */
/*------------------------------------------------------------------------*/
/*-- the rest of these apply only to nifti1_io.c, check for _NIFTI1_IO_C_ */
/* Feb 9, 2005 [rickr] */
#ifdef _NIFTI1_IO_C_
typedef struct {
int debug;
int skip_blank_ext;
int allow_upper_fext;
} nifti_global_options;
typedef struct {
int type; /* should match the NIFTI_TYPE_ #define */
int nbyper; /* bytes per value, matches nifti_image */
int swapsize; /* bytes per swap piece, matches nifti_image */
char const * const name; /* text string to match #define */
} nifti_type_ele;
#undef LNI_FERR /* local nifti file error, to be compact and repetative */
#define LNI_FERR(func,msg,file) \
fprintf(stderr,"** ERROR (%s): %s '%s'\n",func,msg,file)
#undef swap_2
#undef swap_4
#define swap_2(s) nifti_swap_2bytes(1,&(s)) /* s: 2-byte short; swap in place */
#define swap_4(v) nifti_swap_4bytes(1,&(v)) /* v: 4-byte value; swap in place */
/***** isfinite() is a C99 macro, which is
present in many C implementations already *****/
#undef IS_GOOD_FLOAT
#undef FIXED_FLOAT
#ifdef isfinite /* use isfinite() to check floats/doubles for goodness */
# define IS_GOOD_FLOAT(x) isfinite(x) /* check if x is a "good" float */
# define FIXED_FLOAT(x) (isfinite(x) ? (x) : 0) /* fixed if bad */
#else
# define IS_GOOD_FLOAT(x) 1 /* don't check it */
# define FIXED_FLOAT(x) (x) /* don't fix it */
#endif
#undef ASSIF /* assign v to *p, if possible */
#define ASSIF(p,v) if( (p)!=NULL ) *(p) = (v)
#undef MSB_FIRST
#undef LSB_FIRST
#undef REVERSE_ORDER
#define LSB_FIRST 1
#define MSB_FIRST 2
#define REVERSE_ORDER(x) (3-(x)) /* convert MSB_FIRST <--> LSB_FIRST */
#define LNI_MAX_NIA_EXT_LEN 100000 /* consider a longer extension invalid */
#endif /* _NIFTI1_IO_C_ section */
/*------------------------------------------------------------------------*/
/*=================*/
#ifdef __cplusplus
}
#endif
/*=================*/
#endif /* _NIFTI_IO_HEADER_ */
nifti_1_header::datatype
short datatype
Definition nifti1.h:169
nifti1.h
Official definition of the nifti1 header. Written by Bob Cox, SSCC, NIMH.
nifti_convert_nim2nhdr
struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image *nim)
Definition nifti1_io.c:5429
nifti_make_new_header
nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype)
Definition nifti1_io.c:5306
nifti_copy_nim_info
nifti_image * nifti_copy_nim_info(const nifti_image *src)
Definition nifti1_io.c:5904
nifti_image_write_hdr_img
znzFile nifti_image_write_hdr_img(nifti_image *nim, int write_data, const char *opts)
Definition nifti1_io.c:5679
nifti_get_volsize
size_t nifti_get_volsize(const nifti_image *nim)
Definition nifti1_io.c:2460
nifti_swap_as_analyze
int nifti_swap_as_analyze(nifti_analyze75 *h)
Definition nifti1_io.c:2324
nifti_read_collapsed_image
int nifti_read_collapsed_image(nifti_image *nim, const int dims[8], void **data)
Definition nifti1_io.c:6776
nifti_get_intlist
int * nifti_get_intlist(int nvals, const char *str)
Definition nifti1_io.c:7245
nifti_strdup
char * nifti_strdup(const char *str)
Definition nifti1_io.c:1164
nifti_set_skip_blank_ext
void nifti_set_skip_blank_ext(int skip)
Definition nifti1_io.c:2716
nifti_datatype_string
char const * nifti_datatype_string(int dt)
Definition nifti1_io.c:1193
nifti_simple_init_nim
nifti_image * nifti_simple_init_nim(void)
Definition nifti1_io.c:5263
nifti_image_open
znzFile nifti_image_open(const char *hname, const 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:3927
nifti_image_write_hdr_img2
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:5717
is_nifti_file
int is_nifti_file(const char *hname)
Definition nifti1_io.c:3453
nifti_set_filenames
int nifti_set_filenames(nifti_image *nim, const char *prefix, int check, int set_byte_order)
Definition nifti1_io.c:3068
nifti_find_file_extension
char * nifti_find_file_extension(const char *name)
Definition nifti1_io.c:2585
nifti_is_inttype
int nifti_is_inttype(int dt)
Definition nifti1_io.c:1225
nifti_units_string
char const * nifti_units_string(int uu)
Definition nifti1_io.c:1262
nifti_image_load
int nifti_image_load(nifti_image *nim)
Load the image blob into a previously initialized nifti_image.
Definition nifti1_io.c:4891
nifti_image_free
void nifti_image_free(nifti_image *nim)
Definition nifti1_io.c:5052
nifti_disp_matrix_orient
int nifti_disp_matrix_orient(const char *mesg, mat44 mat)
Definition nifti1_io.c:1139
nifti_mat33_polar
mat33 nifti_mat33_polar(mat33 A)
Definition nifti1_io.c:1896
nifti_read_ascii_image
nifti_image * nifti_read_ascii_image(znzFile fp, char *fname, int flen, int read_data)
Definition nifti1_io.c:4319
valid_nifti_brick_list
int valid_nifti_brick_list(nifti_image *nim, int nbricks, const int *blist, int disp_error)
Definition nifti1_io.c:1032
nifti_orientation_string
char const * nifti_orientation_string(int ii)
Definition nifti1_io.c:1394
nifti_mat33_mul
mat33 nifti_mat33_mul(mat33 A, mat33 B)
Definition nifti1_io.c:1877
nifti_type_and_names_match
int nifti_type_and_names_match(nifti_image *nim, int show_warn)
Definition nifti1_io.c:3120
nifti_quatern_to_mat44
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:1472
nifti_mat33_colnorm
float nifti_mat33_colnorm(mat33 A)
Definition nifti1_io.c:1862
swap_nifti_header
void swap_nifti_header(struct nifti_1_header *h, int is_nifti)
Definition nifti1_io.c:2265
nifti_swap_4bytes
void nifti_swap_4bytes(size_t n, void *ar)
Definition nifti1_io.c:2159
nifti_image_read_bricks
nifti_image * nifti_image_read_bricks(const char *hname, int nbricks, const int *blist, nifti_brick_list *NBL)
Definition nifti1_io.c:538
nifti_datatype_is_valid
int nifti_datatype_is_valid(int dtype, int for_nifti)
Definition nifti1_io.c:7465
is_valid_nifti_type
int is_valid_nifti_type(int nifti_type)
Definition nifti1_io.c:3344
nifti_set_type_from_names
int nifti_set_type_from_names(nifti_image *nim)
Definition nifti1_io.c:3394
nifti_swap_16bytes
void nifti_swap_16bytes(size_t n, void *ar)
Definition nifti1_io.c:2199
nifti_swap_8bytes
void nifti_swap_8bytes(size_t n, void *ar)
Definition nifti1_io.c:2179
nifti_compiled_with_zlib
int nifti_compiled_with_zlib(void)
Definition nifti1_io.c:2669
old_swap_nifti_header
void old_swap_nifti_header(struct nifti_1_header *h, int is_nifti)
Definition nifti1_io.c:2382
nifti_is_gzfile
int nifti_is_gzfile(const char *fname)
Definition nifti1_io.c:2651
nifti_image_load_bricks
int nifti_image_load_bricks(nifti_image *nim, int nbricks, const int *blist, nifti_brick_list *NBL)
Definition nifti1_io.c:726
nifti_validfilename
int nifti_validfilename(const char *fname)
Definition nifti1_io.c:2546
nifti_mat44_to_quatern
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:1543
nifti_set_allow_upper_fext
void nifti_set_allow_upper_fext(int allow)
Definition nifti1_io.c:2726
nifti_image_write_bricks
void nifti_image_write_bricks(nifti_image *nim, const nifti_brick_list *NBL)
Definition nifti1_io.c:5887
nifti_make_orthog_mat44
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:1742
nifti_nim_is_valid
int nifti_nim_is_valid(nifti_image *nim, int complain)
Definition nifti1_io.c:6593
nifti_image_read
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:4173
nifti_hdr_looks_good
int nifti_hdr_looks_good(const nifti_1_header *hdr)
Definition nifti1_io.c:4053
nifti_image_unload
void nifti_image_unload(nifti_image *nim)
Definition nifti1_io.c:5035
nifti_xform_string
char const * nifti_xform_string(int xx)
Definition nifti1_io.c:1290
nifti_mat33_rownorm
float nifti_mat33_rownorm(mat33 A)
Definition nifti1_io.c:1847
nifti_swap_2bytes
void nifti_swap_2bytes(size_t n, void *ar)
Definition nifti1_io.c:2143
nifti_mat33_determ
float nifti_mat33_determ(mat33 R)
Definition nifti1_io.c:1832
nifti_intent_string
char const * nifti_intent_string(int ii)
Definition nifti1_io.c:1313
nifti_disp_lib_version
void nifti_disp_lib_version(void)
Definition nifti1_io.c:469
nifti_datatype_to_string
const char * nifti_datatype_to_string(int dtype)
Definition nifti1_io.c:7444
nifti_swap_Nbytes
void nifti_swap_Nbytes(size_t n, int siz, void *ar)
Definition nifti1_io.c:2245
nifti_image_infodump
void nifti_image_infodump(const nifti_image *nim)
Definition nifti1_io.c:5100
nifti_disp_type_list
int nifti_disp_type_list(int which)
Definition nifti1_io.c:7527
nifti_image_write
void nifti_image_write(nifti_image *nim)
Definition nifti1_io.c:5871
nifti_is_valid_datatype
int nifti_is_valid_datatype(int dtype)
Definition nifti1_io.c:3362
nifti_free_NBL
void nifti_free_NBL(nifti_brick_list *NBL)
Definition nifti1_io.c:790
nifti_convert_nhdr2nim
nifti_image * nifti_convert_nhdr2nim(struct nifti_1_header nhdr, const char *fname)
Definition nifti1_io.c:3614
nifti_image_to_ascii
char * nifti_image_to_ascii(const nifti_image *nim)
Definition nifti1_io.c:6104
nifti_disp_lib_hist
void nifti_disp_lib_hist(void)
Definition nifti1_io.c:459
nifti_write_all_data
int nifti_write_all_data(znzFile fp, nifti_image *nim, const nifti_brick_list *NBL)
Definition nifti1_io.c:5151
nifti_mat44_inverse
mat44 nifti_mat44_inverse(mat44 R)
Definition nifti1_io.c:1673
nifti_findhdrname
char * nifti_findhdrname(const char *fname)
Definition nifti1_io.c:2742
nifti_mat33_inverse
mat33 nifti_mat33_inverse(mat33 R)
Definition nifti1_io.c:1800
nifti_make_new_nim
nifti_image * nifti_make_new_nim(const int dims[], int datatype, int data_fill)
Definition nifti1_io.c:5385
nifti_read_header
nifti_1_header * nifti_read_header(const char *hname, int *swapped, int check)
Definition nifti1_io.c:3960
nifti_is_complete_filename
int nifti_is_complete_filename(const char *fname)
Definition nifti1_io.c:2502
nifti_datatype_from_string
int nifti_datatype_from_string(const char *name)
Definition nifti1_io.c:7424
nifti_write_ascii_image
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:5820
nifti_set_debug_level
void nifti_set_debug_level(int level)
Definition nifti1_io.c:2706
nifti_get_filesize
int nifti_get_filesize(const char *pathname)
Definition nifti1_io.c:2431
nifti_mat44_to_orientation
void nifti_mat44_to_orientation(mat44 R, int *icod, int *jcod, int *kcod)
Definition nifti1_io.c:1971
nifti_nim_has_valid_dims
int nifti_nim_has_valid_dims(nifti_image *nim, int complain)
Definition nifti1_io.c:6626
nifti_makeimgname
char * nifti_makeimgname(const char *prefix, int nifti_type, int check, int comp)
Definition nifti1_io.c:2996
nifti_makebasename
char * nifti_makebasename(const char *fname)
Definition nifti1_io.c:2683
nifti_short_order
int nifti_short_order(void)
Definition nifti1_io.c:6355
nifti_slice_string
char const * nifti_slice_string(int ss)
Definition nifti1_io.c:1369
valid_nifti_extensions
int valid_nifti_extensions(const nifti_image *nim)
Definition nifti1_io.c:4687
nifti_read_subregion_image
int nifti_read_subregion_image(nifti_image *nim, const int *start_index, const int *region_size, void **data)
Definition nifti1_io.c:6881
nifti_findimgname
char * nifti_findimgname(const char *fname, int nifti_type)
Definition nifti1_io.c:2841
nifti_datatype_sizes
void nifti_datatype_sizes(int datatype, int *nbyper, int *swapsize)
Definition nifti1_io.c:1420
nifti_makehdrname
char * nifti_makehdrname(const char *prefix, int nifti_type, int check, int comp)
Definition nifti1_io.c:2926
nifti_add_extension
int nifti_add_extension(nifti_image *nim, const char *data, int len, int ecode)
Definition nifti1_io.c:4495
nifti_test_datatype_sizes
int nifti_test_datatype_sizes(int verb)
Definition nifti1_io.c:7488
nifti_set_iname_offset
void nifti_set_iname_offset(nifti_image *nim)
Definition nifti1_io.c:5635
nifti_update_dims_from_array
int nifti_update_dims_from_array(nifti_image *nim)
Definition nifti1_io.c:622
disp_nifti_1_header
int disp_nifti_1_header(const char *info, const nifti_1_header *hp)
Definition nifti1_io.c:3520
nifti_read_buffer
size_t nifti_read_buffer(znzFile fp, void *dataptr, size_t ntot, nifti_image *nim)
Definition nifti1_io.c:4953
nifti_image_from_ascii
nifti_image * nifti_image_from_ascii(const char *str, int *bytes_read)
Definition nifti1_io.c:6395
nifti_free_extensions
int nifti_free_extensions(nifti_image *nim)
Definition nifti1_io.c:5073
nifti_is_valid_ecode
int nifti_is_valid_ecode(int ecode)
Definition nifti1_io.c:4743
mat33
Definition nifti1_io.h:62
mat33::m
float m[3][3]
Definition nifti1_io.h:63
mat44
Definition nifti1_io.h:58
mat44::m
float m[4][4]
Definition nifti1_io.h:59
nifti1_extension
Data structure defining the fields of a header extension.
Definition nifti1.h:297
nifti_1_header
Data structure defining the fields in the nifti1 header. This binary header should be found at the be...
Definition nifti1.h:148
nifti_analyze75
Definition nifti1_io.h:187
nifti_brick_list
Definition nifti1_io.h:175
nifti_image
High level data structure for open nifti datasets in the nifti1_io API. Note that this structure is n...
Definition nifti1_io.h:88
nifti_image::slice_code
int slice_code
Definition nifti1_io.h:125
nifti_image::ext_list
nifti1_extension * ext_list
Definition nifti1_io.h:167
nifti_image::slice_duration
float slice_duration
Definition nifti1_io.h:128
nifti_image::qto_xyz
mat44 qto_xyz
Definition nifti1_io.h:136
nifti_image::intent_p1
float intent_p1
Definition nifti1_io.h:151
nifti_image::sto_ijk
mat44 sto_ijk
Definition nifti1_io.h:140
nifti_image::quatern_b
float quatern_b
Definition nifti1_io.h:132
nifti_image::num_ext
int num_ext
Definition nifti1_io.h:166
nifti_image::fname
char * fname
Definition nifti1_io.h:159
nifti_image::time_units
int time_units
Definition nifti1_io.h:145
nifti_image::nvox
size_t nvox
Definition nifti1_io.h:99
nifti_image::intent_p3
float intent_p3
Definition nifti1_io.h:153
nifti_image::freq_dim
int freq_dim
Definition nifti1_io.h:121
nifti_image::datatype
int datatype
Definition nifti1_io.h:101
nifti_image::intent_code
int intent_code
Definition nifti1_io.h:150
nifti_image::byteorder
int byteorder
Definition nifti1_io.h:163
nifti_image::ny
int ny
Definition nifti1_io.h:92
nifti_image::dim
int dim[8]
Definition nifti1_io.h:98
nifti_image::xyz_units
int xyz_units
Definition nifti1_io.h:144
nifti_image::dv
float dv
Definition nifti1_io.h:108
nifti_image::aux_file
char aux_file[24]
Definition nifti1_io.h:157
nifti_image::sto_xyz
mat44 sto_xyz
Definition nifti1_io.h:139
nifti_image::descrip
char descrip[80]
Definition nifti1_io.h:156
nifti_image::phase_dim
int phase_dim
Definition nifti1_io.h:122
nifti_image::cal_max
float cal_max
Definition nifti1_io.h:116
nifti_image::qto_ijk
mat44 qto_ijk
Definition nifti1_io.h:137
nifti_image::nbyper
int nbyper
Definition nifti1_io.h:100
nifti_image::scl_inter
float scl_inter
Definition nifti1_io.h:113
nifti_image::cal_min
float cal_min
Definition nifti1_io.h:115
nifti_image::nv
int nv
Definition nifti1_io.h:96
nifti_image::iname_offset
int iname_offset
Definition nifti1_io.h:161
nifti_image::pixdim
float pixdim[8]
Definition nifti1_io.h:110
nifti_image::nz
int nz
Definition nifti1_io.h:93
nifti_image::dx
float dx
Definition nifti1_io.h:103
nifti_image::data
void * data
Definition nifti1_io.h:164
nifti_image::sform_code
int sform_code
Definition nifti1_io.h:119
nifti_image::iname
char * iname
Definition nifti1_io.h:160
nifti_image::intent_p2
float intent_p2
Definition nifti1_io.h:152
nifti_image::du
float du
Definition nifti1_io.h:107
nifti_image::nt
int nt
Definition nifti1_io.h:94
nifti_image::intent_name
char intent_name[16]
Definition nifti1_io.h:154
nifti_image::nu
int nu
Definition nifti1_io.h:95
nifti_image::dt
float dt
Definition nifti1_io.h:106
nifti_image::dw
float dw
Definition nifti1_io.h:109
nifti_image::nx
int nx
Definition nifti1_io.h:91
nifti_image::dz
float dz
Definition nifti1_io.h:105
nifti_image::nifti_type
int nifti_type
Definition nifti1_io.h:147
nifti_image::slice_end
int slice_end
Definition nifti1_io.h:127
nifti_image::swapsize
int swapsize
Definition nifti1_io.h:162
nifti_image::ndim
int ndim
Definition nifti1_io.h:90
nifti_image::slice_start
int slice_start
Definition nifti1_io.h:126
nifti_image::qform_code
int qform_code
Definition nifti1_io.h:118
nifti_image::nw
int nw
Definition nifti1_io.h:97
nifti_image::analyze75_orient
analyze_75_orient_code analyze75_orient
Definition nifti1_io.h:168
nifti_image::toffset
float toffset
Definition nifti1_io.h:142
nifti_image::slice_dim
int slice_dim
Definition nifti1_io.h:123
nifti_image::scl_slope
float scl_slope
Definition nifti1_io.h:112
nifti_image::dy
float dy
Definition nifti1_io.h:104