nifti1_io.h
来自「DTMK软件开发包,此为开源软件,是一款很好的医学图像开发资源.」· C头文件 代码 · 共 458 行 · 第 1/2 页
H
458 行
void ** data );
int nifti_read_subregion_image( nifti_image * nim,
int *start_index, 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 ) ;
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, 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* datatptr, 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_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
http://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_MAX_ECODE 14 /******* 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; /*!< debug level for status reports */
int skip_blank_ext; /*!< skip extender if no extensions */
} 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 * 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_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?