import warnings

warnings.filterwarnings("ignore")
from fmriprep_denoise.dataset.atlas import ATLAS_METADATA
from fmriprep_denoise.visualization import figures, utils

import ipywidgets as widgets
from ipywidgets import interactive, interact


path_root = utils.repo2data_path() / "denoise-metrics"
---- repo2data starting ----
/srv/conda/envs/notebook/lib/python3.8/site-packages/repo2data
Config from file :
/home/jovyan/binder/data_requirement.json
Destination:
../../data/fmriprep-denoise-benchmark

Info : ../../data/fmriprep-denoise-benchmark already downloaded

Results: atlas level#

Important

The dropdown menu only works in interactive mode! Please launch binder to see the alterative results.

It is possible to view the data at atlas level!

In the report we used four atlases, three of them came with multiple parcellation schemes.

Before we start: Loss of temporal degrees of freedom#

As any denoising strategy aims at a particular trade-off between the amount of noise removed and the preservation of degrees of freedom for signals, first and foremost, we would like to presentthe loss of temporal degrees of freedom.

This is an important consideration accompanying the remaining metrics.

from fmriprep_denoise.visualization import degrees_of_freedom_loss


def notebook_plot_loss_degrees_of_freedom(criteria_name, fmriprep_version):
    datasets = ["ds000228", "ds000030"]
    data = degrees_of_freedom_loss.load_data(
        path_root, datasets, criteria_name, fmriprep_version
    )
    degrees_of_freedom_loss.plot_stats(data)


criteria_name = widgets.Dropdown(
    options=["stringent", "minimal", None],
    value="stringent",
    description="Threshould: ",
    disabled=False,
)
fmriprep_version = widgets.Dropdown(
    options=["fmriprep-20.2.1lts", "fmriprep-20.2.5lts"],
    value="fmriprep-20.2.1lts",
    description="Preporcessing version : ",
    disabled=False,
)

interactive(
    notebook_plot_loss_degrees_of_freedom,
    criteria_name=criteria_name,
    fmriprep_version=fmriprep_version,
)
../_images/results-atlas_2_1.png

Each parcellation scheme#

We can also plot them by each parcellation schemes.

This is the original way Ciric and colleagues [Ciric et al., 2017] presented their results!

Gordon atlas#

atlas = "gordon333"

dataset = widgets.Dropdown(
    options=["ds000228", "ds000030"], description="Dataset : ", disabled=False
)
fmriprep_version = widgets.Dropdown(
    options=["fmriprep-20.2.1lts", "fmriprep-20.2.5lts"],
    description="fmriprep : ",
    disabled=False,
)
dimension = widgets.Dropdown(
    description="dimensions : ",
    options=ATLAS_METADATA[atlas]["dimensions"],
    disabled=False,
)

@interact(ds=dataset, f=fmriprep_version, d=dimension)
def show_atlas(ds, f, d):
    print(ds, f, ATLAS_METADATA[atlas]["atlas"], "dimensions: ", d)
    figures.plot_motion_resid(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_distance_dependence(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_network_modularity(ds, f, path_root, atlas_name=atlas, dimension=d)
../_images/results-atlas_4_1.png ../_images/results-atlas_4_2.png ../_images/results-atlas_4_3.png

MIST#

If selecting None for dimension, the figure will summmarise the metrics by the atlas collection.

Important

The summary statistics are computed on the fly, it might take a bit of time, especially when displaying summary of the atlas collection.

atlas = "mist"

dataset = widgets.Dropdown(
    options=["ds000228", "ds000030"], description="Dataset : ", disabled=False
)
fmriprep_version = widgets.Dropdown(
    options=["fmriprep-20.2.1lts", "fmriprep-20.2.5lts"],
    description="fmriprep : ",
    disabled=False,
)
dimension = widgets.Dropdown(
    description="dimensions : ",
    options=ATLAS_METADATA[atlas]["dimensions"] + [None],
    disabled=False,
)

@interact(ds=dataset, f=fmriprep_version, d=dimension)
def show_atlas(ds, f, d):
    print(ds, f, ATLAS_METADATA[atlas]["atlas"], "dimensions: ", d)
    figures.plot_motion_resid(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_distance_dependence(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_network_modularity(ds, f, path_root, atlas_name=atlas, dimension=d)
../_images/results-atlas_6_1.png ../_images/results-atlas_6_2.png ../_images/results-atlas_6_3.png

Schaefer 7 network#

If selecting None for dimension, the figure will summmarise the metrics by the atlas collection.

Important

The summary statistics are computed on the fly, it might take a bit of time, especially when displaying summary of the atlas collection.

atlas = "schaefer7networks"

dataset = widgets.Dropdown(
    options=["ds000228", "ds000030"], description="Dataset : ", disabled=False
)
fmriprep_version = widgets.Dropdown(
    options=["fmriprep-20.2.1lts", "fmriprep-20.2.5lts"],
    description="fmriprep : ",
    disabled=False,
)
dimension = widgets.Dropdown(
    description="dimensions : ",
    options=ATLAS_METADATA[atlas]["dimensions"] + [None],
    disabled=False,
)

@interact(ds=dataset, f=fmriprep_version, d=dimension)
def show_atlas(ds, f, d):
    print(ds, f, ATLAS_METADATA[atlas]["atlas"], "dimensions: ", d)
    figures.plot_motion_resid(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_distance_dependence(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_network_modularity(ds, f, path_root, atlas_name=atlas, dimension=d)
../_images/results-atlas_8_1.png ../_images/results-atlas_8_2.png ../_images/results-atlas_8_3.png

DiFuMo#

If selecting None for dimension, the figure will summmarise the metrics by the atlas collection.

Important

The summary statistics are computed on the fly, it might take a bit of time, especially when displaying summary of the atlas collection.

atlas = "difumo"

dataset = widgets.Dropdown(
    options=["ds000228", "ds000030"], description="Dataset : ", disabled=False
)
fmriprep_version = widgets.Dropdown(
    options=["fmriprep-20.2.1lts", "fmriprep-20.2.5lts"],
    description="fmriprep : ",
    disabled=False,
)
dimension = widgets.Dropdown(
    description="dimensions : ",
    options=ATLAS_METADATA[atlas]["dimensions"] + [None],
    disabled=False,
)

@interact(ds=dataset, f=fmriprep_version, d=dimension)
def show_atlas(ds, f, d):
    print(ds, f, ATLAS_METADATA[atlas]["atlas"], "dimensions: ", d)
    figures.plot_motion_resid(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_distance_dependence(ds, f, path_root, atlas_name=atlas, dimension=d)
    figures.plot_network_modularity(ds, f, path_root, atlas_name=atlas, dimension=d)
../_images/results-atlas_10_1.png ../_images/results-atlas_10_2.png ../_images/results-atlas_10_3.png