Learn R Programming

AnalyzeFMRI (version 1.1-25)

f.write.analyze: writes an array to a .img/.hdr pair in ANALYZE format

Description

Creates a .img and .hdr pair of files from a given array

Usage

f.write.analyze(mat,file,size,pixdim,vox.units,cal.units,originator,path.out=NULL)

Value

Nothing is returned

Arguments

mat

An array

file

The name of the file to be written to, without .img or .hdr suffix

size

Specify the format of the .img file. Either "float" (for 4 byte floats) or "int" (2 byte integers) or "char" (1 byte integers).

pixdim

A vector of length 3 specifying the voxel dimensions in mm

vox.units

String specifying the spatial units of measure for a voxel

cal.units

String specifying the name of calibration unit

originator

vector of length 5, only the three first values are used. Put the last two equal to zero

path.out

The path where to write the file (mandatory argument, even if the default value is NULL for backward compatibility)

See Also

f.write.array.to.img.8bit, f.write.array.to.img.2bytes, f.write.array.to.img.float

Examples

Run this code
a <- array(rnorm(20 * 30 * 40 * 3), dim = c(20, 30, 40, 3))
file <- "temp"
tmpdir <- tempdir()
f.write.analyze(a, file, size = "float", path.out = tmpdir)
unlink(tmpdir) # tidy up

Run the code above in your browser using DataLab