@kv  0.0.4
Library for graph problems in C and Python
nifti.h
1 
18 #if !defined(AT_IMGPROC_H_INSIDE)
19 #error "Only <at/imgproc.h> can be included directly."
20 #endif
21 #ifndef AT_NIFTI_H
22 #define AT_NIFTI_H
23 #include <at/core.h>
24 #include <stdint.h>
25 AT_BEGIN_DECLS
26 
30 typedef enum{
31  AT_NIFTI_TYPE_ANALYZE = 0,
32  AT_NIFTI_TYPE_NIFTI1_1 = 1,
33  AT_NIFTI_TYPE_NIFTI1_2 = 2,
34  AT_NIFTI_TYPE_ASCII = 3,
35  AT_NIFTI_TYPE_MAX = 3,
36 } AtNiftiFileType;
37 
43 typedef enum _AtAnalyze75OrientCode {
44  AT_A75_TRANSVERSE_UNFLIPPED = 0,
45  AT_A75_CORONAL_UNFLIPPED = 1,
46  AT_A75_SAGITTAL_UNFLIPPED = 2,
47  AT_A75_TRANSVERSE_FLIPPED = 3,
48  AT_A75_CORONAL_FLIPPED = 4,
49  AT_A75_SAGITTAL_FLIPPED = 5,
50  AT_A75_ORIENT_UNKNOWN = 6
51 } AtAnalyze75OrientCode;
52 
56 typedef enum{
57  AT_NIFTI_XFORM_UNKNOWN = 0,
58  AT_NIFTI_XFORM_SCANNER_ANAT = 1,
59  AT_NIFTI_XFORM_ALIGNED_ANAT = 2,
60  AT_NIFTI_XFORM_TALAIRACH = 3,
61  AT_NIFTI_XFORM_MNI_152 = 4
62 }AtNiftiXformCode;
63 
67 typedef enum{
68  AT_DT_INT8 = 256,
69  AT_DT_UINT8 = 2,
70  AT_DT_INT16 = 4,
71  AT_DT_UINT16 = 512,
72  AT_DT_INT32 = 8,
73  AT_DT_UINT32 = 768,
74  AT_DT_INT64 = 1024,
75  AT_DT_UINT64 = 1280,
76  AT_DT_RGB24 = 128,
77  AT_DT_RGBA32 = 2304,
78  AT_DT_FLOAT32 = 16,
79  AT_DT_FLOAT64 = 64,
80  AT_DT_COMPLEX64 = 32,
81  AT_DT_FLOAT128 = 1536,
82  AT_DT_COMPLEX128 = 1792,
83  AT_DT_COMPLEX256 = 2048
84 }AtNiftiDatatype;
85 
89 typedef struct AtNifti1Extension{
90  uint8_t* edata;
91  uint32_t esize;
92  uint32_t ecode;
93 }AtNifti1Extension; // Total: 16 bytes
94 
98 typedef struct AtNiftiImage{
100  AtArrayU16 *ar; /*008+008*/
101  char *fname; /*016+008*/
102  char *iname; /*024+008*/
103  float qto_xyz[16]; /*032+128*/
104  float sto_xyz[16]; /*160+128*/
105  float qto_ijk[16]; /*288+128*/
106  float sto_ijk[16]; /*416+128*/
107  float quatern[3]; /*544+024*/
108  float qoffset[3]; /*568+024*/
109  float qfac; /*592+008*/
110  float scl_slope; /*600+008*/
111  float scl_inter; /*608+008*/
112  float slice_duration; /*616+008*/
113  float cal_min; /*624+008*/
114  float cal_max; /*632+008*/
115  uint32_t iname_offset; /*640+004*/
116  uint32_t num_ext; /*644+004*/
117  uint32_t byteorder; /*648+004*/
118  AtNiftiDatatype datatype; /*652+002*/
119  uint16_t ndim; /*654+002*/
120  uint16_t dim[7]; /*656+014*/
121  uint16_t pixdim[7]; /*670+014*/
122  uint16_t slice_start; /*684+002*/
123  uint16_t slice_end; /*686+002*/
124  AtNiftiXformCode qform_code; /*688+001*/
125  AtNiftiXformCode sform_code; /*689+001*/
126  AtNiftiFileType nifti_type; /*690+001*/
127  AtAnalyze75OrientCode analyze75_orient; /*691+001*/
128  char descrip[80]; /*692+080*/
129  char aux_file[24]; /*772+024*/
130  uint8_t swapsize; /*796+001*/
131  uint8_t slice_code; /*797+001*/
132  uint8_t xyz_units; /*798+001*/
133  uint8_t time_units; /*799+001*/
134  uint8_t freq_dim; /*800+001*/
135  uint8_t phase_dim; /*801+001*/
136  uint8_t slice_dim; /*802+001*/
137  uint8_t pd[5]; /*803+005*/
138 }AtNiftiImage;
139 
147 at_niftiimage_read(const char *name, uint8_t read_data, AtError** error);
152 void
153 at_niftiimage_destroy(AtNiftiImage** np);
154 
155 AT_END_DECLS
156 #endif
AtNifti1Extension * ext_list
Definition: nifti.h:99
Nifti Extension.
Definition: nifti.h:89
error
Definition: error.h:28
uint8_t * edata
Definition: nifti.h:90
uint32_t ecode
Definition: nifti.h:92
uint32_t esize
Definition: nifti.h:91
char * fname
Definition: nifti.h:101
AtArrayU16 * ar
Definition: nifti.h:100
Nifti Image.
Definition: nifti.h:98
char * iname
Definition: nifti.h:102