Skip to main content

Multi-echo combinations

This repository provides a command line tool to combine multiple echoes from a multi-echo BOLD fMRI acquisition. It currently provides three different echo avering algorithms:

algorithm description
1. average Echoes are weighted equally
2. PAID Echoes are weighted by their CNR, i.e. by their TE*tSNR contributions
3. TE Echoes are weighted by their TEs

For more information on multiecho acquisition and combination schemes, please refer to (for example):

  • Poser et al. (2006). BOLD Contrast Sensitivity Enhancement and Artifact Reduction with Multiecho EPI: Parallel-Acquired Inhomogeneity- Desensitized fMRI. Magn. Reson. Med. 55:6, pp. 1227–35.
  • Posse, Stefan (2012). Multi-Echo Acquisition. NeuroImage 62:2, pp. 665–671.

Installation

To install, simply run:

pip install multiecho

This will give you the latest stable release of the software. To get the very latest version of the software you can install the package directly from the github source code repository:

pip install git+https://github.com/Donders-Institute/multiecho

Alternatively, to get the latest (possibly unreleased) code, clone this repository and run the following on the root folder of the repository:

pip install .

The tool only supports Python 3.6+.

Usage

Once installed, a command line tool called mecombine will be available in your PATH. Detailed usage information can be found by running mecombine -h:

usage: mecombine [-h] [-o OUTPUTNAME] [-w [WEIGHTS [WEIGHTS ...]]]
                 [-a {PAID,TE,average}] [-s] [-v VOLUMES]
                 pattern

Combine multi-echo echoes.

Tools to combine multiple echoes from an fMRI acquisition.
It expects input files saved as NIfTIs, preferably organised
according to the BIDS standard.

positional arguments:
  pattern               Globlike search pattern with path to select the echo
                        images that need to be combined. Because of the
                        search, be sure to check that not too many files are
                        being read

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUTNAME, --outputname OUTPUTNAME
                        File output name. If not a fullpath name, then the
                        output will be stored in the same folder as the input.
                        If empty, the output filename will be the filename of
                        the first echo appended with a '_combined' suffix
                        (default: None)
  -w [WEIGHTS [WEIGHTS ...]], --weights [WEIGHTS [WEIGHTS ...]]
                        Weights (e.g. = echo times) for all echoes (default:
                        None)
  -a {PAID,TE,average}, --algorithm {PAID,TE,average}
                        Combination algorithm. Default: TE (default: TE)
  -s, --saveweights     If passed and algorithm is PAID, save weights
                        (default: False)
  -v VOLUMES, --volumes VOLUMES
                        Number of volumes that is used to compute the weights
                        if algorithm is PAID (default: 100)

examples:
  mecombine '/project/number/bids/sub-001/func/*_task-motor_*echo-*.nii.gz'
  mecombine '/project/number/bids/sub-001/func/*_task-rest_*echo-*.nii.gz' -a PAID
  mecombine '/project/number/bids/sub-001/func/*_acq-MBME_*run-01*.nii.gz' -w 11 22 33 -o sub-001_task-stroop_acq-mecombined_run-01_bold.nii.gz

Caveats

Currently inneficient as we load all datasets into memory. We could iterate through the volumes and only keep the final combined series in memory at any given time.

You may receive a runtime warning when combining echoes with PAID. If your datasets have voxels with zeros, e.g., if they were masked, a division by 0 will lead to infinite weights. You may safely ignore the warning, but do check your data after the combination.

By default PAID will compute the weights based on the last 100 volumes of the acquisition. Whether this is optimal or not is up to discussion. If you are testing out the combination on a small subset of volumes, say 5 or so, then the weights won't be stable and your image may look noisy.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multiecho-0.2.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multiecho-0.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file multiecho-0.2.tar.gz.

File metadata

  • Download URL: multiecho-0.2.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.20.1 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8

File hashes

Hashes for multiecho-0.2.tar.gz
Algorithm Hash digest
SHA256 4b86873306c4fa0b55020bd48feb69ba5c6700df78b730f0ef5da3247fcffefa
MD5 9c0cfb0ec654fb58a10243b25e3225e8
BLAKE2b-256 543b5a626809cef70e4c3244278f1b4681437ec64c72eecc04781b993b8970cc

See more details on using hashes here.

File details

Details for the file multiecho-0.2-py3-none-any.whl.

File metadata

  • Download URL: multiecho-0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.20.1 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8

File hashes

Hashes for multiecho-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2094896df1ccbf691f0100bfd2fe7476fb64ec17ec3e9970e21f84ed2e134a39
MD5 13c538d178f7fb2451f04afc2aa0d036
BLAKE2b-256 804858cce4ac8e5d11e58977f8063f3c88119f393845e7ccfca0e9d28c788f9a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.31

2 files

0.30

2 files

0.29

2 files

0.28

2 files

0.25

2 files

0.24

2 files

0.23

2 files

0.22

2 files

0.21

2 files

This release

0.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page