Skip to contents

Writes a LatentNeuroVec to an HDF5 file with optional compression.

Usage

# S4 method for class 'LatentNeuroVec,character,missing,missing'
write_vec(x, file_name, compression = 9, nbit = FALSE)

Arguments

x

A LatentNeuroVec to write.

file_name

character file path to the output HDF5.

compression

integer in [1..9] specifying compression level (default: 9).

nbit

logical; if TRUE, uses N-bit compression (default: FALSE).

Value

Invisible NULL, called for side effects (writes to disk).

Details

This function saves:

  • basis matrix (as embedding)

  • loadings matrix (as spatial basis)

  • offset vector

  • Spatial metadata

  • Mask information

all inside an HDF5 file for future loading.

See also

LatentNeuroVec (from fmrilatent) for the class definition.

Examples

if (FALSE) { # \dontrun{
library(fmrilatent)
library(fmristore)

# Create a LatentNeuroVec
lvec <- LatentNeuroVec(basis, loadings, space, mask)

# Write to HDF5
temp_file <- tempfile(fileext = ".h5")
write_vec(lvec, temp_file, compression = 6)
} # }