| updateNifti {RNifti} | R Documentation |
This function adds or updates the internal NIfTI-1 object for an array,
using metadata from the template. The dimensions and, if available, pixel
dimensions, from the image will replace those from the template.
updateNifti(image, template = NULL, datatype = "auto")
image |
A numeric array. |
template |
An image, in any acceptable form (see
|
datatype |
The NIfTI datatype to use within the internal image. The
default, |
If template is a complete list of NIfTI-1 header fields, like that
produced by niftiHeader, or an image, then it will be used to
create the internal object, and then the data and metadata associated with
the image will overwrite the appropriate parts. If template
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).
Datatype information in a list template 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.
A copy of the original image, with its internal image
attribute set or updated appropriately. If datatype is not
"auto" then the result is an internal image.
The scl_slope and 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.
Jon Clayden <code@clayden.org>