Skip to content

unfoldtoolbox/UnfoldBIDS.jl

Repository files navigation

UnfoldBIDS

Dev Build Status Coverage

Estimation Visualisation Simulation BIDS pipeline Decoding Statistics MixedModelling
Unfold.jl Logo UnfoldMakie.jl Logo UnfoldSim.jl Logo UnfoldBIDS.jl Logo UnfoldDecode.jl Logo UnfoldStats.jl Logo UnfoldMixedModels.jl logo

Sub/Wrapper-Package of Unfold.jl to automatically load a Dataset in BIDS format and apply unfold-style processing to all participants in one go. Additionally gives the means to apply MNE preprocessing.

Install

Installing Julia

Click to expand

The recommended way to install julia is juliaup. It allows you to, e.g., easily update Julia at a later point, but also test out alpha/beta versions etc.

TL:DR; If you dont want to read the explicit instructions, just copy the following command

Windows

AppStore -> JuliaUp, or winget install julia -s msstore in CMD

Mac & Linux

curl -fsSL https://install.julialang.org | sh in any shell

Installing Unfold

using Pkg
Pkg.add("UnfoldBIDS")

Quickstart

using UnfoldBIDS

Look up the paths of all subjects and store in a Dataframe

Note: UnfoldBIDS.jl currently only works on paths and filenames, but ignores information from .json files.

layout_df = bids_layout(bidsPath::AbstractString; kwargs)
"""
# Input
bidsPath::AbstractString; # Path to BIDS root folder

# Kwargs
- derivatives::Bool=true: Do you want to us the derivative/ processed data?
- specific_folder::Union{Nothing,AbstractString}=nothing: If you want a specific folder in derivatives or root specify here
- exclude_folder::Union{Nothing,AbstractString}=nothing: You can exclude specific folders when not looking for a specific sub-folder 
- ses::Union{Nothing,AbstractString}=nothing: Specify session; will load all sessions if not specified
- task::Union{Nothing,AbstractString}=nothing: Specify task; will load all tasks if not specified
- run::Union{Nothing,AbstractString}=nothing): Specify run; will load all runs if not specified

"""

Load all data into memory/ one dataframe:

eeg_df = load_bids_eeg_data(layout_df; verbose::Bool=true, kwargs...)

Run Unfold model

models_df = run_unfold(eeg_df, bf_dict; eventcolumn="event", removeTimeexpandedXs=true, extract_data = raw_to_data, verbose::Bool=true, kwargs...)

(bf_dict = basis functions dictionary; see Unfold.jl):

For dataframe containing tidy results

results_df = bids_coeftable(models_df)

Unpack single subject tidy results into one big tidy DataFrame, with subject information

results = unpack_results(results_df)

Supported EEG file types

  • edf
  • vhdr
  • fif
  • set

Contributions

Contributions are very welcome. These could be typos, bugreports, feature-requests, speed-optimization, new solvers, better code, better documentation.

How-to Contribute

You are very welcome to raise issues and start pull requests!

Adding Documentation

  1. We recommend to write a Literate.jl document and place it in docs/literate/FOLDER/FILENAME.jl with FOLDER being HowTo, Explanation, Tutorial or Reference (recommended reading on the 4 categories).
  2. Literate.jl converts the .jl file to a .md automatically and places it in docs/src/generated/FOLDER/FILENAME.md.
  3. Edit make.jl with a reference to docs/src/generated/FOLDER/FILENAME.md.

Contributors

Benedikt Ehinger
Benedikt Ehinger

🐛 💻 📆 🤔
René Skukies
René Skukies

👀 🤔 💻 🐛

This project follows the all-contributors specification.

Contributions of any kind welcome! You can find the emoji key for the contributors here

Citation

Acknowledgements

Funded by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany´s Excellence Strategy – EXC 2075 – 390740016

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

Languages