nifti1.h
来自「DTMK软件开发包,此为开源软件,是一款很好的医学图像开发资源.」· C头文件 代码 · 共 1,370 行 · 第 1/5 页
H
1,370 行
#define NIFTI_TYPE_FLOAT128 1536
/*! 128 bit complex = 2 64 bit floats. */
#define NIFTI_TYPE_COMPLEX128 1792
/*! 256 bit complex = 2 128 bit floats */
#define NIFTI_TYPE_COMPLEX256 2048
/*! 4 8 bit bytes. */
#define NIFTI_TYPE_RGBA32 2304
/* @} */
/*-------- sample typedefs for complicated types ---*/
#if 0
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 ;
#endif
/*---------------------------------------------------------------------------*/
/* INTERPRETATION OF VOXEL DATA:
----------------------------
The intent_code field can be used to indicate that the voxel data has
some particular meaning. In particular, a large number of codes is
given to indicate that the the voxel data should be interpreted as
being drawn from a given probability distribution.
VECTOR-VALUED DATASETS:
----------------------
The 5th dimension of the dataset, if present (i.e., dim[0]=5 and
dim[5] > 1), contains multiple values (e.g., a vector) to be stored
at each spatiotemporal location. For example, the header values
- dim[0] = 5
- dim[1] = 64
- dim[2] = 64
- dim[3] = 20
- dim[4] = 1 (indicates no time axis)
- dim[5] = 3
- datatype = DT_FLOAT
- intent_code = NIFTI_INTENT_VECTOR
mean that this dataset should be interpreted as a 3D volume (64x64x20),
with a 3-vector of floats defined at each point in the 3D grid.
A program reading a dataset with a 5th dimension may want to reformat
the image data to store each voxels' set of values together in a struct
or array. This programming detail, however, is beyond the scope of the
NIFTI-1 file specification! Uses of dimensions 6 and 7 are also not
specified here.
STATISTICAL PARAMETRIC DATASETS (i.e., SPMs):
--------------------------------------------
Values of intent_code from NIFTI_FIRST_STATCODE to NIFTI_LAST_STATCODE
(inclusive) indicate that the numbers in the dataset should be interpreted
as being drawn from a given distribution. Most such distributions have
auxiliary parameters (e.g., NIFTI_INTENT_TTEST has 1 DOF parameter).
If the dataset DOES NOT have a 5th dimension, then the auxiliary parameters
are the same for each voxel, and are given in header fields intent_p1,
intent_p2, and intent_p3.
If the dataset DOES have a 5th dimension, then the auxiliary parameters
are different for each voxel. For example, the header values
- dim[0] = 5
- dim[1] = 128
- dim[2] = 128
- dim[3] = 1 (indicates a single slice)
- dim[4] = 1 (indicates no time axis)
- dim[5] = 2
- datatype = DT_FLOAT
- intent_code = NIFTI_INTENT_TTEST
mean that this is a 2D dataset (128x128) of t-statistics, with the
t-statistic being in the first "plane" of data and the degrees-of-freedom
parameter being in the second "plane" of data.
If the dataset 5th dimension is used to store the voxel-wise statistical
parameters, then dim[5] must be 1 plus the number of parameters required
by that distribution (e.g., intent_code=NIFTI_INTENT_TTEST implies dim[5]
must be 2, as in the example just above).
Note: intent_code values 2..10 are compatible with AFNI 1.5x (which is
why there is no code with value=1, which is obsolescent in AFNI).
OTHER INTENTIONS:
----------------
The purpose of the intent_* fields is to help interpret the values
stored in the dataset. Some non-statistical values for intent_code
and conventions are provided for storing other complex data types.
The intent_name field provides space for a 15 character (plus 0 byte)
'name' string for the type of data stored. Examples:
- intent_code = NIFTI_INTENT_ESTIMATE; intent_name = "T1";
could be used to signify that the voxel values are estimates of the
NMR parameter T1.
- intent_code = NIFTI_INTENT_TTEST; intent_name = "House";
could be used to signify that the voxel values are t-statistics
for the significance of 'activation' response to a House stimulus.
- intent_code = NIFTI_INTENT_DISPVECT; intent_name = "ToMNI152";
could be used to signify that the voxel values are a displacement
vector that transforms each voxel (x,y,z) location to the
corresponding location in the MNI152 standard brain.
- intent_code = NIFTI_INTENT_SYMMATRIX; intent_name = "DTI";
could be used to signify that the voxel values comprise a diffusion
tensor image.
If no data name is implied or needed, intent_name[0] should be set to 0.
-----------------------------------------------------------------------------*/
/*! default: no intention is indicated in the header. */
#define NIFTI_INTENT_NONE 0
/*-------- These codes are for probability distributions ---------------*/
/* Most distributions have a number of parameters,
below denoted by p1, p2, and p3, and stored in
- intent_p1, intent_p2, intent_p3 if dataset doesn't have 5th dimension
- image data array if dataset does have 5th dimension
Functions to compute with many of the distributions below can be found
in the CDF library from U Texas.
Formulas for and discussions of these distributions can be found in the
following books:
[U] Univariate Discrete Distributions,
NL Johnson, S Kotz, AW Kemp.
[C1] Continuous Univariate Distributions, vol. 1,
NL Johnson, S Kotz, N Balakrishnan.
[C2] Continuous Univariate Distributions, vol. 2,
NL Johnson, S Kotz, N Balakrishnan. */
/*----------------------------------------------------------------------*/
/*! [C2, chap 32] Correlation coefficient R (1 param):
p1 = degrees of freedom
R/sqrt(1-R*R) is t-distributed with p1 DOF. */
/*! \defgroup NIFTI1_INTENT_CODES
\brief nifti1 intent codes, to describe intended meaning of dataset contents
@{
*/
#define NIFTI_INTENT_CORREL 2
/*! [C2, chap 28] Student t statistic (1 param): p1 = DOF. */
#define NIFTI_INTENT_TTEST 3
/*! [C2, chap 27] Fisher F statistic (2 params):
p1 = numerator DOF, p2 = denominator DOF. */
#define NIFTI_INTENT_FTEST 4
/*! [C1, chap 13] Standard normal (0 params): Density = N(0,1). */
#define NIFTI_INTENT_ZSCORE 5
/*! [C1, chap 18] Chi-squared (1 param): p1 = DOF.
Density(x) proportional to exp(-x/2) * x^(p1/2-1). */
#define NIFTI_INTENT_CHISQ 6
/*! [C2, chap 25] Beta distribution (2 params): p1=a, p2=b.
Density(x) proportional to x^(a-1) * (1-x)^(b-1). */
#define NIFTI_INTENT_BETA 7
/*! [U, chap 3] Binomial distribution (2 params):
p1 = number of trials, p2 = probability per trial.
Prob(x) = (p1 choose x) * p2^x * (1-p2)^(p1-x), for x=0,1,...,p1. */
#define NIFTI_INTENT_BINOM 8
/*! [C1, chap 17] Gamma distribution (2 params):
p1 = shape, p2 = scale.
Density(x) proportional to x^(p1-1) * exp(-p2*x). */
#define NIFTI_INTENT_GAMMA 9
/*! [U, chap 4] Poisson distribution (1 param): p1 = mean.
Prob(x) = exp(-p1) * p1^x / x! , for x=0,1,2,.... */
#define NIFTI_INTENT_POISSON 10
/*! [C1, chap 13] Normal distribution (2 params):
p1 = mean, p2 = standard deviation. */
#define NIFTI_INTENT_NORMAL 11
/*! [C2, chap 30] Noncentral F statistic (3 params):
p1 = numerator DOF, p2 = denominator DOF,
p3 = numerator noncentrality parameter. */
#define NIFTI_INTENT_FTEST_NONC 12
/*! [C2, chap 29] Noncentral chi-squared statistic (2 params):
p1 = DOF, p2 = noncentrality parameter. */
#define NIFTI_INTENT_CHISQ_NONC 13
/*! [C2, chap 23] Logistic distribution (2 params):
p1 = location, p2 = scale.
Density(x) proportional to sech^2((x-p1)/(2*p2)). */
#define NIFTI_INTENT_LOGISTIC 14
/*! [C2, chap 24] Laplace distribution (2 params):
p1 = location, p2 = scale.
Density(x) proportional to exp(-abs(x-p1)/p2). */
#define NIFTI_INTENT_LAPLACE 15
/*! [C2, chap 26] Uniform distribution: p1 = lower end, p2 = upper end. */
#define NIFTI_INTENT_UNIFORM 16
/*! [C2, chap 31] Noncentral t statistic (2 params):
p1 = DOF, p2 = noncentrality parameter. */
#define NIFTI_INTENT_TTEST_NONC 17
/*! [C1, chap 21] Weibull distribution (3 params):
p1 = location, p2 = scale, p3 = power.
Density(x) proportional to
((x-p1)/p2)^(p3-1) * exp(-((x-p1)/p2)^p3) for x > p1. */
#define NIFTI_INTENT_WEIBULL 18
/*! [C1, chap 18] Chi distribution (1 param): p1 = DOF.
Density(x) proportional to x^(p1-1) * exp(-x^2/2) for x > 0.
p1 = 1 = 'half normal' distribution
p1 = 2 = Rayleigh distribution
p1 = 3 = Maxwell-Boltzmann distribution. */
#define NIFTI_INTENT_CHI 19
/*! [C1, chap 15] Inverse Gaussian (2 params):
p1 = mu, p2 = lambda
Density(x) proportional to
exp(-p2*(x-p1)^2/(2*p1^2*x)) / x^3 for x > 0. */
#define NIFTI_INTENT_INVGAUSS 20
/*! [C2, chap 22] Extreme value type I (2 params):
p1 = location, p2 = scale
cdf(x) = exp(-exp(-(x-p1)/p2)). */
#define NIFTI_INTENT_EXTVAL 21
/*! Data is a 'p-value' (no params). */
#define NIFTI_INTENT_PVAL 22
/*! Data is ln(p-value) (no params).
To be safe, a program should compute p = exp(-abs(this_value)).
The nifti_stats.c library returns this_value
as positive, so that this_value = -log(p). */
#define NIFTI_INTENT_LOGPVAL 23
/*! Data is log10(p-value) (no params).
To be safe, a program should compute p = pow(10.,-abs(this_value)).
The nifti_stats.c library returns this_value
as positive, so that this_value = -log10(p). */
#define NIFTI_INTENT_LOG10PVAL 24
/*! Smallest intent_code that indicates a statistic. */
#define NIFTI_FIRST_STATCODE 2
/*! Largest intent_code that indicates a statistic. */
#define NIFTI_LAST_STATCODE 24
/*---------- these values for intent_code aren't for statistics ----------*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?