Usage
f.complete.hdr.nifti.list.create(file,dim.info=character(1),dim,intent.p1=single(1),intent.p2=single(1),intent.p3=single(1),intent.code=integer(1),datatype=integer(1),bitpix=integer(1),slice.start=integer(1),pixdim=single(8),scl.slope=single(1),scl.inter=single(1),slice.end=integer(1),slice.code=character(1),xyzt.units=character(1),cal.max=single(1),cal.min=single(1),slice.duration=single(1),toffset=single(1),descrip=paste(rep(" ", 80), sep = "", collapse = ""),aux.file=paste(rep(" ", 24), sep = "", collapse = ""),qform.code=integer(1),sform.code=integer(1),quatern.b=single(1),quatern.c=single(1),quatern.d=single(1),qoffset.x=single(1),qoffset.y=single(1),qoffset.z=single(1),srow.x=single(4),srow.y=single(4),srow.z=single(4),intent.name=paste(rep(" ", 16), sep = "", collapse = ""))
Arguments
file
The .hdr filename. If file extension is ".nii", this will
create a header file for a ".nii" NIFTI file, else for a .hdr/.img
NIFTI pair
dim.info
MRI slice ordering: This field encode which spatial
dimension (1=x, 2=y, or 3=z) corresponds to which acquisition dimension
for MRI data. In fact, it contains three informations: freq.dim,
phase.dim and slice.dim, all squished into the single byte f
dim
vector (of length 8) of image dimensions. dim[1] specifies the
number of dimensions. In NIFTI-1 files, dim[2], dim[3], dim[4] are for
space, dim[5] is for time. The 5th dimension (dim[6]) of the dataset, if
present (i.e., dim[1]=5 and dim[6] > 1), c
intent.p1
1st intent parameter: first auxiliary parameter for a
possible statistical distribution specified in intent.code
intent.p2
2nd intent parameter: second auxiliary parameter for a
possible statistical distribution specified in intent.code
intent.p3
3rd intent parameter: third auxiliary parameter for a
possible statistical distribution specified in intent.code
intent.code
NIFTI INTENT code: if 0, this is a raw dataset; if in
range 2...24, this indicates that the numbers in the dataset should be interpreted
as being drawn from a given distribution. Most such distributions have
auxiliary parameters (given with intent.p
datatype
integer indicator of data storage type for each
voxel. This could be 2 (unsigned char), 4 (signed short), 8 (signed
int), 16 (32 bit float), 32 (64 bit complex = two 32 bit floats), 64 (64
bit float = double), 128 (3 8 bit bytes), 256 (signed char),
bitpix
the number of bits per voxel. This field MUST correspond with
the datatype field. The total number of bytes in the image data is
dim[2]* ... * dim[dim[1]+1] * bitpix / 8
slice.start
Indicates the start of the slice acquisition pattern, when slice.code is nonzero. These values
are present to allow for the possible addition of
"padded" slices at either end of the volume, which
pixdim
vector (of length 8). Grid spacings. When reading a
NIFTI-1 header, pixdim[1] stores qfac (which is either -1 or 1). If
pixdim[1]=0 (which should not occur), we take qfac=1. pixdim[2],
pixdim[3] and pixdim[4] give the voxel width along dimension x,
scl.slope
Data scaling: If the scl.slope field is nonzero, then
each voxel value in the dataset should be scaled as y = scl.slope*x +
scl.inter, where x = voxel value stored and y = "true" voxel value
scl.inter
Data scaling: offset. Idem above.
slice.end
Indicates the end of the slice acquisition pattern, when slice.code is nonzero. These values
are present to allow for the possible addition of
"padded" slices at either end of the volume, which
slice.code
Slice timing order. If this is nonzero, AND if slice.dim is nonzero, AND
if slice.duration is positive, indicates the timing
pattern of the slice acquisition. The following codes
are defined: 0 (NIFTI SLI
xyzt.units
Units of pixdim[2:5]. Bits 1..3 of xyzt.units specify
the (same) space unit of pixdim[2:4]. Bits 4..6 of xyzt.units specify the
time unit of pixdim[5]. See xyzt-units.txt in the niftidoc directory of the
source package. The R function st2xyzt can be
cal.max
Maximum display intensity (white) corresponds to dataset
value cal.max. Dataset values above cal.max should display as white. cal.min and cal.max only make sense when applied to scalar-valued
datasets (i.e., dim[1] < 5 or dim[6] = 1).
cal.min
Minimum display intensity (black) corresponds to dataset
value cal.min. Dataset values below cal.min should display as black.
slice.duration
Time for 1 slice. If this is positive, AND if slice.dim is nonzero, indicates the amount of time used to acquire 1 slice.
toffset
Time axis shift: The toffset field can be used to indicate a nonzero start point for
the time axis. That is, time point m is at t=toffset+m*pixdim[5] for
m=1, ..., dim[5]-1.
descrip
char[80]. This field may contain any text you like
aux.file
char[24]. This field is used to store an auxiliary filename.
qform.code
NIFTI code (in 0, ... ,4). 0: Arbitrary
coordinates; 1: Scanner-based anatomical coordinates; 2:
Coordinates aligned to another file's, or to anatomical "truth" (coregistration); 3:
Coordinates aligned to Talairach-Tournoux Atlas; 4: MNI 152 normali
sform.code
NIFTI code (in 0, ... ,4) with the same meaning as
qform codes. The basic idea behind having two coordinate systems is to allow the image to store information about (1) the scanner coordinate system used in the acquisition of the volume (in the qform) a
quatern.b
Quaternion b param. These b,c,d quaternion parameters
encode a rotation matrix used when qform.code > 0 to
obtain a rigid transformation that maps voxel indices (i,j,k) to
spatial coordinates (x,y,z), typically anatomical coordinates assigned
by t
quatern.c
Quaternion c param
quatern.d
Quaternion d param
qoffset.x
Quaternion x shift. If the (0020,0032) DICOM attribute is extracted into (px,py,pz), then
qoffset.x = -px qoffset.y = -py qoffset.z = pz
is a reasonable setting when qform.code=NIFTI XFORM SCANNER ANAT.
qoffset.y
Quaternion y shift
qoffset.z
Quaternion z shift
srow.x
vector of length 4. 1st row affine transform. These srow.*
parameters contain an affine (non-rigid) transformation ("Method 3" in the nifti1.h
documentation) that maps voxel indices (i,j,k) to spatial coordinates (x,y,z).
srow.y
vector of length 4. 2nd row affine transform
srow.z
vector of length 4. 3rd row affine transform
intent.name
char[16]. 'name' or meaning of data. If no data name is implied or needed, intent.name[1] should be set to 0.