data_reader: Create a Data Reader

data_readerR Documentation

Create a Data Reader

Description

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.

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

Value

A BinaryReader object configured for the specific data format

See Also

read_header, BinaryReader

Examples

## Not run: 
# Create reader for NIFTI file
meta <- read_header("brain.nii")
reader <- data_reader(meta, offset = 0)

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

## End(Not run)


bbuchsbaum/neuroim2 documentation built on Jan. 2, 2025, 3:38 p.m.