This function converts a filename, array or other image class into an object
"niftiImage", and optionally updates its metadata from a
reference image and/or changes its internal datatype. The dimensions and
pixel dimensions from the
image will replace those from the reference
object, if they are available.
1 2 3 4
Any suitable object (see Details).
An image, or a named list of NIfTI-1 properties like that
Additional parameters to methods.
The NIfTI datatype to use within the internal image. The
Logical value. If
image has an internal NIfTI pointer, that will be retrieved
directly. Otherwise, if it is a string, it will be taken to be a filename.
If it looks like a
"nifti" object (from package
"MriImage" object (from package
conversion will be performed. A list will be assumed to be of the form
niftiHeader. Finally, a numeric array or matrix,
or RGB array, will be converted using default image parameters.
reference is a complete list of NIfTI-1 header fields, like that
niftiHeader, or an image, then it will be used to
create the internal object, and then the data and metadata associated with
image will overwrite the appropriate parts. If
is an incomplete list, the
image will be used to create the internal
object, and then the specified fields will be overwritten from the list.
This allows users to selectively update certain fields while leaving others
alone (but see the note below).
If multiple values are passed for a field that expects a scalar (which is most of them), the first element of the vector will be used, with a warning. An empty vector will be ignored, also with a warning. If a value of the wrong length is passed to a vector-valued field, an error will be generated.
Datatype information in a list
reference is ignored. The datatype can
only be changed using the
datatype argument, but in this case the
internal object gets out of sync with the R array, so an internal image is
returned to avoid the mismatch. Changing the internal datatype in this way
is for advanced usage only.
updateNifti are soft-deprecated alternative
interfaces to this function, which behave like the pre-existing functions of
the same names. They may be removed in future.
An array or internal image, with class
scl_inter fields affect the numerical
interpretation of the pixel data, so it is impossible in general to change
them without also changing the array values on both the C and the R side.
Therefore, to avoid unexpected side-effects, these fields are not affected
by this function. The
pixdim fields can be changed,
but for most users the accessor functions of the same name are much safer,
and should be used in preference.
Jon Clayden <email@example.com>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.