This function reads one or more NIfTI-1, NIfTI-2 or ANALYZE-7.5 files into R, using the standard NIfTI C library.
readNifti(file, internal = FALSE, volumes = NULL)
file | A character vector of file names. |
---|---|
internal | Logical value. If |
volumes | An integer vector giving the volumes to read (counting along
all dimensions beyond the third jointly), or |
An array or internal image, with class "niftiImage"
(and
possibly also "internalImage"
), or a list of such objects if
file
has length greater than one.
If the internal
argument is FALSE
(the default), the
data type of the image pointer will be set to match one of R's native
numeric data types, i.e., 32-bit signed integer or 64-bit double-precision
floating-point. In these circumstances the data type reported by the
niftiHeader
function will therefore not, in general, match
the storage type used in the file. See also the datatype
argument
to writeNifti
.
The NIfTI-1 standard (https://www.nitrc.org/docman/view.php/26/64/nifti1.h).
Jon Clayden <code@clayden.org>
path <- system.file("extdata", "example.nii.gz", package="RNifti")
readNifti(path)
#> Image array of mode "integer" (2.1 Mb)
#> - 96 x 96 x 60 voxels
#> - 2.5 x 2.5 x 2.5 mm per voxel
readNifti(path, internal=TRUE)
#> Internal image: "NIfTI image"
#> - 96 x 96 x 60 voxels
#> - 2.5 x 2.5 x 2.5 mm per voxel