Skip to contents

Write a 3d image volume to disk

Usage

write_vol(x, file_name, format, data_type)

# S4 method for NeuroVol,character,missing,missing
write_vol(x, file_name)

# S4 method for ClusteredNeuroVol,character,missing,missing
write_vol(x, file_name)

# S4 method for NeuroVol,character,character,missing
write_vol(x, file_name, format)

# S4 method for ROIVol,character,character,missing
write_vol(x, file_name, format)

# S4 method for NeuroVol,character,missing,character
write_vol(x, file_name, data_type)

Arguments

x

an image object, typically a NeuroVol instance.

file_name

output file name

format

file format string. Since "NIFTI" is the only currently supported format, this parameter can be safely ignored and omitted.

data_type

output data type, If specified should be a character vector of: "BINARY", "UBYTE", "SHORT", "INT", "FLOAT", "DOUBLE". Otherwise output format will be inferred from R the datatype of the image.

Details

The output format will be inferred from file extension.

The output format will be inferred from file extension. write_vol(x, "out.nii") outputs a NIFTI file. write_vol(x, "out.nii.gz") outputs a gzipped NIFTI file.

No other file output formats are currently supported.

Examples


bvol <- NeuroVol(array(0, c(10,10,10)), NeuroSpace(c(10,10,10), c(1,1,1)))
if (FALSE) {
write_vol(bvol, "out.nii")
write_vol(bvol, "out.nii.gz")
}