nifti2.h
#ifndef __NIFTI2_HEADER
#define __NIFTI2_HEADER
/*LICENSE_START*/
/*
* Copyright (c) 2014, Washington University School of Medicine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "nifti1.h"
namespace cifti
{
#include <stdint.h>
/*extended nifti intent codes*/
const int32_t NIFTI_INTENT_CONNECTIVITY_UNKNOWN=3000;
const int32_t NIFTI_INTENT_CONNECTIVITY_DENSE=3001;
const int32_t NIFTI_INTENT_CONNECTIVITY_DENSE_TIME=3002;//CIFTI-1 name
const int32_t NIFTI_INTENT_CONNECTIVITY_DENSE_SERIES=3002;//CIFTI-2 name
const int32_t NIFTI_INTENT_CONNECTIVITY_PARCELLATED=3003;
const int32_t NIFTI_INTENT_CONNECTIVITY_PARCELLATED_TIME=3004;//ditto
const int32_t NIFTI_INTENT_CONNECTIVITY_PARCELLATED_SERIES=3004;
const int32_t NIFTI_INTENT_CONNECTIVITY_CONNECTIVITY_TRAJECTORY=3005;//ditto
const int32_t NIFTI_INTENT_CONNECTIVITY_DENSE_TRAJECTORY=3005;
const int32_t NIFTI_INTENT_CONNECTIVITY_DENSE_SCALARS=3006;
const int32_t NIFTI_INTENT_CONNECTIVITY_DENSE_LABELS=3007;
const int32_t NIFTI_INTENT_CONNECTIVITY_PARCELLATED_SCALAR=3008;
const int32_t NIFTI_INTENT_CONNECTIVITY_PARCELLATED_DENSE=3009;
const int32_t NIFTI_INTENT_CONNECTIVITY_DENSE_PARCELLATED=3010;
const int32_t NIFTI_INTENT_CONNECTIVITY_PARCELLATED_PARCELLATED_SERIES=3011;
const int32_t NIFTI_INTENT_CONNECTIVITY_PARCELLATED_PARCELLATED_SCALAR=3012;
const int32_t NIFTI_ECODE_CIFTI=32;
#define NIFTI2_VERSION(h) \
(h).sizeof_hdr == 348 ? 1 : (\
(h).sizeof_hdr == 1543569408 ? 1 : (\
(h).sizeof_hdr == 540 ? 2 : (\
(h).sizeof_hdr == 469893120 ? 2 : 0)))
#define NIFTI2_NEEDS_SWAP(h) \
(h).sizeof_hdr == 469893120 ? 1 : (\
(h).sizeof_hdr == 1543569408 ? 1 : 0)
//hopefully cross-platform solution to byte padding added by some compilers
#pragma pack(push)
#pragma pack(1)
/*************************/ /************************/ /************/
struct nifti_2_header { /* NIFTI-2 usage */ /* NIFTI-1 usage */ /* offset */
/*************************/ /************************/ /************/
int32_t sizeof_hdr; /* int32_t sizeof_hdr; (348) */ /* 0 */
char magic[8] ; /* char magic[4]; */ /* 4 */
int16_t datatype; /* short datatype; */ /* 12 */
int16_t bitpix; /* short bitpix; */ /* 14 */
int64_t dim[8]; /* short dim[8]; */ /* 16 */
double intent_p1 ; /* float intent_p1; */ /* 80 */
double intent_p2 ; /* float intent_p2; */ /* 88 */
double intent_p3 ; /* float intent_p3; */ /* 96 */
double pixdim[8]; /* float pixdim[8]; */ /* 104 */
int64_t vox_offset; /* float vox_offset; */ /* 168 */
double scl_slope ; /* float scl_slope; */ /* 176 */
double scl_inter ; /* float scl_inter; */ /* 184 */
double cal_max; /* float cal_max; */ /* 192 */
double cal_min; /* float cal_min; */ /* 200 */
double slice_duration; /* float slice_duration; */ /* 208 */
double toffset; /* float toffset; */ /* 216 */
int64_t slice_start; /* short slice_start; */ /* 224 */
int64_t slice_end; /* short slice_end; */ /* 232 */
char descrip[80]; /* char descrip[80]; */ /* 240 */
char aux_file[24]; /* char aux_file[24]; */ /* 320 */
int32_t qform_code ; /* short qform_code; */ /* 344 */
int32_t sform_code ; /* short sform_code; */ /* 348 */
double quatern_b ; /* float quatern_b; */ /* 352 */
double quatern_c ; /* float quatern_c; */ /* 360 */
double quatern_d ; /* float quatern_d; */ /* 368 */
double qoffset_x ; /* float qoffset_x; */ /* 376 */
double qoffset_y ; /* float qoffset_y; */ /* 384 */
double qoffset_z ; /* float qoffset_z; */ /* 392 */
double srow_x[4] ; /* float srow_x[4]; */ /* 400 */
double srow_y[4] ; /* float srow_y[4]; */ /* 432 */
double srow_z[4] ; /* float srow_z[4]; */ /* 464 */
int32_t slice_code ; /* char slice_code; */ /* 496 */
int32_t xyzt_units ; /* char xyzt_units; */ /* 500 */
int32_t intent_code ; /* short intent_code; */ /* 504 */
char intent_name[16]; /* char intent_name[16]; */ /* 508 */
char dim_info; /* char dim_info; */ /* 524 */
char unused_str[15]; /* 525 */
} ; /**** 540 bytes total ****/
typedef struct nifti_2_header nifti_2_header ;
//and restore packing behavior
#pragma pack(pop)
}//namespace
#endif //__NIFTI2_HEADER
cifti
namespace for all CiftiLib functionality
Definition CiftiBrainModelsMap.h:42
cifti::nifti_2_header
Data structure defining the fields in the nifti2 header. This binary header should be found at the be...
Definition nifti2.h:77
cifti::nifti_2_header::unused_str
char unused_str[15]
Definition nifti2.h:115
cifti::nifti_2_header::descrip
char descrip[80]
Definition nifti2.h:97
cifti::nifti_2_header::intent_p2
double intent_p2
Definition nifti2.h:85
cifti::nifti_2_header::toffset
double toffset
Definition nifti2.h:94
cifti::nifti_2_header::intent_p3
double intent_p3
Definition nifti2.h:86
cifti::nifti_2_header::pixdim
double pixdim[8]
Definition nifti2.h:87
cifti::nifti_2_header::sform_code
int32_t sform_code
Definition nifti2.h:100
cifti::nifti_2_header::dim
int64_t dim[8]
Definition nifti2.h:83
cifti::nifti_2_header::scl_slope
double scl_slope
Definition nifti2.h:89
cifti::nifti_2_header::intent_p1
double intent_p1
Definition nifti2.h:84
cifti::nifti_2_header::datatype
int16_t datatype
Definition nifti2.h:81
cifti::nifti_2_header::bitpix
int16_t bitpix
Definition nifti2.h:82
cifti::nifti_2_header::slice_duration
double slice_duration
Definition nifti2.h:93
cifti::nifti_2_header::srow_y
double srow_y[4]
Definition nifti2.h:108
cifti::nifti_2_header::quatern_c
double quatern_c
Definition nifti2.h:102
cifti::nifti_2_header::srow_z
double srow_z[4]
Definition nifti2.h:109
cifti::nifti_2_header::xyzt_units
int32_t xyzt_units
Definition nifti2.h:111
cifti::nifti_2_header::sizeof_hdr
int32_t sizeof_hdr
Definition nifti2.h:79
cifti::nifti_2_header::slice_code
int32_t slice_code
Definition nifti2.h:110
cifti::nifti_2_header::qoffset_z
double qoffset_z
Definition nifti2.h:106
cifti::nifti_2_header::qoffset_x
double qoffset_x
Definition nifti2.h:104
cifti::nifti_2_header::intent_code
int32_t intent_code
Definition nifti2.h:112
cifti::nifti_2_header::vox_offset
int64_t vox_offset
Definition nifti2.h:88
cifti::nifti_2_header::qoffset_y
double qoffset_y
Definition nifti2.h:105
cifti::nifti_2_header::cal_max
double cal_max
Definition nifti2.h:91
cifti::nifti_2_header::cal_min
double cal_min
Definition nifti2.h:92
cifti::nifti_2_header::scl_inter
double scl_inter
Definition nifti2.h:90
cifti::nifti_2_header::intent_name
char intent_name[16]
Definition nifti2.h:113
cifti::nifti_2_header::slice_start
int64_t slice_start
Definition nifti2.h:95
cifti::nifti_2_header::magic
char magic[8]
Definition nifti2.h:80
cifti::nifti_2_header::slice_end
int64_t slice_end
Definition nifti2.h:96
cifti::nifti_2_header::quatern_d
double quatern_d
Definition nifti2.h:103
cifti::nifti_2_header::aux_file
char aux_file[24]
Definition nifti2.h:98
cifti::nifti_2_header::quatern_b
double quatern_b
Definition nifti2.h:101
cifti::nifti_2_header::dim_info
char dim_info
Definition nifti2.h:114
cifti::nifti_2_header::qform_code
int32_t qform_code
Definition nifti2.h:99
cifti::nifti_2_header::srow_x
double srow_x[4]
Definition nifti2.h:107