Skip to content

Commit 8d3535d

Browse files
authored
Work on warp and parcellation workflows (#9)
1 parent bf921ee commit 8d3535d

File tree

11 files changed

+586
-362
lines changed

11 files changed

+586
-362
lines changed

docs/api.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ Workflows
3535
---------
3636

3737
.. automodule:: smripost_linc.workflows.base
38-
.. automodule:: smripost_linc.workflows.aroma
38+
.. automodule:: smripost_linc.workflows.freesurfer
39+
.. automodule:: smripost_linc.workflows.parcellation
40+
.. automodule:: smripost_linc.workflows.outputs

docs/conf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
# All configuration values have a default; values that are commented out
1111
# serve to show the default.
1212

13+
# Notes on sMRIPost-LINC-specific style:
14+
# 1. For rst headings, we use the following convention, based on
15+
# https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections:
16+
# # with overline, for parts
17+
# * with overline, for chapters
18+
# = for sections
19+
# - for subsections
20+
# ^ for subsubsections
21+
# " for paragraphs
22+
1323
import os
1424
import sys
1525

docs/outputs.rst

Lines changed: 77 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
.. _outputs:
44

5-
---------------------------
5+
##########################
66
Outputs of *sMRIPost-LINC*
7-
---------------------------
7+
##########################
88

99
*sMRIPost-LINC* outputs conform to the :abbr:`BIDS (brain imaging data structure)`
1010
Derivatives specification (see `BIDS Derivatives`_, along with the
@@ -16,19 +16,20 @@ upcoming `BEP 011`_ and `BEP 012`_).
1616
that allows the user a thorough visual assessment of the quality
1717
of processing and ensures the transparency of *sMRIPost-LINC* operation.
1818

19-
2. **ICA outputs**:
20-
Outputs from the independent component analysis (ICA).
21-
For example, the mixing matrix and component weight maps.
19+
2. **Atlases**:
20+
Atlases selected by the user are warped to fsaverage space and converted to
21+
Freesurfer ``.annot`` format.
2222

23-
3. **Derivatives (denoised data)**:
24-
Denoised fMRI data in the requested output spaces and resolutions.
23+
3. **Parcellated structural measures**:
24+
Anatomical measures are summarized by region of interest (ROI) from each of the atlases.
2525

2626
4. **Confounds**:
27-
Time series of ICA components classified as noise.
27+
Some confound values, including Euler numbers, are saved in a TSV file.
2828

2929

30+
******
3031
Layout
31-
------
32+
******
3233

3334
Assuming sMRIPost-LINC is invoked with::
3435

@@ -38,6 +39,7 @@ The outputs will be a `BIDS Derivatives`_ dataset of the form::
3839

3940
<output_dir>/
4041
logs/
42+
atlases/
4143
sub-<label>/
4244
sub-<label>.html
4345
dataset_description.json
@@ -51,85 +53,78 @@ The log directory contains `citation boilerplate`_ text.
5153
records metadata recommended by the BIDS standard.
5254

5355

56+
**************
5457
Visual Reports
55-
--------------
58+
**************
5659

5760
*sMRIPost-LINC* outputs summary reports,
5861
written to ``<output dir>/smripost_linc/sub-<label>.html``.
5962
These reports provide a quick way to make visual inspection of the results easy.
6063

6164

62-
Derivatives of *sMRIPost-LINC* (denoised data)
63-
-----------------------------------------------
64-
65-
Derivative data are written to
66-
``<output dir>/sub-<label>/``.
67-
The `BIDS Derivatives`_ specification describes the naming and metadata conventions we follow.
68-
69-
70-
ICA derivatives
71-
~~~~~~~~~~~~~~~
72-
73-
ICA outputs are stored in the ``func/`` subfolder::
74-
75-
sub-<label>/
76-
func/
77-
sub-<label>_space-MNI152NLin6Asym_res-2_desc-melodic_mixing.tsv
78-
sub-<label>_space-MNI152NLin6Asym_res-2_desc-melodic_mixing.json
79-
sub-<label>_space-MNI152NLin6Asym_res-2_desc-melodic_components.nii.gz
80-
sub-<label>_space-MNI152NLin6Asym_res-2_desc-melodic_components.json
81-
82-
83-
Functional derivatives
84-
~~~~~~~~~~~~~~~~~~~~~~
85-
86-
Functional derivatives are stored in the ``func/`` subfolder.
87-
All derivatives contain ``task-<task_label>`` (mandatory) and ``run-<run_index>`` (optional), and
88-
these will be indicated with ``[specifiers]``::
89-
90-
sub-<label>/
91-
func/
92-
sub-<label>_[specifiers]_space-MNI152NLin6Asym_res-2_desc-aggrDenoised_bold.nii.gz
93-
sub-<label>_[specifiers]_space-MNI152NLin6Asym_res-2_desc-nonaggrDenoised_bold.nii.gz
94-
sub-<label>_[specifiers]_space-MNI152NLin6Asym_res-2_desc-orthaggrDenoised_bold.nii.gz
95-
96-
**Regularly gridded outputs (images)**.
97-
Volumetric output spaces labels (``<label>`` above, and in the following) include
98-
``MNI152NLin6Asym`` (default).
99-
100-
**Extracted confounding time series**.
101-
For each :abbr:`BOLD (blood-oxygen level dependent)` run processed with *sMRIPost-LINC*,
102-
an accompanying *confounds* file will be generated.
103-
Confounds_ are saved as a :abbr:`TSV (tab-separated value)` file::
104-
105-
sub-<label>/
106-
func/
107-
sub-<label>_[specifiers]_desc-aroma_metrics.tsv
108-
sub-<label>_[specifiers]_desc-aroma_metrics.json
109-
sub-<label>_[specifiers]_desc-aroma_timeseries.tsv
110-
sub-<label>_[specifiers]_desc-aroma_timeseries.json
111-
65+
*************************
66+
Parcellations and Atlases
67+
*************************
68+
69+
*XCP-D* produces parcellated anatomical and functional outputs using a series of atlases.
70+
The individual outputs are documented in the relevant sections of this document,
71+
with this section describing the atlases themselves.
72+
73+
The atlases currently used in *XCP-D* can be separated into three groups: subcortical, cortical,
74+
and combined cortical/subcortical.
75+
The two subcortical atlases are the Tian atlas :footcite:p:`tian2020topographic` and the
76+
CIFTI subcortical parcellation :footcite:p:`glasser2013minimal`.
77+
The cortical atlases are the Glasser :footcite:p:`Glasser_2016`, the
78+
Gordon :footcite:p:`Gordon_2014`,
79+
the MIDB precision brain atlas derived from ABCD data and thresholded at 75% probability
80+
:footcite:p:`hermosillo2022precision`,
81+
and the Myers-Labonte infant atlas thresholded at 50% probability :footcite:`myers2023functional`.
82+
The combined cortical/subcortical atlases are 10 different resolutions of the
83+
4S (Schaefer Supplemented with Subcortical Structures) atlas.
84+
85+
The 4S atlas combines the Schaefer 2018 cortical atlas (version v0143) :footcite:p:`Schaefer_2017`
86+
at 10 different resolutions (100, 200, 300, 400, 500, 600, 700, 800, 900, and 1000 parcels) with
87+
the CIT168 subcortical atlas :footcite:p:`pauli2018high`,
88+
the Diedrichson cerebellar atlas :footcite:p:`king2019functional`,
89+
the HCP thalamic atlas :footcite:p:`najdenovska2018vivo`,
90+
and the amygdala and hippocampus parcels from the HCP CIFTI subcortical parcellation
91+
:footcite:p:`glasser2013minimal`.
92+
The 4S atlas is used in the same manner across three PennLINC BIDS Apps:
93+
*XCP-D*, QSIPrep_, and ASLPrep_, to produce synchronized outputs across modalities.
94+
For more information about the 4S atlas, please see https://github.com/PennLINC/AtlasPack.
95+
96+
.. tip::
97+
98+
You can choose to only use a subset of the available atlases by using the ``--atlases``
99+
parameter.
100+
101+
fsaverage-space atlases are written out to the ``atlases`` subfolder, following BEP038.
102+
fsnative-space atlases are written out to the subject directory.
103+
104+
.. code-block::
105+
106+
<output_dir>/
107+
atlases/
108+
dataset_description.json
109+
atlas-<label>/
110+
atlas-<label>_hemi-<L|R>_space-fsaverage_dseg.annot
111+
atlas-<label>_dseg.json
112+
atlas-<label>_dseg.tsv
113+
sub-<label>/[ses-<label>/]
114+
anat/
115+
sub-<label>[_ses-<label>]_hemi-<L|R>_space-fsnative_seg-<atlas>_dseg.annot
116+
sub-<label>[_ses-<label>]_hemi-<L|R>_space-fsnative_seg-<atlas>_dseg.json
117+
118+
119+
*******************************
120+
Parcellated Structural Measures
121+
*******************************
122+
123+
*sMRIPost-LINC* outputs a set of parcellated structural measures.
124+
125+
126+
*********
112127
Confounds
113-
---------
114-
115-
*sMRIPost-LINC* outputs a set of confounds that can be used to denoise the data.
116-
These are stored in a TSV file (``desc-aroma_timeseries.tsv``) and a JSON file
117-
(``desc-aroma_timeseries.json``) that contains metadata about the confounds.
118-
119-
The confounds generated by *sMRIPost-LINC* are ICA component time series
120-
classified as "rejected" by ICA-AROMA.
121-
122-
Columns starting with ``aroma_motion_`` are the raw noise ICA component time series.
123-
Columns starting with ``aroma_orth_motion_`` are the noise ICA component time series,
124-
after z-scoring and orthogonalization with respect to the signal ICA component time series.
125-
126-
Confounds and "carpet"-plot on the visual reports
127-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128-
129-
The visual reports provide several sections per task and run to aid designing
130-
a denoising strategy for subsequent analysis.
131-
Some of the estimated confounds are plotted with a "carpet" visualization of the
132-
:abbr:`BOLD (blood-oxygen level-dependent)` time series [Power2016]_.
133-
An example of these plots follows:
128+
*********
134129

135-
See implementation on :mod:`~smripost_linc.workflows.bold.confounds.init_bold_confs_wf`.
130+
*sMRIPost-LINC* outputs a set of confounds that can be used to summarize data quality.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ classifiers = [
2020
dependencies = [
2121
"neuromaps",
2222
"nipype >= 1.8.5",
23-
"nireports @ git+https://github.com/pennlinc/nireports.git@main",
23+
"nireports",
2424
"nitransforms == 24.1.0",
25-
"niworkflows @ git+https://github.com/pennlinc/niworkflows.git@master",
25+
"niworkflows",
2626
"pybids >= 0.15.6",
27-
"smriprep @ git+https://github.com/pennlinc/smriprep.git@master",
27+
"smriprep",
2828
"typer",
2929
]
3030
dynamic = ["version"]

src/smripost_linc/cli/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# https://www.pennlinc.org/community/licensing/
2222
#
23-
"""fMRI preprocessing workflow."""
23+
"""sMRI postprocessing workflow."""
2424

2525
from smripost_linc import config
2626

src/smripost_linc/data/io_spec.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,24 @@
8383
"desc": null,
8484
"suffix": "xfm",
8585
"extension": ".h5"
86+
},
87+
"lh_fsnative2fsaverage": {
88+
"datatype": "anat",
89+
"run": null,
90+
"hemi": "L",
91+
"space": "fsaverage",
92+
"desc": "reg",
93+
"suffix": "sphere",
94+
"extension": ".surf.gii"
95+
},
96+
"rh_fsnative2fsaverage": {
97+
"datatype": "anat",
98+
"run": null,
99+
"hemi": "R",
100+
"space": "fsaverage",
101+
"desc": "reg",
102+
"suffix": "sphere",
103+
"extension": ".surf.gii"
86104
}
87105
}
88106
},
@@ -112,6 +130,7 @@
112130
"default_path_patterns": [
113131
"atlases/atlas-{atlas}/atlas-{atlas}[_space-{space}][_cohort-{cohort}][_res-{res}][_desc-{desc}]_{suffix<dseg>}{extension<.nii|.nii.gz|.tsv|.json>|.nii.gz}",
114132
"atlases/atlas-{atlas}/atlas-{atlas}[_space-{space}][_cohort-{cohort}][_den-{den}][_desc-{desc}]_{suffix<dseg>}{extension<.dlabel.nii|.tsv|.json>|.dlabel.nii}",
133+
"atlases/atlas-{atlas}/atlas-{atlas}_hemi-{hemi<L|R>}[_space-{space}][_cohort-{cohort}][_den-{den}][_desc-{desc}]_{suffix<dseg>}{extension<.annot|.tsv|.json>|.annot}",
115134
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_seg-{segmentation}][_res-{res}][_desc-{desc}]_{suffix<T1w|T2w|T1map|T2map>}{extension<.nii|.nii.gz|.json>|.nii.gz}",
116135
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_from-{from}_to-{to}_mode-{mode<image|points>|image}_{suffix<xfm>|xfm}{extension<.txt|.h5>}",
117136
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_hemi-{hemi<L|R>}[_space-{space}][_cohort-{cohort}][_seg-{segmentation}][_den-{den}][_desc-{desc}]_{suffix<white|pial|midthickness|inflated|vinflated|sphere|flat>}{extension<.surf.gii|.json>|.surf.gii}",

0 commit comments

Comments
 (0)