datatype.html
datatype
- Links to FAQ questions
- Links to Bboard questions
- See also
nifti1.h header documentation
/---------------------------------------------------------------------------/ /* TYPE OF DATA (acceptable values for datatype field): --------------------------------------------------- Values of datatype smaller than 256 are ANALYZE 7.5 compatible. Larger values are NIFTI-1 additions. These are all multiples of 256, so that no bits below position 8 are set in datatype. But there is no need to use only powers-of-2, as the original ANALYZE 7.5 datatype codes do.
The additional codes are intended to include a complete list of basic scalar types, including signed and unsigned integers from 8 to 64 bits, floats from 32 to 128 bits, and complex (float pairs) from 64 to 256 bits.
Note that most programs will support only a few of these datatypes! A NIFTI-1 program should fail gracefully (e.g., print a warning message) when it encounters a dataset with a type it doesn't like. -----------------------------------------------------------------------------*/
DEFINED CODES
#undef DT_UNKNOWN / defined in dirent.h on some Unix systems //--- the original ANALYZE 7.5 type codes ---/ #define DT_NONE 0 #define DT_UNKNOWN 0 / what it says, dude / #define DT_BINARY 1 / binary (1 bit/voxel) / #define DT_UNSIGNED_CHAR 2 / unsigned char (8 bits/voxel) / #define DT_SIGNED_SHORT 4 / signed short (16 bits/voxel) / #define DT_SIGNED_INT 8 / signed int (32 bits/voxel) / #define DT_FLOAT 16 / float (32 bits/voxel) / #define DT_COMPLEX 32 / complex (64 bits/voxel) / #define DT_DOUBLE 64 / double (64 bits/voxel) / #define DT_RGB 128 / RGB triple (24 bits/voxel) / #define DT_ALL 255 / not very useful (?) /
/----- another set of names for the same ---/ #define DT_UINT8 2 #define DT_INT16 4 #define DT_INT32 8 #define DT_FLOAT32 16 #define DT_COMPLEX64 32 #define DT_FLOAT64 64 #define DT_RGB24 128
/------------------- new codes for NIFTI ---/ #define DT_INT8 256 / signed char (8 bits) / #define DT_UINT16 512 / unsigned short (16 bits) / #define DT_UINT32 768 / unsigned int (32 bits) / #define DT_INT64 1024 / long long (64 bits) / #define DT_UINT64 1280 / unsigned long long (64 bits) / #define DT_FLOAT128 1536 / long double (128 bits) / #define DT_COMPLEX128 1792 / double pair (128 bits) / #define DT_COMPLEX256 2048 / long double pair (256 bits) /
/------- aliases for all the above codes ---/
#define NIFTI_TYPE_UINT8 2 /! unsigned char. / #define NIFTI_TYPE_INT16 4 /! signed short. / #define NIFTI_TYPE_INT32 8 /! signed int. / #define NIFTI_TYPE_FLOAT32 16 /! 32 bit float. / #define NIFTI_TYPE_COMPLEX64 32 /! 64 bit complex = 2 32 bit floats. / #define NIFTI_TYPE_FLOAT64 64 /! 64 bit float = double. / #define NIFTI_TYPE_RGB24 128 /! 3 8 bit bytes. / #define NIFTI_TYPE_INT8 256 /! signed char. / #define NIFTI_TYPE_UINT16 512 /! unsigned short. / #define NIFTI_TYPE_UINT32 768 /! unsigned int. / #define NIFTI_TYPE_INT64 1024 /! signed long long. / #define NIFTI_TYPE_UINT64 1280 /! unsigned long long. / #define NIFTI_TYPE_FLOAT128 1536 /! 128 bit float = long double. / #define NIFTI_TYPE_COMPLEX128 1792 /! 128 bit complex = 2 64 bit floats. / #define NIFTI_TYPE_COMPLEX256 2048 /! 256 bit complex = 2 128 bit floats /
sample typedefs for complicated types
typedef struct { float r,i; } complex_float ; typedef struct { double r,i; } complex_double ; typedef struct { long double r,i; } complex_longdouble ; typedef struct { unsigned char r,g,b; } rgb_byte ;