https://github.com/bbuchsbaum/fmriarrow
parquet based file format for fmri data
https://github.com/bbuchsbaum/fmriarrow
Last synced: 5 months ago
JSON representation
parquet based file format for fmri data
- Host: GitHub
- URL: https://github.com/bbuchsbaum/fmriarrow
- Owner: bbuchsbaum
- License: mit
- Created: 2025-06-04T01:51:30.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-06-04T09:11:18.000Z (10 months ago)
- Last Synced: 2025-06-04T09:11:59.600Z (10 months ago)
- Language: R
- Size: 169 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fmriarrow
This package provides helper functions for storing fMRI time series in
Apache Parquet files and querying them efficiently. The Parquet files
use 0-based voxel coordinates and a Morton (Z-order) index so that
spatially nearby voxels are stored contiguously on disk.
## Basic workflow
```r
library(neuroim2)
library(fmriarrow)
# create or load a NeuroVec object
nv <- neuroim2::emptyNeuroVec(c(2, 2, 1, 2))
# convert to Parquet
outfile <- tempfile(fileext = ".parquet")
neurovec_to_fpar(nv, outfile, subject_id = "subj01")
# read metadata back
md <- read_fpar_metadata(outfile)
# query a small ROI (0-based coordinates)
roi <- read_fpar_coords_roi(outfile, c(0, 1), c(0, 1), c(0, 0), exact = TRUE)
```
Coordinates stored in the Parquet file are **0-based**, whereas
`neuroim2` works with 1-based indices. When querying by coordinates you
must supply the 0-based values.
The query helpers operate on a single Parquet file at a time. For
cohort-level analyses you can use `arrow::open_dataset()` on a directory
of such files.