Learn R Programming

neuroim2 (version 0.8.5)

NeuroVecSeq: NeuroVecSeq: A Container for Sequential NeuroVec Objects

Description

The NeuroVecSeq class provides a container for managing a sequence of NeuroVec objects, particularly useful for handling time series or multi-session neuroimaging data where each segment may have different lengths.

Constructs a NeuroVecSeq object to represent a variable-length sequence of NeuroVec objects. This is particularly useful for managing time series data where different segments may have different lengths.

Usage

NeuroVecSeq(...)

Value

A NeuroVecSeq object containing:

  • The provided NeuroVec objects

  • Associated space information

  • Length information for each vector

Arguments

...

One or more instances of type NeuroVec.

Methods

[[

Extract a single volume at a specified time point

length

Get the total number of time points

sub_vector

Extract a subsequence of volumes

linear_access

Access data linearly across all vectors

Details

NeuroVecSeq objects store:

  • A list of NeuroVec objects, each potentially with different time dimensions

  • The lengths of each constituent NeuroVec

  • A combined NeuroSpace object representing the total space

The class provides methods for:

  • Accessing individual time points across all vectors

  • Extracting subsequences

  • Computing statistics across the sequence

  • Linear access to the underlying data

The function performs several validations:

  • Ensures all inputs are NeuroVec objects

  • Verifies spatial compatibility

  • Combines spatial information appropriately

See Also

NeuroVec for the base vector class, NeuroSpace for spatial information

Examples

Run this code
# Create some example NeuroVec objects
v1 <- NeuroVec(array(0, c(5, 5, 5, 2)),
               space = NeuroSpace(dim = c(5, 5, 5, 2)))
v2 <- NeuroVec(array(1, c(5, 5, 5, 4)),
               space = NeuroSpace(dim = c(5, 5, 5, 4)))
v3 <- NeuroVec(array(2, c(5, 5, 5, 6)),
               space = NeuroSpace(dim = c(5, 5, 5, 6)))

# Combine them into a sequence
vs <- NeuroVecSeq(v1, v2, v3)

# Access properties
length(vs)  # Total time points
vs[[5]]     # Get the 5th volume

# Extract a subsequence
sub_seq <- sub_vector(vs, 1:5)


# Create sample vectors
v1 <- NeuroVec(array(0, c(5, 5, 5, 2)),
               space = NeuroSpace(dim = c(5, 5, 5, 2)))
v2 <- NeuroVec(array(0, c(5, 5, 5, 4)),
               space = NeuroSpace(dim = c(5, 5, 5, 4)))

# Combine into sequence
vs <- NeuroVecSeq(v1, v2)
print(vs)


Run the code above in your browser using DataLab