Learn R Programming

neuroim2 (version 0.8.5)

read_image: read_image

Description

Convenience wrapper that inspects the file metadata and dispatches to read_vol for 3D data or read_vec for 4D data.

Usage

read_image(
  file_name,
  type = c("auto", "vol", "vec"),
  index = 1,
  indices = NULL,
  mask = NULL,
  mode = c("normal", "mmap", "bigvec", "filebacked")
)

Value

A NeuroVol when the input is effectively 3D (or when

type = "vol"), otherwise a NeuroVec/NeuroVecSeq.

Arguments

file_name

Character vector of file paths.

type

One of "auto", "vol", or "vec" to override dispatch.

index

Volume index to use when returning a NeuroVol or when you want to load a subset of volumes while still returning a NeuroVec.

indices

Optional vector of indices passed through to read_vec.

mask

Optional mask passed to read_vec.

mode

IO mode forwarded to read_vec.

Examples

Run this code
vol <- read_image(system.file("extdata", "global_mask2.nii.gz", package = "neuroim2"))
vec <- read_image(system.file("extdata", "global_mask_v4.nii", package = "neuroim2"))

Run the code above in your browser using DataLab