Skip to contents

Creates a data reader for accessing neuroimaging data from various file formats. The reader provides a unified interface for reading data regardless of the underlying format.

Usage

data_reader(x, offset)

Arguments

x

An object containing metadata required to create the reader (e.g., file path, format info)

offset

Numeric. Byte offset where data reading should begin. Default is 0.

Value

A BinaryReader object configured for the specific data format

Details

Create a Data Reader for Neuroimaging Data

The data_reader function is a generic that creates appropriate readers for different neuroimaging formats. It handles:

  • File format detection and validation

  • Endianness configuration

  • Data type conversion

  • Compression handling (e.g., gzip)

  • Proper byte alignment

See also

read_header for reading headers, BinaryReader for reading binary data

Examples

if (FALSE) { # \dontrun{
# Create reader for NIFTI file
meta <- read_header("brain.nii")
reader <- data_reader(meta, offset = 0)

# Read first 100 voxels
data <- reader$read(100)
} # }