Learn R Programming

neuroim2 (version 0.8.5)

as_mmap: Convert a NeuroVec to a memory-mapped representation

Description

Generic for converting neuroimaging vectors to a memory-mapped MappedNeuroVec on disk (when possible).

Methods for the as_mmap generic, which convert various neuroimaging vector types to a MappedNeuroVec backed by an on-disk NIfTI file.

Usage

as_mmap(x, file = NULL, ...)

# S4 method for MappedNeuroVec as_mmap(x, file = NULL, ...)

# S4 method for FileBackedNeuroVec as_mmap(x, file = NULL, ...)

# S4 method for NeuroVec as_mmap(x, file = NULL, data_type = "FLOAT", overwrite = FALSE, ...)

# S4 method for SparseNeuroVec as_mmap(x, file = NULL, data_type = "FLOAT", overwrite = FALSE, ...)

Value

A MappedNeuroVec (or x itself if already memory-mapped).

A MappedNeuroVec (or x itself if it is already memory-mapped).

Arguments

x

A neuroimaging vector (NeuroVec, MappedNeuroVec, or FileBackedNeuroVec).

file

Optional output file name. If NULL, a temporary file with extension .nii is created.

...

Additional arguments passed to methods (e.g. data_type, overwrite).

data_type

Character string specifying the output data type for the NIfTI file. Should be one of: "BINARY", "UBYTE", "SHORT", "INT", "FLOAT", "DOUBLE". Default is "FLOAT".

overwrite

Logical; if TRUE, overwrite an existing file at the specified path. Default is FALSE.