NeuroVecSeq: NeuroVecSeq: A Container for Sequential NeuroVec Objects

View source: R/neurovecseq.R

NeuroVecSeqR Documentation

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(...)

Arguments

...

One or more instances of type NeuroVec.

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

Value

A NeuroVecSeq object containing:

  • The provided NeuroVec objects

  • Associated space information

  • Length information for each vector

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

See Also

NeuroVec-class for the base vector class NeuroSpace-class for spatial information

Examples

## Not run: 
# 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)

## End(Not run)

## Not run: 
# 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)

## End(Not run)


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