diff --git a/aslprep/cli/run.py b/aslprep/cli/run.py
index feed21fc1..ca6490848 100755
--- a/aslprep/cli/run.py
+++ b/aslprep/cli/run.py
@@ -163,7 +163,7 @@ def get_parser():
g_conf.add_argument('--smooth_kernel', action='store', default=5, type=int,
help='smoothing kernel for M0')
g_conf.add_argument(
- '--dummy-vols', required=False, action='store', default=None, type=int,
+ '--dummy-vols', required=False, action='store', default=0, type=int,
help='Number of first n vol to ingnore.')
# ANTs options
diff --git a/aslprep/data/reports-spec.yml b/aslprep/data/reports-spec.yml
index 99eb83bf2..251d873c1 100644
--- a/aslprep/data/reports-spec.yml
+++ b/aslprep/data/reports-spec.yml
@@ -31,7 +31,7 @@ sections:
reportlets:
- bids: {datatype: asl, desc: summary, suffix: asl}
- bids: {datatype: asl, desc: validation, suffix: asl}
- - bids: {datatype: asl, desc: fieldmap, suffix: asl}
+ - bids: {datatype: asl, desc: fieldmap, suffix: bold}
caption: The estimated fieldmap was aligned to the corresponding ASL reference
with a rigid-registration process of the magintude part of the fieldmap,
using antsRegistration
.
@@ -42,12 +42,12 @@ sections:
orders of magnitude above or below the minimum of blue colors.)
static: false
subtitle: Estimated fieldmap and alignment to the corresponding ASL reference
- - bids: {datatype: asl, desc: sdc, suffix: asl}
+ - bids: {datatype: asl, desc: sdc, suffix: bold}
caption: Results of performing susceptibility distortion correction (SDC) on the
ASL
static: false
subtitle: Susceptibility distortion correction
- - bids: {datatype: asl, desc: forcedsyn, suffix: asl}
+ - bids: {datatype: asl, desc: forcedsyn, suffix: bold}
caption: The dataset contained some fieldmap information, but the argument --force-syn
was used. The higher-priority SDC method was used. Here, we show the results
of performing SyN-based SDC on the EPI for comparison.
diff --git a/aslprep/niworkflows/viz/plots.py b/aslprep/niworkflows/viz/plots.py
index 0b55b015f..4060ffa91 100644
--- a/aslprep/niworkflows/viz/plots.py
+++ b/aslprep/niworkflows/viz/plots.py
@@ -180,7 +180,7 @@ def plot(self, figure=None):
for i, (name, kwargs) in enumerate(self.fd_file.items()):
tseries = kwargs.pop('values')
- confoundplot(
+ confoundplotx(
tseries, grid[grid_id], tr=self.tr, color=palette[i],
name=name, **kwargs)
grid_id += 1
@@ -673,6 +673,141 @@ def confoundplot(tseries, gs_ts, gs_dist=None, name=None,
'lw': 0, 'alpha': 0.8}
)
+ # Annotate percentile 95
+ ax_ts.plot((0, ntsteps - 1), [p95] * 2, linewidth=.1, color='lightgray')
+ ax_ts.annotate(
+ '%.2f' % p95, xy=(0, p95), xytext=(-1, 0),
+ textcoords='offset points', va='center', ha='right',
+ color='lightgray', size=3)
+
+ if cutoff is None:
+ cutoff = []
+
+ for i, thr in enumerate(cutoff):
+ ax_ts.plot((0, ntsteps - 1), [thr] * 2,
+ linewidth=.2, color='dimgray')
+
+ ax_ts.annotate(
+ '%.2f' % thr, xy=(0, thr), xytext=(-1, 0),
+ textcoords='offset points', va='center', ha='right',
+ color='dimgray', size=3)
+
+ ax_ts.plot(tseries, color=color, linewidth=.8)
+ ax_ts.set_xlim((0, ntsteps - 1))
+ #ax_ts.step(range(0,ntsteps),tseries,color=color)
+ #ax_ts.set_xlim((0, ntsteps - 1))
+ if gs_dist is not None:
+ ax_dist = plt.subplot(gs_dist)
+ sns.displot(tseries, vertical=True, ax=ax_dist)
+ ax_dist.set_xlabel('Timesteps')
+ ax_dist.set_ylim(ax_ts.get_ylim())
+ ax_dist.set_yticklabels([])
+
+ return [ax_ts, ax_dist], gs
+ return ax_ts, gs
+
+def confoundplotx(tseries, gs_ts, gs_dist=None, name=None,
+ units=None, tr=None, hide_x=True, color='b', nskip=0,
+ cutoff=None, ylims=None):
+
+ # Define TR and number of frames
+ notr = False
+ if tr is None:
+ notr = True
+ tr = 1.
+ ntsteps = len(tseries)
+ tseries = np.array(tseries)
+
+ # Define nested GridSpec
+ gs = mgs.GridSpecFromSubplotSpec(1, 2, subplot_spec=gs_ts,
+ width_ratios=[1, 100], wspace=0.0)
+
+ ax_ts = plt.subplot(gs[1])
+ ax_ts.grid(False)
+
+ # Set 10 frame markers in X axis
+ interval = max((ntsteps // 10, ntsteps // 5, 1))
+ xticks = list(range(0, ntsteps)[::interval])
+ ax_ts.set_xticks(xticks)
+
+ if not hide_x:
+ if notr:
+ ax_ts.set_xlabel('time (frame #)')
+ else:
+ ax_ts.set_xlabel('time (s)')
+ labels = tr * np.array(xticks)
+ ax_ts.set_xticklabels(['%.02f' % t for t in labels.tolist()])
+ else:
+ ax_ts.set_xticklabels([])
+
+ if name is not None:
+ if units is not None:
+ name += ' [%s]' % units
+
+ ax_ts.annotate(
+ name, xy=(0.0, 0.7), xytext=(0, 0), xycoords='axes fraction',
+ textcoords='offset points', va='center', ha='left',
+ color=color, size=8,
+ bbox={'boxstyle': 'round', 'fc': 'w', 'ec': 'none',
+ 'color': 'none', 'lw': 0, 'alpha': 0.8})
+
+ for side in ["top", "right"]:
+ ax_ts.spines[side].set_color('none')
+ ax_ts.spines[side].set_visible(False)
+
+ if not hide_x:
+ ax_ts.spines["bottom"].set_position(('outward', 20))
+ ax_ts.xaxis.set_ticks_position('bottom')
+ else:
+ ax_ts.spines["bottom"].set_color('none')
+ ax_ts.spines["bottom"].set_visible(False)
+
+ # ax_ts.spines["left"].set_position(('outward', 30))
+ ax_ts.spines["left"].set_color('none')
+ ax_ts.spines["left"].set_visible(False)
+ # ax_ts.yaxis.set_ticks_position('left')
+
+ ax_ts.set_yticks([])
+ ax_ts.set_yticklabels([])
+
+ nonnan = tseries[~np.isnan(tseries)]
+ if nonnan.size > 0:
+ # Calculate Y limits
+ valrange = (nonnan.max() - nonnan.min())
+ def_ylims = [nonnan.min() - 0.1 * valrange, nonnan.max() + 0.1 * valrange]
+ if ylims is not None:
+ if ylims[0] is not None:
+ def_ylims[0] = min([def_ylims[0], ylims[0]])
+ if ylims[1] is not None:
+ def_ylims[1] = max([def_ylims[1], ylims[1]])
+
+ # Add space for plot title and mean/SD annotation
+ def_ylims[0] -= 0.1 * (def_ylims[1] - def_ylims[0])
+
+ ax_ts.set_ylim(def_ylims)
+
+ # Annotate stats
+ maxv = nonnan.max()
+ mean = nonnan.mean()
+ stdv = nonnan.std()
+ p95 = np.percentile(nonnan, 95.0)
+ else:
+ maxv = 0
+ mean = 0
+ stdv = 0
+ p95 = 0
+
+ stats_label = (r'max: {max:.3f}{units} $\bullet$ mean: {mean:.3f}{units} '
+ r'$\bullet$ $\sigma$: {sigma:.3f}').format(
+ max=maxv, mean=mean, units=units or '', sigma=stdv)
+ ax_ts.annotate(
+ stats_label, xy=(0.98, 0.7), xycoords='axes fraction',
+ xytext=(0, 0), textcoords='offset points',
+ va='center', ha='right', color=color, size=4,
+ bbox={'boxstyle': 'round', 'fc': 'w', 'ec': 'none', 'color': 'none',
+ 'lw': 0, 'alpha': 0.8}
+ )
+
# Annotate percentile 95
ax_ts.plot((0, ntsteps - 1), [p95] * 2, linewidth=.1, color='lightgray')
ax_ts.annotate(
@@ -707,6 +842,7 @@ def confoundplot(tseries, gs_ts, gs_dist=None, name=None,
return ax_ts, gs
+
def compcor_variance_plot(metadata_files, metadata_sources=None,
output_file=None, varexp_thresh=(0.5, 0.7, 0.9),
fig=None):
diff --git a/aslprep/pybids/external/__pycache__/__init__.cpython-37.pyc b/aslprep/pybids/external/__pycache__/__init__.cpython-37.pyc
deleted file mode 100644
index 75a0fc9b4..000000000
Binary files a/aslprep/pybids/external/__pycache__/__init__.cpython-37.pyc and /dev/null differ
diff --git a/aslprep/pybids/external/__pycache__/inflect.cpython-37.pyc b/aslprep/pybids/external/__pycache__/inflect.cpython-37.pyc
deleted file mode 100644
index 252dc31f4..000000000
Binary files a/aslprep/pybids/external/__pycache__/inflect.cpython-37.pyc and /dev/null differ
diff --git a/docs/conf.py b/docs/conf.py
index 33204a68a..02b4fceb4 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -19,12 +19,12 @@
from packaging import version as pver # Avoid distutils.LooseVersion which is deprecated
import sphinx
+
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath("sphinxext"))
sys.path.insert(0, os.path.abspath("../wrapper"))
-sys.path.append(os.path.abspath('../..'))
from github_link import make_linkcode_resolve
@@ -54,6 +54,7 @@
"numpy",
"nitime",
"matplotlib",
+ "aslprep"
]
if pver.parse(sphinxversion) >= pver.parse("1.7.0"):
@@ -61,6 +62,7 @@
"pandas",
"nilearn",
"seaborn",
+ "aslprep"
]
# Add any paths that contain templates here, relative to this directory.
diff --git a/docs/index.rst b/docs/index.rst
index f2d33000b..68e5cc5bd 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,4 +1,4 @@
-.. fmriprep documentation master file, created by
+.. aslprep documentation master file, created by
sphinx-quickstart on Mon May 9 09:04:25 2016.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
@@ -11,6 +11,9 @@
Contents
--------
+.. automodule:: aslprep
+ :members:
+
.. toctree::
:maxdepth: 3