table.to.nii: Table to NII file

Description Usage Arguments Value Author(s) Examples

View source: R/table.to.nii.R

Description

Write Dataframe or Matrix to NII file

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  table.to.nii(in.table,
               coords,
               save.dir,
               prefix=NULL,
               do.log=TRUE,
               model.string=NULL,
               ref.nii=NULL,
               img.dims=NULL,
               pixdim=NULL,
               orient=NULL)

Arguments

in.table

dataframe or matrix object to output to NII file

coords

voxel coordinates of location in NII file to write values

save.dir

directory location to save output

prefix

prefix to be the base of filenames, default is the name of the input table object

do.log

logical, whether or not to write log file providing details about what the output contents are. this may be helpful for sorting through volumes.

model.string

A string to wirte to the log file specifying describing or specifying the model that was run

ref.nii

a reference NII image to draw image properties from (e.g., dimensions and orientation)

img.dims

voxel dimensions of target NII file

pixdim

voxel dimensions of NII output

orient

orientation list object of NII output

Value

Output directly to log.text file and write to specified coordinates in a set of NII files.

Author(s)

Timothy R. Koscik <timothy-koscik@uiowa.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# get filename for example NII file included in nifti.io package
ref.nii <- system.file("extdata", "egBrain.nii", package="nifti.io")

mdl <- lm(mpg ~ cyl, mtcars)
mdl.coef <- as.data.frame(summary(mdl)$coef)
table.to.nii(in.table=mdl.coef,
             coords=c(20,35,20),
             save.dir=tempdir(),
             prefix="exampleModel_coef",
             model.string="lm(mpg ~ cyl, mtcars)",
             ref.nii=ref.nii)

nifti.io documentation built on June 8, 2021, 9:06 a.m.