write.nii.voxel {nifti.io} | R Documentation |
Write NII Voxel
Description
Write NII Voxel
Usage
write.nii.voxel(nii.file, coords, value)
Arguments
nii.file |
Full directory listing to a NIfTI file. File must not be gzipped. |
coords |
A numeric vector conatining x,y,z,t coordinates indicating the location to write values |
value |
A numeric value to write |
Details
NIfTI files need to be unzipped before using this function or any other portions of the nifti.io package. This is necessary given the inconsistent way in which gzipped files are indexed (Some information on this is given in the documentation for the readBin function).
Value
Output directly to NIFTI file.
Author(s)
Timothy R. Koscik <timothy-koscik@uiowa.edu>
Examples
# get filename for example NII file included in nifti.io package
ref.nii <- system.file("extdata", "egBrain.nii", package="nifti.io")
# create a temporary file to write into
tdir <- tempdir()
new.nii <- paste0(tdir, "/new.nii")
init.nii(new.nii = new.nii, ref.nii = ref.nii)
# set coordinates and value of voxel to write
coordinates <- c(20,35,20)
new.value <- rnorm(1)
# write to single voxel in NII file
write.nii.voxel(nii.file = new.nii, coords = coordinates, value = new.value)
[Package nifti.io version 1.0.0 Index]