Optimal combination with t2smap

Optimal combination with t2smap#

Use t2smap [DuPre et al., 2021] to combine data.

import os
from glob import glob

import matplotlib.pyplot as plt
import numpy as np
from myst_nb import glue
from nilearn import image, plotting
from repo2data.repo2data import Repo2Data
from tedana import workflows

# Install the data if running locally, or point to cached data if running on neurolibre
DATA_REQ_FILE = os.path.join("../binder/data_requirement.json")

# Download data
repo2data = Repo2Data(DATA_REQ_FILE)
data_path = repo2data.install()
data_path = os.path.abspath(data_path[0])
---- repo2data starting ----
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/repo2data
Config from file :
../binder/data_requirement.json
Destination:
./../data/multi-echo-data-analysis

Info : ./../data/multi-echo-data-analysis already downloaded
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
func_dir = os.path.join(data_path, "func/")
data_files = [
    os.path.join(
        func_dir,
        "sub-04570_task-rest_echo-1_space-scanner_desc-partialPreproc_bold.nii.gz",
    ),
    os.path.join(
        func_dir,
        "sub-04570_task-rest_echo-2_space-scanner_desc-partialPreproc_bold.nii.gz",
    ),
    os.path.join(
        func_dir,
        "sub-04570_task-rest_echo-3_space-scanner_desc-partialPreproc_bold.nii.gz",
    ),
    os.path.join(
        func_dir,
        "sub-04570_task-rest_echo-4_space-scanner_desc-partialPreproc_bold.nii.gz",
    ),
]
echo_times = [12.0, 28.0, 44.0, 60.0]
mask_file = os.path.join(
    func_dir, "sub-04570_task-rest_space-scanner_desc-brain_mask.nii.gz"
)
confounds_file = os.path.join(
    func_dir, "sub-04570_task-rest_desc-confounds_timeseries.tsv"
)

out_dir = os.path.join(data_path, "t2smap")
workflows.t2smap_workflow(
    data_files,
    echo_times,
    out_dir=out_dir,
    mask=mask_file,
    prefix="sub-04570_task-rest_space-scanner",
    fittype="curvefit",
)
INFO     t2smap:t2smap_workflow:252 Using output directory: /home/runner/work/multi-echo-data-analysis/multi-echo-data-analysis/data/multi-echo-data-analysis/t2smap
INFO     t2smap:t2smap_workflow:278 Loading input data: ['/home/runner/work/multi-echo-data-analysis/multi-echo-data-analysis/data/multi-echo-data-analysis/func/sub-04570_task-rest_echo-1_space-scanner_desc-partialPreproc_bold.nii.gz', '/home/runner/work/multi-echo-data-analysis/multi-echo-data-analysis/data/multi-echo-data-analysis/func/sub-04570_task-rest_echo-2_space-scanner_desc-partialPreproc_bold.nii.gz', '/home/runner/work/multi-echo-data-analysis/multi-echo-data-analysis/data/multi-echo-data-analysis/func/sub-04570_task-rest_echo-3_space-scanner_desc-partialPreproc_bold.nii.gz', '/home/runner/work/multi-echo-data-analysis/multi-echo-data-analysis/data/multi-echo-data-analysis/func/sub-04570_task-rest_echo-4_space-scanner_desc-partialPreproc_bold.nii.gz']
INFO     t2smap:t2smap_workflow:298 Using user-defined mask
INFO     utils:make_adaptive_mask:198 Echo-wise intensity thresholds for adaptive mask: [258.33994278 180.98638476 134.6796175   91.51006253]
WARNING  utils:make_adaptive_mask:227 734 voxels in user-defined mask do not have good signal. Removing voxels from mask.
INFO     t2smap:t2smap_workflow:306 Computing adaptive T2* map
2-echo monoexponential:   0%|          | 0/2224 [00:00<?, ?it/s]
2-echo monoexponential:   3%|▎         | 64/2224 [00:00<00:03, 633.14it/s]
2-echo monoexponential:   7%|▋         | 147/2224 [00:00<00:02, 745.68it/s]
2-echo monoexponential:  10%|█         | 227/2224 [00:00<00:02, 767.68it/s]
2-echo monoexponential:  14%|█▍        | 311/2224 [00:00<00:02, 792.70it/s]
2-echo monoexponential:  18%|█▊        | 391/2224 [00:00<00:02, 782.56it/s]
2-echo monoexponential:  21%|██▏       | 476/2224 [00:00<00:02, 801.95it/s]
2-echo monoexponential:  25%|██▌       | 557/2224 [00:00<00:02, 800.26it/s]
2-echo monoexponential:  29%|██▊       | 638/2224 [00:00<00:02, 789.43it/s]
2-echo monoexponential:  32%|███▏      | 717/2224 [00:00<00:01, 789.45it/s]
2-echo monoexponential:  36%|███▌      | 801/2224 [00:01<00:01, 804.59it/s]
2-echo monoexponential:  40%|███▉      | 882/2224 [00:01<00:01, 802.98it/s]
2-echo monoexponential:  43%|████▎     | 963/2224 [00:01<00:01, 799.53it/s]
2-echo monoexponential:  47%|████▋     | 1044/2224 [00:01<00:01, 799.66it/s]
2-echo monoexponential:  51%|█████     | 1126/2224 [00:01<00:01, 804.97it/s]
2-echo monoexponential:  54%|█████▍    | 1207/2224 [00:01<00:01, 802.08it/s]
2-echo monoexponential:  58%|█████▊    | 1288/2224 [00:01<00:01, 801.33it/s]
2-echo monoexponential:  62%|██████▏   | 1370/2224 [00:01<00:01, 805.50it/s]
2-echo monoexponential:  65%|██████▌   | 1451/2224 [00:01<00:00, 798.27it/s]
2-echo monoexponential:  69%|██████▉   | 1533/2224 [00:01<00:00, 803.06it/s]
2-echo monoexponential:  73%|███████▎  | 1616/2224 [00:02<00:00, 808.76it/s]
2-echo monoexponential:  76%|███████▋  | 1698/2224 [00:02<00:00, 810.00it/s]
2-echo monoexponential:  80%|████████  | 1780/2224 [00:02<00:00, 811.86it/s]
2-echo monoexponential:  84%|████████▎ | 1862/2224 [00:02<00:00, 810.32it/s]
2-echo monoexponential:  88%|████████▊ | 1947/2224 [00:02<00:00, 818.94it/s]
2-echo monoexponential:  91%|█████████ | 2029/2224 [00:02<00:00, 814.70it/s]
2-echo monoexponential:  95%|█████████▍| 2112/2224 [00:02<00:00, 806.27it/s]
2-echo monoexponential:  99%|█████████▊| 2193/2224 [00:02<00:00, 805.90it/s]
2-echo monoexponential: 100%|██████████| 2224/2224 [00:02<00:00, 798.83it/s]

3-echo monoexponential:   0%|          | 0/1092 [00:00<?, ?it/s]
3-echo monoexponential:   5%|▍         | 50/1092 [00:00<00:02, 497.32it/s]
3-echo monoexponential:   9%|▉         | 103/1092 [00:00<00:01, 512.38it/s]
3-echo monoexponential:  14%|█▍        | 157/1092 [00:00<00:01, 522.90it/s]
3-echo monoexponential:  19%|█▉        | 210/1092 [00:00<00:01, 520.87it/s]
3-echo monoexponential:  24%|██▍       | 263/1092 [00:00<00:01, 510.04it/s]
3-echo monoexponential:  29%|██▉       | 315/1092 [00:00<00:01, 512.79it/s]
3-echo monoexponential:  34%|███▎      | 367/1092 [00:00<00:01, 509.82it/s]
3-echo monoexponential:  38%|███▊      | 419/1092 [00:00<00:01, 509.86it/s]
3-echo monoexponential:  43%|████▎     | 473/1092 [00:00<00:01, 518.73it/s]
3-echo monoexponential:  48%|████▊     | 526/1092 [00:01<00:01, 520.32it/s]
3-echo monoexponential:  53%|█████▎    | 579/1092 [00:01<00:01, 509.62it/s]
3-echo monoexponential:  58%|█████▊    | 633/1092 [00:01<00:00, 516.45it/s]
3-echo monoexponential:  63%|██████▎   | 685/1092 [00:01<00:00, 515.36it/s]
3-echo monoexponential:  67%|██████▋   | 737/1092 [00:01<00:00, 512.62it/s]
3-echo monoexponential:  72%|███████▏  | 789/1092 [00:01<00:00, 504.74it/s]
3-echo monoexponential:  77%|███████▋  | 842/1092 [00:01<00:00, 510.16it/s]
3-echo monoexponential:  82%|████████▏ | 894/1092 [00:01<00:00, 510.97it/s]
3-echo monoexponential:  87%|████████▋ | 948/1092 [00:01<00:00, 516.90it/s]
3-echo monoexponential:  92%|█████████▏| 1000/1092 [00:01<00:00, 517.71it/s]
3-echo monoexponential:  96%|█████████▋| 1053/1092 [00:02<00:00, 520.98it/s]
3-echo monoexponential: 100%|██████████| 1092/1092 [00:02<00:00, 514.75it/s]

4-echo monoexponential:   0%|          | 0/20176 [00:00<?, ?it/s]
4-echo monoexponential:   0%|          | 53/20176 [00:00<00:38, 523.55it/s]
4-echo monoexponential:   1%|          | 109/20176 [00:00<00:37, 539.64it/s]
4-echo monoexponential:   1%|          | 169/20176 [00:00<00:35, 565.23it/s]
4-echo monoexponential:   1%|          | 229/20176 [00:00<00:34, 578.37it/s]
4-echo monoexponential:   1%|▏         | 287/20176 [00:00<00:34, 574.65it/s]
4-echo monoexponential:   2%|▏         | 350/20176 [00:00<00:33, 593.27it/s]
4-echo monoexponential:   2%|▏         | 410/20176 [00:00<00:33, 594.46it/s]
4-echo monoexponential:   2%|▏         | 470/20176 [00:00<00:33, 589.77it/s]
4-echo monoexponential:   3%|▎         | 531/20176 [00:00<00:33, 593.40it/s]
4-echo monoexponential:   3%|▎         | 591/20176 [00:01<00:33, 591.34it/s]
4-echo monoexponential:   3%|▎         | 651/20176 [00:01<00:33, 585.34it/s]
4-echo monoexponential:   4%|▎         | 710/20176 [00:01<00:33, 586.40it/s]
4-echo monoexponential:   4%|▍         | 771/20176 [00:01<00:32, 590.41it/s]
4-echo monoexponential:   4%|▍         | 831/20176 [00:01<00:33, 583.68it/s]
4-echo monoexponential:   4%|▍         | 893/20176 [00:01<00:32, 594.07it/s]
4-echo monoexponential:   5%|▍         | 954/20176 [00:01<00:32, 595.73it/s]
4-echo monoexponential:   5%|▌         | 1014/20176 [00:01<00:33, 567.71it/s]
4-echo monoexponential:   5%|▌         | 1073/20176 [00:01<00:33, 572.89it/s]
4-echo monoexponential:   6%|▌         | 1133/20176 [00:01<00:32, 579.35it/s]
4-echo monoexponential:   6%|▌         | 1194/20176 [00:02<00:32, 585.94it/s]
4-echo monoexponential:   6%|▌         | 1255/20176 [00:02<00:31, 592.16it/s]
4-echo monoexponential:   7%|▋         | 1319/20176 [00:02<00:31, 605.59it/s]
4-echo monoexponential:   7%|▋         | 1384/20176 [00:02<00:30, 615.54it/s]
4-echo monoexponential:   7%|▋         | 1446/20176 [00:02<00:31, 594.97it/s]
4-echo monoexponential:   7%|▋         | 1506/20176 [00:02<00:31, 584.90it/s]
4-echo monoexponential:   8%|▊         | 1568/20176 [00:02<00:31, 594.52it/s]
4-echo monoexponential:   8%|▊         | 1630/20176 [00:02<00:30, 600.12it/s]
4-echo monoexponential:   8%|▊         | 1694/20176 [00:02<00:30, 610.62it/s]
4-echo monoexponential:   9%|▊         | 1757/20176 [00:02<00:30, 613.49it/s]
4-echo monoexponential:   9%|▉         | 1819/20176 [00:03<00:29, 613.96it/s]
4-echo monoexponential:   9%|▉         | 1883/20176 [00:03<00:29, 620.03it/s]
4-echo monoexponential:  10%|▉         | 1946/20176 [00:03<00:29, 617.34it/s]
4-echo monoexponential:  10%|▉         | 2008/20176 [00:03<00:30, 586.52it/s]
4-echo monoexponential:  10%|█         | 2070/20176 [00:03<00:30, 595.76it/s]
4-echo monoexponential:  11%|█         | 2130/20176 [00:03<00:30, 594.17it/s]
4-echo monoexponential:  11%|█         | 2193/20176 [00:03<00:29, 603.08it/s]
4-echo monoexponential:  11%|█         | 2257/20176 [00:03<00:29, 613.05it/s]
4-echo monoexponential:  12%|█▏        | 2322/20176 [00:03<00:28, 621.81it/s]
4-echo monoexponential:  12%|█▏        | 2386/20176 [00:04<00:28, 624.57it/s]
4-echo monoexponential:  12%|█▏        | 2451/20176 [00:04<00:28, 630.83it/s]
4-echo monoexponential:  12%|█▏        | 2515/20176 [00:04<00:27, 632.23it/s]
4-echo monoexponential:  13%|█▎        | 2579/20176 [00:04<00:29, 605.84it/s]
4-echo monoexponential:  13%|█▎        | 2640/20176 [00:04<00:29, 602.79it/s]
4-echo monoexponential:  13%|█▎        | 2701/20176 [00:04<00:29, 601.22it/s]
4-echo monoexponential:  14%|█▎        | 2763/20176 [00:04<00:28, 606.39it/s]
4-echo monoexponential:  14%|█▍        | 2828/20176 [00:04<00:28, 618.14it/s]
4-echo monoexponential:  14%|█▍        | 2893/20176 [00:04<00:27, 624.62it/s]
4-echo monoexponential:  15%|█▍        | 2957/20176 [00:04<00:27, 628.42it/s]
4-echo monoexponential:  15%|█▍        | 3021/20176 [00:05<00:27, 631.73it/s]
4-echo monoexponential:  15%|█▌        | 3086/20176 [00:05<00:26, 636.90it/s]
4-echo monoexponential:  16%|█▌        | 3151/20176 [00:05<00:26, 639.46it/s]
4-echo monoexponential:  16%|█▌        | 3215/20176 [00:05<00:27, 622.23it/s]
4-echo monoexponential:  16%|█▌        | 3278/20176 [00:05<00:27, 614.08it/s]
4-echo monoexponential:  17%|█▋        | 3342/20176 [00:05<00:27, 619.13it/s]
4-echo monoexponential:  17%|█▋        | 3405/20176 [00:05<00:27, 620.13it/s]
4-echo monoexponential:  17%|█▋        | 3468/20176 [00:05<00:26, 622.10it/s]
4-echo monoexponential:  18%|█▊        | 3534/20176 [00:05<00:26, 631.81it/s]
4-echo monoexponential:  18%|█▊        | 3599/20176 [00:05<00:26, 633.94it/s]
4-echo monoexponential:  18%|█▊        | 3663/20176 [00:06<00:26, 631.75it/s]
4-echo monoexponential:  18%|█▊        | 3727/20176 [00:06<00:25, 633.36it/s]
4-echo monoexponential:  19%|█▉        | 3792/20176 [00:06<00:25, 635.62it/s]
4-echo monoexponential:  19%|█▉        | 3856/20176 [00:06<00:25, 628.63it/s]
4-echo monoexponential:  19%|█▉        | 3919/20176 [00:06<00:26, 616.15it/s]
4-echo monoexponential:  20%|█▉        | 3981/20176 [00:06<00:26, 611.81it/s]
4-echo monoexponential:  20%|██        | 4043/20176 [00:06<00:26, 614.01it/s]
4-echo monoexponential:  20%|██        | 4105/20176 [00:06<00:26, 614.15it/s]
4-echo monoexponential:  21%|██        | 4167/20176 [00:06<00:26, 606.59it/s]
4-echo monoexponential:  21%|██        | 4231/20176 [00:06<00:25, 613.86it/s]
4-echo monoexponential:  21%|██▏       | 4297/20176 [00:07<00:25, 626.76it/s]
4-echo monoexponential:  22%|██▏       | 4360/20176 [00:07<00:25, 625.32it/s]
4-echo monoexponential:  22%|██▏       | 4424/20176 [00:07<00:25, 627.23it/s]
4-echo monoexponential:  22%|██▏       | 4489/20176 [00:07<00:24, 632.33it/s]
4-echo monoexponential:  23%|██▎       | 4553/20176 [00:07<00:25, 605.66it/s]
4-echo monoexponential:  23%|██▎       | 4616/20176 [00:07<00:25, 611.67it/s]
4-echo monoexponential:  23%|██▎       | 4678/20176 [00:07<00:25, 598.19it/s]
4-echo monoexponential:  24%|██▎       | 4742/20176 [00:07<00:25, 607.80it/s]
4-echo monoexponential:  24%|██▍       | 4805/20176 [00:07<00:25, 612.07it/s]
4-echo monoexponential:  24%|██▍       | 4867/20176 [00:08<00:24, 614.13it/s]
4-echo monoexponential:  24%|██▍       | 4929/20176 [00:08<00:24, 613.76it/s]
4-echo monoexponential:  25%|██▍       | 4993/20176 [00:08<00:24, 619.99it/s]
4-echo monoexponential:  25%|██▌       | 5059/20176 [00:08<00:23, 631.67it/s]
4-echo monoexponential:  25%|██▌       | 5125/20176 [00:08<00:23, 638.26it/s]
4-echo monoexponential:  26%|██▌       | 5190/20176 [00:08<00:23, 639.84it/s]
4-echo monoexponential:  26%|██▌       | 5255/20176 [00:08<00:23, 641.50it/s]
4-echo monoexponential:  26%|██▋       | 5320/20176 [00:08<00:23, 641.56it/s]
4-echo monoexponential:  27%|██▋       | 5385/20176 [00:08<00:23, 636.36it/s]
4-echo monoexponential:  27%|██▋       | 5449/20176 [00:08<00:24, 610.56it/s]
4-echo monoexponential:  27%|██▋       | 5511/20176 [00:09<00:23, 611.36it/s]
4-echo monoexponential:  28%|██▊       | 5574/20176 [00:09<00:23, 614.32it/s]
4-echo monoexponential:  28%|██▊       | 5636/20176 [00:09<00:23, 610.51it/s]
4-echo monoexponential:  28%|██▊       | 5702/20176 [00:09<00:23, 622.70it/s]
4-echo monoexponential:  29%|██▊       | 5770/20176 [00:09<00:22, 638.67it/s]
4-echo monoexponential:  29%|██▉       | 5834/20176 [00:09<00:22, 635.27it/s]
4-echo monoexponential:  29%|██▉       | 5898/20176 [00:09<00:22, 630.43it/s]
4-echo monoexponential:  30%|██▉       | 5962/20176 [00:09<00:22, 630.16it/s]
4-echo monoexponential:  30%|██▉       | 6026/20176 [00:09<00:22, 623.19it/s]
4-echo monoexponential:  30%|███       | 6091/20176 [00:09<00:22, 629.71it/s]
4-echo monoexponential:  31%|███       | 6155/20176 [00:10<00:22, 628.50it/s]
4-echo monoexponential:  31%|███       | 6218/20176 [00:10<00:23, 601.24it/s]
4-echo monoexponential:  31%|███       | 6279/20176 [00:10<00:23, 599.66it/s]
4-echo monoexponential:  31%|███▏      | 6341/20176 [00:10<00:22, 605.14it/s]
4-echo monoexponential:  32%|███▏      | 6402/20176 [00:10<00:23, 598.15it/s]
4-echo monoexponential:  32%|███▏      | 6468/20176 [00:10<00:22, 612.47it/s]
4-echo monoexponential:  32%|███▏      | 6533/20176 [00:10<00:21, 622.61it/s]
4-echo monoexponential:  33%|███▎      | 6600/20176 [00:10<00:21, 633.68it/s]
4-echo monoexponential:  33%|███▎      | 6664/20176 [00:10<00:21, 631.38it/s]
4-echo monoexponential:  33%|███▎      | 6728/20176 [00:10<00:21, 631.36it/s]
4-echo monoexponential:  34%|███▎      | 6794/20176 [00:11<00:21, 636.78it/s]
4-echo monoexponential:  34%|███▍      | 6858/20176 [00:11<00:21, 632.72it/s]
4-echo monoexponential:  34%|███▍      | 6922/20176 [00:11<00:21, 625.19it/s]
4-echo monoexponential:  35%|███▍      | 6985/20176 [00:11<00:22, 596.25it/s]
4-echo monoexponential:  35%|███▍      | 7047/20176 [00:11<00:21, 602.28it/s]
4-echo monoexponential:  35%|███▌      | 7110/20176 [00:11<00:21, 608.26it/s]
4-echo monoexponential:  36%|███▌      | 7172/20176 [00:11<00:21, 610.68it/s]
4-echo monoexponential:  36%|███▌      | 7234/20176 [00:11<00:21, 613.23it/s]
4-echo monoexponential:  36%|███▌      | 7300/20176 [00:11<00:20, 624.97it/s]
4-echo monoexponential:  37%|███▋      | 7366/20176 [00:12<00:20, 633.26it/s]
4-echo monoexponential:  37%|███▋      | 7430/20176 [00:12<00:20, 632.64it/s]
4-echo monoexponential:  37%|███▋      | 7494/20176 [00:12<00:20, 622.53it/s]
4-echo monoexponential:  37%|███▋      | 7558/20176 [00:12<00:20, 627.56it/s]
4-echo monoexponential:  38%|███▊      | 7622/20176 [00:12<00:19, 630.56it/s]
4-echo monoexponential:  38%|███▊      | 7686/20176 [00:12<00:19, 626.59it/s]
4-echo monoexponential:  38%|███▊      | 7749/20176 [00:12<00:20, 610.52it/s]
4-echo monoexponential:  39%|███▊      | 7811/20176 [00:12<00:20, 605.05it/s]
4-echo monoexponential:  39%|███▉      | 7872/20176 [00:12<00:20, 600.25it/s]
4-echo monoexponential:  39%|███▉      | 7935/20176 [00:12<00:20, 606.94it/s]
4-echo monoexponential:  40%|███▉      | 7996/20176 [00:13<00:20, 605.32it/s]
4-echo monoexponential:  40%|███▉      | 8060/20176 [00:13<00:19, 613.81it/s]
4-echo monoexponential:  40%|████      | 8125/20176 [00:13<00:19, 624.39it/s]
4-echo monoexponential:  41%|████      | 8191/20176 [00:13<00:18, 632.24it/s]
4-echo monoexponential:  41%|████      | 8255/20176 [00:13<00:18, 633.18it/s]
4-echo monoexponential:  41%|████      | 8319/20176 [00:13<00:18, 629.97it/s]
4-echo monoexponential:  42%|████▏     | 8384/20176 [00:13<00:18, 633.79it/s]
4-echo monoexponential:  42%|████▏     | 8448/20176 [00:13<00:18, 629.43it/s]
4-echo monoexponential:  42%|████▏     | 8513/20176 [00:13<00:18, 633.11it/s]
4-echo monoexponential:  43%|████▎     | 8577/20176 [00:13<00:18, 612.68it/s]
4-echo monoexponential:  43%|████▎     | 8639/20176 [00:14<00:19, 597.89it/s]
4-echo monoexponential:  43%|████▎     | 8699/20176 [00:14<00:19, 593.56it/s]
4-echo monoexponential:  43%|████▎     | 8762/20176 [00:14<00:18, 602.59it/s]
4-echo monoexponential:  44%|████▎     | 8826/20176 [00:14<00:18, 610.20it/s]
4-echo monoexponential:  44%|████▍     | 8889/20176 [00:14<00:18, 615.12it/s]
4-echo monoexponential:  44%|████▍     | 8951/20176 [00:14<00:18, 608.09it/s]
4-echo monoexponential:  45%|████▍     | 9017/20176 [00:14<00:17, 621.28it/s]
4-echo monoexponential:  45%|████▌     | 9080/20176 [00:14<00:17, 619.69it/s]
4-echo monoexponential:  45%|████▌     | 9145/20176 [00:14<00:17, 626.77it/s]
4-echo monoexponential:  46%|████▌     | 9212/20176 [00:14<00:17, 637.51it/s]
4-echo monoexponential:  46%|████▌     | 9278/20176 [00:15<00:17, 640.97it/s]
4-echo monoexponential:  46%|████▋     | 9343/20176 [00:15<00:16, 637.32it/s]
4-echo monoexponential:  47%|████▋     | 9407/20176 [00:15<00:17, 620.51it/s]
4-echo monoexponential:  47%|████▋     | 9470/20176 [00:15<00:17, 612.00it/s]
4-echo monoexponential:  47%|████▋     | 9532/20176 [00:15<00:17, 603.65it/s]
4-echo monoexponential:  48%|████▊     | 9594/20176 [00:15<00:17, 606.61it/s]
4-echo monoexponential:  48%|████▊     | 9655/20176 [00:15<00:17, 603.95it/s]
4-echo monoexponential:  48%|████▊     | 9720/20176 [00:15<00:16, 615.92it/s]
4-echo monoexponential:  48%|████▊     | 9782/20176 [00:15<00:16, 616.38it/s]
4-echo monoexponential:  49%|████▉     | 9844/20176 [00:16<00:16, 616.05it/s]
4-echo monoexponential:  49%|████▉     | 9910/20176 [00:16<00:16, 627.74it/s]
4-echo monoexponential:  49%|████▉     | 9977/20176 [00:16<00:15, 638.76it/s]
4-echo monoexponential:  50%|████▉     | 10043/20176 [00:16<00:15, 642.55it/s]
4-echo monoexponential:  50%|█████     | 10108/20176 [00:16<00:15, 633.45it/s]
4-echo monoexponential:  50%|█████     | 10172/20176 [00:16<00:16, 611.61it/s]
4-echo monoexponential:  51%|█████     | 10234/20176 [00:16<00:16, 600.49it/s]
4-echo monoexponential:  51%|█████     | 10297/20176 [00:16<00:16, 606.58it/s]
4-echo monoexponential:  51%|█████▏    | 10359/20176 [00:16<00:16, 610.12it/s]
4-echo monoexponential:  52%|█████▏    | 10421/20176 [00:16<00:15, 609.76it/s]
4-echo monoexponential:  52%|█████▏    | 10487/20176 [00:17<00:15, 623.67it/s]
4-echo monoexponential:  52%|█████▏    | 10552/20176 [00:17<00:15, 628.77it/s]
4-echo monoexponential:  53%|█████▎    | 10615/20176 [00:17<00:15, 628.88it/s]
4-echo monoexponential:  53%|█████▎    | 10678/20176 [00:17<00:15, 621.05it/s]
4-echo monoexponential:  53%|█████▎    | 10743/20176 [00:17<00:15, 628.17it/s]
4-echo monoexponential:  54%|█████▎    | 10806/20176 [00:17<00:14, 626.29it/s]
4-echo monoexponential:  54%|█████▍    | 10869/20176 [00:17<00:14, 626.11it/s]
4-echo monoexponential:  54%|█████▍    | 10932/20176 [00:17<00:14, 625.55it/s]
4-echo monoexponential:  54%|█████▍    | 10995/20176 [00:17<00:15, 606.15it/s]
4-echo monoexponential:  55%|█████▍    | 11056/20176 [00:17<00:15, 596.95it/s]
4-echo monoexponential:  55%|█████▌    | 11118/20176 [00:18<00:15, 600.13it/s]
4-echo monoexponential:  55%|█████▌    | 11179/20176 [00:18<00:14, 602.64it/s]
4-echo monoexponential:  56%|█████▌    | 11250/20176 [00:18<00:14, 633.10it/s]
4-echo monoexponential:  56%|█████▌    | 11314/20176 [00:18<00:14, 629.74it/s]
4-echo monoexponential:  56%|█████▋    | 11378/20176 [00:18<00:13, 631.23it/s]
4-echo monoexponential:  57%|█████▋    | 11442/20176 [00:18<00:13, 625.05it/s]
4-echo monoexponential:  57%|█████▋    | 11508/20176 [00:18<00:13, 633.57it/s]
4-echo monoexponential:  57%|█████▋    | 11573/20176 [00:18<00:13, 638.12it/s]
4-echo monoexponential:  58%|█████▊    | 11638/20176 [00:18<00:13, 640.15it/s]
4-echo monoexponential:  58%|█████▊    | 11703/20176 [00:19<00:13, 640.74it/s]
4-echo monoexponential:  58%|█████▊    | 11768/20176 [00:19<00:14, 587.28it/s]
4-echo monoexponential:  59%|█████▊    | 11828/20176 [00:19<00:14, 585.26it/s]
4-echo monoexponential:  59%|█████▉    | 11890/20176 [00:19<00:13, 593.55it/s]
4-echo monoexponential:  59%|█████▉    | 11952/20176 [00:19<00:13, 600.26it/s]
4-echo monoexponential:  60%|█████▉    | 12016/20176 [00:19<00:13, 609.49it/s]
4-echo monoexponential:  60%|█████▉    | 12078/20176 [00:19<00:13, 605.02it/s]
4-echo monoexponential:  60%|██████    | 12143/20176 [00:19<00:13, 616.12it/s]
4-echo monoexponential:  61%|██████    | 12208/20176 [00:19<00:12, 626.02it/s]
4-echo monoexponential:  61%|██████    | 12275/20176 [00:19<00:12, 637.52it/s]
4-echo monoexponential:  61%|██████    | 12341/20176 [00:20<00:12, 643.21it/s]
4-echo monoexponential:  61%|██████▏   | 12406/20176 [00:20<00:12, 642.31it/s]
4-echo monoexponential:  62%|██████▏   | 12471/20176 [00:20<00:11, 643.64it/s]
4-echo monoexponential:  62%|██████▏   | 12536/20176 [00:20<00:12, 628.50it/s]
4-echo monoexponential:  62%|██████▏   | 12599/20176 [00:20<00:12, 594.66it/s]
4-echo monoexponential:  63%|██████▎   | 12664/20176 [00:20<00:12, 606.92it/s]
4-echo monoexponential:  63%|██████▎   | 12728/20176 [00:20<00:12, 614.26it/s]
4-echo monoexponential:  63%|██████▎   | 12793/20176 [00:20<00:11, 623.00it/s]
4-echo monoexponential:  64%|██████▎   | 12859/20176 [00:20<00:11, 633.37it/s]
4-echo monoexponential:  64%|██████▍   | 12924/20176 [00:20<00:11, 636.41it/s]
4-echo monoexponential:  64%|██████▍   | 12988/20176 [00:21<00:11, 635.06it/s]
4-echo monoexponential:  65%|██████▍   | 13055/20176 [00:21<00:11, 643.98it/s]
4-echo monoexponential:  65%|██████▌   | 13120/20176 [00:21<00:10, 641.54it/s]
4-echo monoexponential:  65%|██████▌   | 13185/20176 [00:21<00:11, 634.01it/s]
4-echo monoexponential:  66%|██████▌   | 13249/20176 [00:21<00:10, 631.56it/s]
4-echo monoexponential:  66%|██████▌   | 13313/20176 [00:21<00:11, 618.45it/s]
4-echo monoexponential:  66%|██████▋   | 13375/20176 [00:21<00:11, 592.58it/s]
4-echo monoexponential:  67%|██████▋   | 13438/20176 [00:21<00:11, 601.10it/s]
4-echo monoexponential:  67%|██████▋   | 13501/20176 [00:21<00:10, 607.34it/s]
4-echo monoexponential:  67%|██████▋   | 13565/20176 [00:22<00:10, 616.70it/s]
4-echo monoexponential:  68%|██████▊   | 13628/20176 [00:22<00:10, 620.42it/s]
4-echo monoexponential:  68%|██████▊   | 13695/20176 [00:22<00:10, 631.65it/s]
4-echo monoexponential:  68%|██████▊   | 13760/20176 [00:22<00:10, 635.48it/s]
4-echo monoexponential:  69%|██████▊   | 13826/20176 [00:22<00:09, 640.19it/s]
4-echo monoexponential:  69%|██████▉   | 13891/20176 [00:22<00:09, 637.97it/s]
4-echo monoexponential:  69%|██████▉   | 13955/20176 [00:22<00:09, 635.61it/s]
4-echo monoexponential:  69%|██████▉   | 14019/20176 [00:22<00:09, 634.78it/s]
4-echo monoexponential:  70%|██████▉   | 14083/20176 [00:22<00:09, 633.13it/s]
4-echo monoexponential:  70%|███████   | 14147/20176 [00:22<00:09, 604.11it/s]
4-echo monoexponential:  70%|███████   | 14208/20176 [00:23<00:09, 600.18it/s]
4-echo monoexponential:  71%|███████   | 14272/20176 [00:23<00:09, 610.62it/s]
4-echo monoexponential:  71%|███████   | 14335/20176 [00:23<00:09, 614.70it/s]
4-echo monoexponential:  71%|███████▏  | 14400/20176 [00:23<00:09, 624.33it/s]
4-echo monoexponential:  72%|███████▏  | 14468/20176 [00:23<00:08, 639.69it/s]
4-echo monoexponential:  72%|███████▏  | 14535/20176 [00:23<00:08, 646.41it/s]
4-echo monoexponential:  72%|███████▏  | 14601/20176 [00:23<00:08, 649.98it/s]
4-echo monoexponential:  73%|███████▎  | 14667/20176 [00:23<00:08, 640.90it/s]
4-echo monoexponential:  73%|███████▎  | 14732/20176 [00:23<00:08, 629.84it/s]
4-echo monoexponential:  73%|███████▎  | 14796/20176 [00:23<00:08, 630.52it/s]
4-echo monoexponential:  74%|███████▎  | 14860/20176 [00:24<00:08, 609.30it/s]
4-echo monoexponential:  74%|███████▍  | 14923/20176 [00:24<00:08, 613.66it/s]
4-echo monoexponential:  74%|███████▍  | 14985/20176 [00:24<00:08, 615.26it/s]
4-echo monoexponential:  75%|███████▍  | 15047/20176 [00:24<00:08, 615.90it/s]
4-echo monoexponential:  75%|███████▍  | 15112/20176 [00:24<00:08, 624.31it/s]
4-echo monoexponential:  75%|███████▌  | 15178/20176 [00:24<00:07, 632.48it/s]
4-echo monoexponential:  76%|███████▌  | 15242/20176 [00:24<00:07, 625.06it/s]
4-echo monoexponential:  76%|███████▌  | 15307/20176 [00:24<00:07, 631.94it/s]
4-echo monoexponential:  76%|███████▌  | 15372/20176 [00:24<00:07, 635.64it/s]
4-echo monoexponential:  77%|███████▋  | 15436/20176 [00:25<00:07, 632.77it/s]
4-echo monoexponential:  77%|███████▋  | 15500/20176 [00:25<00:07, 631.51it/s]
4-echo monoexponential:  77%|███████▋  | 15564/20176 [00:25<00:07, 619.66it/s]
4-echo monoexponential:  77%|███████▋  | 15627/20176 [00:25<00:07, 605.70it/s]
4-echo monoexponential:  78%|███████▊  | 15689/20176 [00:25<00:07, 609.23it/s]
4-echo monoexponential:  78%|███████▊  | 15753/20176 [00:25<00:07, 616.85it/s]
4-echo monoexponential:  78%|███████▊  | 15815/20176 [00:25<00:07, 601.43it/s]
4-echo monoexponential:  79%|███████▊  | 15879/20176 [00:25<00:07, 611.04it/s]
4-echo monoexponential:  79%|███████▉  | 15943/20176 [00:25<00:06, 619.25it/s]
4-echo monoexponential:  79%|███████▉  | 16010/20176 [00:25<00:06, 633.35it/s]
4-echo monoexponential:  80%|███████▉  | 16075/20176 [00:26<00:06, 637.94it/s]
4-echo monoexponential:  80%|███████▉  | 16139/20176 [00:26<00:06, 630.72it/s]
4-echo monoexponential:  80%|████████  | 16203/20176 [00:26<00:06, 628.42it/s]
4-echo monoexponential:  81%|████████  | 16266/20176 [00:26<00:06, 627.16it/s]
4-echo monoexponential:  81%|████████  | 16329/20176 [00:26<00:06, 599.66it/s]
4-echo monoexponential:  81%|████████  | 16391/20176 [00:26<00:06, 603.32it/s]
4-echo monoexponential:  82%|████████▏ | 16452/20176 [00:26<00:06, 599.03it/s]
4-echo monoexponential:  82%|████████▏ | 16513/20176 [00:26<00:06, 595.93it/s]
4-echo monoexponential:  82%|████████▏ | 16576/20176 [00:26<00:05, 604.66it/s]
4-echo monoexponential:  82%|████████▏ | 16640/20176 [00:26<00:05, 611.98it/s]
4-echo monoexponential:  83%|████████▎ | 16707/20176 [00:27<00:05, 627.10it/s]
4-echo monoexponential:  83%|████████▎ | 16774/20176 [00:27<00:05, 638.26it/s]
4-echo monoexponential:  83%|████████▎ | 16838/20176 [00:27<00:05, 632.99it/s]
4-echo monoexponential:  84%|████████▍ | 16902/20176 [00:27<00:05, 626.12it/s]
4-echo monoexponential:  84%|████████▍ | 16965/20176 [00:27<00:05, 622.30it/s]
4-echo monoexponential:  84%|████████▍ | 17028/20176 [00:27<00:05, 586.01it/s]
4-echo monoexponential:  85%|████████▍ | 17092/20176 [00:27<00:05, 599.66it/s]
4-echo monoexponential:  85%|████████▌ | 17153/20176 [00:27<00:05, 596.15it/s]
4-echo monoexponential:  85%|████████▌ | 17213/20176 [00:27<00:05, 589.44it/s]
4-echo monoexponential:  86%|████████▌ | 17275/20176 [00:28<00:04, 596.21it/s]
4-echo monoexponential:  86%|████████▌ | 17337/20176 [00:28<00:04, 602.91it/s]
4-echo monoexponential:  86%|████████▋ | 17403/20176 [00:28<00:04, 617.57it/s]
4-echo monoexponential:  87%|████████▋ | 17466/20176 [00:28<00:04, 620.28it/s]
4-echo monoexponential:  87%|████████▋ | 17529/20176 [00:28<00:04, 614.28it/s]
4-echo monoexponential:  87%|████████▋ | 17592/20176 [00:28<00:04, 616.93it/s]
4-echo monoexponential:  88%|████████▊ | 17654/20176 [00:28<00:04, 581.17it/s]
4-echo monoexponential:  88%|████████▊ | 17716/20176 [00:28<00:04, 591.36it/s]
4-echo monoexponential:  88%|████████▊ | 17776/20176 [00:28<00:04, 586.33it/s]
4-echo monoexponential:  88%|████████▊ | 17838/20176 [00:28<00:03, 593.83it/s]
4-echo monoexponential:  89%|████████▊ | 17899/20176 [00:29<00:03, 597.51it/s]
4-echo monoexponential:  89%|████████▉ | 17964/20176 [00:29<00:03, 612.89it/s]
4-echo monoexponential:  89%|████████▉ | 18032/20176 [00:29<00:03, 631.26it/s]
4-echo monoexponential:  90%|████████▉ | 18096/20176 [00:29<00:03, 627.49it/s]
4-echo monoexponential:  90%|█████████ | 18159/20176 [00:29<00:03, 620.30it/s]
4-echo monoexponential:  90%|█████████ | 18222/20176 [00:29<00:03, 602.64it/s]
4-echo monoexponential:  91%|█████████ | 18283/20176 [00:29<00:03, 586.99it/s]
4-echo monoexponential:  91%|█████████ | 18344/20176 [00:29<00:03, 590.84it/s]
4-echo monoexponential:  91%|█████████ | 18404/20176 [00:29<00:03, 577.99it/s]
4-echo monoexponential:  92%|█████████▏| 18467/20176 [00:29<00:02, 591.43it/s]
4-echo monoexponential:  92%|█████████▏| 18528/20176 [00:30<00:02, 596.77it/s]
4-echo monoexponential:  92%|█████████▏| 18592/20176 [00:30<00:02, 607.11it/s]
4-echo monoexponential:  92%|█████████▏| 18655/20176 [00:30<00:02, 613.15it/s]
4-echo monoexponential:  93%|█████████▎| 18717/20176 [00:30<00:02, 600.76it/s]
4-echo monoexponential:  93%|█████████▎| 18778/20176 [00:30<00:02, 591.91it/s]
4-echo monoexponential:  93%|█████████▎| 18839/20176 [00:30<00:02, 594.62it/s]
4-echo monoexponential:  94%|█████████▎| 18899/20176 [00:30<00:02, 590.68it/s]
4-echo monoexponential:  94%|█████████▍| 18961/20176 [00:30<00:02, 597.88it/s]
4-echo monoexponential:  94%|█████████▍| 19026/20176 [00:30<00:01, 613.15it/s]
4-echo monoexponential:  95%|█████████▍| 19093/20176 [00:31<00:01, 628.16it/s]
4-echo monoexponential:  95%|█████████▍| 19156/20176 [00:31<00:01, 618.72it/s]
4-echo monoexponential:  95%|█████████▌| 19218/20176 [00:31<00:01, 596.63it/s]
4-echo monoexponential:  96%|█████████▌| 19278/20176 [00:31<00:01, 589.18it/s]
4-echo monoexponential:  96%|█████████▌| 19338/20176 [00:31<00:01, 584.52it/s]
4-echo monoexponential:  96%|█████████▌| 19397/20176 [00:31<00:01, 580.12it/s]
4-echo monoexponential:  96%|█████████▋| 19457/20176 [00:31<00:01, 585.03it/s]
4-echo monoexponential:  97%|█████████▋| 19521/20176 [00:31<00:01, 600.70it/s]
4-echo monoexponential:  97%|█████████▋| 19582/20176 [00:31<00:01, 587.30it/s]
4-echo monoexponential:  97%|█████████▋| 19644/20176 [00:31<00:00, 594.51it/s]
4-echo monoexponential:  98%|█████████▊| 19709/20176 [00:32<00:00, 608.82it/s]
4-echo monoexponential:  98%|█████████▊| 19776/20176 [00:32<00:00, 625.02it/s]
4-echo monoexponential:  98%|█████████▊| 19839/20176 [00:32<00:00, 615.94it/s]
4-echo monoexponential:  99%|█████████▊| 19901/20176 [00:32<00:00, 596.54it/s]
4-echo monoexponential:  99%|█████████▉| 19961/20176 [00:32<00:00, 592.69it/s]
4-echo monoexponential:  99%|█████████▉| 20021/20176 [00:32<00:00, 586.73it/s]
4-echo monoexponential: 100%|█████████▉| 20080/20176 [00:32<00:00, 585.89it/s]
4-echo monoexponential: 100%|█████████▉| 20139/20176 [00:32<00:00, 584.17it/s]
4-echo monoexponential: 100%|██████████| 20176/20176 [00:32<00:00, 614.07it/s]
INFO     t2smap:t2smap_workflow:319 Calculating model fit quality metrics
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/tedana/decay.py:541: RuntimeWarning: Mean of empty slice
  rmse_map = np.nanmean(rmse, axis=1)
INFO     t2smap:t2smap_workflow:331 Computing optimal combination
INFO     combine:make_optcom:192 Optimally combining data with voxel-wise T2* estimates
INFO     t2smap:t2smap_workflow:389 Workflow completed
out_files = sorted(glob(os.path.join(out_dir, "*")))
out_files = [os.path.basename(f) for f in out_files]
print("\n".join(out_files))
sub-04570_task-rest_space-scanner_S0map.nii.gz
sub-04570_task-rest_space-scanner_T2starmap.nii.gz
sub-04570_task-rest_space-scanner_dataset_description.json
sub-04570_task-rest_space-scanner_desc-confounds_timeseries.tsv
sub-04570_task-rest_space-scanner_desc-limited_S0map.nii.gz
sub-04570_task-rest_space-scanner_desc-limited_T2starmap.nii.gz
sub-04570_task-rest_space-scanner_desc-optcom_bold.nii.gz
sub-04570_task-rest_space-scanner_desc-rmse_statmap.nii.gz
sub-04570_task-rest_space-scanner_desc-tedana_registry.json
fig, ax = plt.subplots(figsize=(16, 8))
plotting.plot_stat_map(
    os.path.join(out_dir, "sub-04570_task-rest_space-scanner_T2starmap.nii.gz"),
    vmax=0.6,
    draw_cross=False,
    bg_img=None,
    figure=fig,
    axes=ax,
)
glue("figure_t2starmap", fig, display=False)
<Figure size 1600x800 with 5 Axes>

Fig. 20 T2* map estimated from multi-echo data using tedana’s t2smap_workflow().#

fig, ax = plt.subplots(figsize=(16, 8))
plotting.plot_stat_map(
    os.path.join(out_dir, "sub-04570_task-rest_space-scanner_S0map.nii.gz"),
    vmax=8000,
    draw_cross=False,
    bg_img=None,
    figure=fig,
    axes=ax,
)
glue("figure_s0map", fig, display=False)
<Figure size 1600x800 with 5 Axes>

Fig. 21 S0 map estimated from multi-echo data using tedana’s t2smap_workflow().#

fig, axes = plt.subplots(figsize=(16, 15), nrows=5)
plotting.plot_epi(
    image.mean_img(data_files[0]),
    draw_cross=False,
    bg_img=None,
    cut_coords=[-10, 0, 10, 20, 30, 40, 50, 60, 70],
    display_mode="z",
    figure=fig,
    axes=axes[0],
)
plotting.plot_epi(
    image.mean_img(data_files[1]),
    draw_cross=False,
    bg_img=None,
    cut_coords=[-10, 0, 10, 20, 30, 40, 50, 60, 70],
    display_mode="z",
    figure=fig,
    axes=axes[1],
)
plotting.plot_epi(
    image.mean_img(data_files[2]),
    draw_cross=False,
    bg_img=None,
    cut_coords=[-10, 0, 10, 20, 30, 40, 50, 60, 70],
    display_mode="z",
    figure=fig,
    axes=axes[2],
)
plotting.plot_epi(
    image.mean_img(data_files[3]),
    draw_cross=False,
    bg_img=None,
    cut_coords=[-10, 0, 10, 20, 30, 40, 50, 60, 70],
    display_mode="z",
    figure=fig,
    axes=axes[3],
)
plotting.plot_epi(
    image.mean_img(
        os.path.join(
            out_dir, "sub-04570_task-rest_space-scanner_desc-optcom_bold.nii.gz"
        )
    ),
    draw_cross=False,
    bg_img=None,
    cut_coords=[-10, 0, 10, 20, 30, 40, 50, 60, 70],
    display_mode="z",
    figure=fig,
    axes=axes[4],
)
glue("figure_t2smap_epi_plots", fig, display=False)
<Figure size 1600x1500 with 50 Axes>

Fig. 22 Mean map of each of the echoes in the original data, along with the mean map of the optimally combined data.#

te30_tsnr = image.math_img(
    "(np.nanmean(img, axis=3) / np.nanstd(img, axis=3)) * mask",
    img=data_files[1],
    mask=mask_file,
)
oc_tsnr = image.math_img(
    "(np.nanmean(img, axis=3) / np.nanstd(img, axis=3)) * mask",
    img=os.path.join(
        out_dir, "sub-04570_task-rest_space-scanner_desc-optcom_bold.nii.gz"
    ),
    mask=mask_file,
)
vmax = np.nanmax(np.abs(oc_tsnr.get_fdata()))

fig, axes = plt.subplots(figsize=(10, 8), nrows=2)
plotting.plot_stat_map(
    te30_tsnr,
    draw_cross=False,
    bg_img=None,
    threshold=0.1,
    cut_coords=[0, 10, 10],
    vmax=vmax,
    symmetric_cbar=False,
    figure=fig,
    axes=axes[0],
)
axes[0].set_title("TE30 TSNR", fontsize=16)
plotting.plot_stat_map(
    oc_tsnr,
    draw_cross=False,
    bg_img=None,
    threshold=0.1,
    cut_coords=[0, 10, 10],
    vmax=vmax,
    symmetric_cbar=False,
    figure=fig,
    axes=axes[1],
)
axes[1].set_title("Optimal Combination TSNR", fontsize=16)
glue("figure_t2smap_t2snr", fig, display=False)
<string>:1: RuntimeWarning: invalid value encountered in divide
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/nilearn/plotting/img_plotting.py:1317: UserWarning: Non-finite values detected. These values will be replaced with zeros.
  safe_get_data(stat_map_img, ensure_finite=True),
<Figure size 1000x800 with 10 Axes>

Fig. 23 TSNR map of each of the echoes in the original data, along with the TSNR map of the optimally combined data.#

fig, ax = plt.subplots(figsize=(16, 8))
plotting.plot_carpet(
    data_files[1],
    figure=fig,
    axes=ax,
)
glue("figure_echo2_carpet", fig, display=False)
<Figure size 1600x800 with 1 Axes>

Fig. 24 Carpet plot of the second echo’s data.#

fig, ax = plt.subplots(figsize=(16, 8))
plotting.plot_carpet(
    os.path.join(out_dir, "sub-04570_task-rest_space-scanner_desc-optcom_bold.nii.gz"),
    axes=ax,
)
glue("figure_optcom_carpet", fig, display=False)
<Figure size 1600x800 with 1 Axes>

Fig. 25 Carpet plot of the optimally combined data.#