API

Note

This API is currently under development and documentation is still being updated.

Module

Description

fmrwhy.batch

Wrapper functions for SPM12 batch processes

fmrwhy.bidsutils

Utilities for BIDS-compatibility

fmrwhy.multiecho

Multi-echo fMRI analysis functions

fmrwhy.qc

Quality control functions

fmrwhy.realtime

Real-time fMRI analysis functions

fmrwhy.settings

Defaults and workflow-specific settings

fmrwhy.utils

Common utility functions

fmrwhy.workflows

BIDS-compatible analysis pipelines


fmrwhy.batch: Wrapper functions for SPM12 batch processes


fmrwhy.bidsutils: Utilities for BIDS-compatibility


fmrwhy.bidsutils.fmrwhy_bids_setupQcDerivDirs(bids_dir, options)

Creates (or checks) the correct BIDS derivatives directory structure for the Quality Control workflow (fmrwhy_workflow_qc()).

Parameters
  • bids_dir (character array) – Directory location of the BIDS dataset for which the derivatives are created.

  • options (struct) – Empty or existing options structure

Returns

options - updated structure with directory locations of located dependencies

fmrwhy.bidsutils.fmrwhy_bids_setupQcSubDirs(bids_dir, sub, options)
fmrwhy.bidsutils.fmrwhy_bids_getAnatDerivs(bids_dir, sub, options)
fmrwhy.bidsutils.fmrwhy_bids_constructFilename(filetype, varargin)

BIDS 1.4.0 - This does not yet take into account whether an entity is OPTIONAL or REQUIRED for a specific file modality/type (e.g. ‘func’, ‘anat’, ‘meg’, etc). It assumes all parameters are optional and just constructs the filename given the input also, file extension is passed as parameter ==> should be automatically determined from file modality/type

Parameters
  • filetype – something x

  • varargin – something y

Returns

filename


fmrwhy.multiecho: Multi-echo fMRI analysis functions


fmrwhy.qc: Quality control functions


fmrwhy.realtime: Real-time fMRI analysis functions


fmrwhy.settings: Defaults and workflow-specific settings


fmrwhy.settings.fmrwhy_defaults()

Outputs the options structure with the fMRwhy toolbox root directory location as a single field

fmrwhy.settings.fmrwhy_settings_validate(options)

fmrwhy_settings_validate: Validate and derive settings for the fmrwhy_workflow_qc pipeline


fmrwhy.utils: Common utility functions


fmrwhy.utils.fmrwhy_util_checkDependencies(options)

Check if all fMRwhy dependencies are installed and located on the MATLAB path. Outputs warnings if dependencies are not found. Dependencies include: - SPM12: https://github.com/spm/spm12/releases/tag/r7771 - bids-matlab: https://github.com/bids-standard/bids-matlab - dicm2nii: https://github.com/jsheunis/dicm2nii/releases/tag/v0.2 - TAPAS PhysIO: https://github.com/translationalneuromodeling/tapas/releases/tag/v4.0.0 - Raincoud Plots: https://github.com/RainCloudPlots/RainCloudPlots/releases/tag/v1.1

Parameters

options (struct) – Empty or existing options structure

Returns

options - updated structure with directory locations of located dependencies

fmrwhy.utils.fmrwhy_util_saveNiftiFrom4D(fn4D, fn3D, idx)

Create a single 3D nifti file from a 4D nifti file, given a specific image index.fn3D OR alternatively, split 4D nifti file into a full set of 3D nifti images


fmrwhy.workflows: BIDS-compatible analysis pipelines


fmrwhy.workflows.fmrwhy_workflow_qc(settings_fn)

A custom workflow that does anatomical and functional data quality control for all subjects in a BIDS directory. Steps include anatomical-to-functional processing, basic functional time series preprocessing, generating a range of QC metrics and images, and compiling an HTML-report per subject.

Parameters

settings_fn (M-file) – User preference settings for the specific analysis and dataset, see

Returns

options - the updated structure with parameter settings pertaining to the analysis and dataset

Outputs

A directory with all assets necessary for rendering the HTML report, located in derivatives/fmrwhy-qc/sub-XXX/report_[yyyymmddhhmmss]

Example

>>> settings_fn = '/fMRwhy/fmrwhy/settings/fmrwhy_settings_template.m';
>>> options = fmrwhy_workflow_qc(settings_fn)

See also

fmrwhy.workflows.fmrwhy_workflow_qcSubReport(sub, options)

A workflow that generates a quality report (in HTML format) for a single subject in a BIDS dataset. This workflow assumes that all necessary preprocessing steps have been completed, including anatomical to functional coregistration, segmentation, ROI registration (if specified), functional time series preprocessing, and the generation of quality control metrics and visualizations. All of these preprocessing steps are run as part of the fmrwhy_workflow_qc() workflow.

Parameters
  • sub (character array) – the subject identifier for which the report is to be generated

  • options (struct) – the updated options structure

Returns

[report, js_string] - variable array with two strings

See also

This workflow is called by fmrwhy_workflow_qc()