Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
8533f52
Add integration testing and github actions
mnoergaard Jun 4, 2025
a2c99a9
FIX: upgrade actions version
mnoergaard Jun 4, 2025
4ddc87a
FIX: add git ignore
mnoergaard Jun 4, 2025
df957ff
FIX: Update test_fsl6.py to use packaging.version.Version
mnoergaard Jun 4, 2025
ebf748d
ENH: replace fmriprep imports with petprep (testing)
mnoergaard Jun 4, 2025
2b463e3
FIX: update coverage.yml
mnoergaard Jun 4, 2025
5ff490c
FIX: Update out_dir path in test_bids
mnoergaard Jun 4, 2025
9edf34c
FIX: Update tests for PET reference files
mnoergaard Jun 4, 2025
8d604e8
FIX: Fix ImportError in test_reports.py
mnoergaard Jun 4, 2025
e31b836
FIX: update env.yml to be in line with fmriprep
mnoergaard Jun 4, 2025
acaacc2
FIX: minor changes from fmriprep to petprep
mnoergaard Jun 4, 2025
3850edb
ENH: add circleci config
mnoergaard Jun 4, 2025
ce25a9b
FIX: remove slice timing and sdc flows test from test_parser
mnoergaard Jun 4, 2025
8bdc9aa
ENH: add PET test data to ds000005
mnoergaard Jun 4, 2025
daf19ce
FIX: add import json
mnoergaard Jun 4, 2025
ff2a43c
FIX: Edit test_base.py to define freesurfer variable
mnoergaard Jun 4, 2025
a4145e7
ENH: add PET report outputs
mnoergaard Jun 4, 2025
f02d34f
FIX: Update report test to match petprep files
mnoergaard Jun 4, 2025
8c6add0
FIX: report test
mnoergaard Jun 4, 2025
19a3e84
FIX: remove cli integration test
mnoergaard Jun 4, 2025
2aa025b
Update NOTICE
mnoergaard Jun 4, 2025
9d115f7
FIX: update subject ID
mnoergaard Jun 4, 2025
2c8e0d8
FIX: Fix test_baseline_found_as_str assertion error
mnoergaard Jun 4, 2025
a67e99a
FIX: update test derivative cache
mnoergaard Jun 4, 2025
fa238a4
FIX: update test to match filename
mnoergaard Jun 4, 2025
f7f8fdc
FIX: remove desc entity
mnoergaard Jun 4, 2025
f231951
FIX: add pet suffix to io_spec.json
mnoergaard Jun 4, 2025
846efcb
Update test_derivative_cache.py
mnoergaard Jun 4, 2025
9046e47
FIX: update collect derivatives
mnoergaard Jun 4, 2025
78383a2
FIX: update collect derivatives
mnoergaard Jun 4, 2025
77f796c
FIX: modify collect derivatives to grab PET files
mnoergaard Jun 4, 2025
c84f313
FIX: get layout and add nipreps.json to data dir
mnoergaard Jun 4, 2025
83ae00e
fix estimate_pet_mem_usage
mnoergaard Jun 4, 2025
5342188
FIX: handle a single filename
mnoergaard Jun 4, 2025
cdc0de1
FIX: update base workflow to distinguish between pet_series and pet_file
mnoergaard Jun 5, 2025
210806a
FIX: update fit to match pet_series and pet_file
mnoergaard Jun 5, 2025
3ae5399
FIX: allow parsing of metadata to apply
mnoergaard Jun 5, 2025
e4a33a9
FIX: remove metadata parsing in init_pet_volumetric_resample_wf
mnoergaard Jun 5, 2025
4e5be1b
Update test_base.py
mnoergaard Jun 5, 2025
4758d05
FIX: update import in resampling to be petprep
mnoergaard Jun 5, 2025
32023b2
FIX: update test_fit to match pet_series
mnoergaard Jun 5, 2025
f183be7
FIX: fix typo
mnoergaard Jun 5, 2025
88a3699
FIX: update mask test
mnoergaard Jun 5, 2025
ee573a4
FIX: add pytest and Path to mask test
mnoergaard Jun 5, 2025
980cec1
FIX: change threshold for n pet_series volumes
mnoergaard Jun 5, 2025
bd00e6d
FIX: update data in mask test
mnoergaard Jun 5, 2025
570330a
FIX: update mask test
mnoergaard Jun 5, 2025
a6fa7bc
FIX: update test_base with fmriprep to petprep
mnoergaard Jun 5, 2025
e1dcb77
FIX: update base test to match PET data
mnoergaard Jun 5, 2025
cf72706
FIX: SDC related stuff
mnoergaard Jun 5, 2025
8dd3360
FIX: add PET query to base
mnoergaard Jun 5, 2025
da5db44
FIX: update query to grab PET data
mnoergaard Jun 5, 2025
0ce3bbe
FIX: add PET json example
mnoergaard Jun 5, 2025
4d89a6e
FIX: update test_base to collect PET data
mnoergaard Jun 5, 2025
a537259
FIX: update collect_data import
mnoergaard Jun 5, 2025
f7a26fa
FIX: bump niworkflows and pybids versions
mnoergaard Jun 5, 2025
ac5d4f1
FIX: bump version and niworkflows version
mnoergaard Jun 5, 2025
e756609
FIX: update base and test
mnoergaard Jun 5, 2025
7554e2b
FIX: update test_base
mnoergaard Jun 5, 2025
df86069
FIX: import niworkflows
mnoergaard Jun 5, 2025
91a29a2
FIX: update collect_data part
mnoergaard Jun 5, 2025
ac33720
Update test_base.py
mnoergaard Jun 5, 2025
b180c6e
FIX: remove collect_data part from test
mnoergaard Jun 5, 2025
16ec28a
Update test_base.py
mnoergaard Jun 5, 2025
3da085e
FIX: listify pet_series
mnoergaard Jun 5, 2025
ae8d4c5
FIX: update fmriprep naming to petprep in resampling
mnoergaard Jun 5, 2025
486a742
FIX: remove TR related parts from workflows
mnoergaard Jun 5, 2025
4538b2a
FIX: Fix InvalidVersion error in test_fsl6.py
mnoergaard Jun 5, 2025
b62148c
FIX: _version.py added to .gitignore
mnoergaard Jun 5, 2025
fda7543
FIX: apply suggestions from code review
mnoergaard Jun 5, 2025
d194eaf
FIX: Delete _slice_time_ref from parser.py
mnoergaard Jun 5, 2025
03aaa03
FIX: removed slice timing from outputs
mnoergaard Jun 5, 2025
8a29386
FIX: Remove slice-timing correction references from documentation
mnoergaard Jun 5, 2025
a7b6de9
FIX: remove config from test_fit
mnoergaard Jun 5, 2025
3de19fa
FIX: [doctest] petprep.interfaces.workbench.MetricFillHoles
mnoergaard Jun 5, 2025
6d15a80
FIX: remove coverage.yml
mnoergaard Jun 6, 2025
3cdd5e0
FIX: update github tests.yml to be more in line with fmriprep
mnoergaard Jun 6, 2025
5b68753
FIX: apply suggested changes from tox
mnoergaard Jun 6, 2025
2386e08
FIX: bump niworkflows version to 1.13.4
mnoergaard Jun 6, 2025
8e81cf9
FIX: update fmriprep naming to petprep
mnoergaard Jun 6, 2025
5ff1c0a
FIX: add require_pet to BIDSDataGrabber
mnoergaard Jun 6, 2025
2017d45
FIX: add require_pet to test_base
mnoergaard Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2.1

orbs:
conda: circleci/[email protected]

jobs:
tests:
executor:
name: conda/default
steps:
- checkout
- conda/update-env:
environment-file: env.yml
environment-name: petprep
- conda/run:
environment-name: petprep
command: |
pip install -e .[tests]
pytest -n auto --junitxml=test-results/junit.xml --cov=petprep --cov-report=xml
- store_test_results:
path: test-results
- store_artifacts:
path: coverage.xml
destination: coverage.xml

workflows:
version: 2
test:
jobs:
- tests
55 changes: 0 additions & 55 deletions .github/workflows/coverage.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Stable tests

on:
push:
branches:
- main
pull_request:
branches:
- main

defaults:
run:
shell: bash

env:
FORCE_COLOR: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: ['3.10', '3.11', '3.12', '3.13']
dependencies: ['latest', 'pre']
include:
- os: ubuntu-latest
python-version: '3.10'
dependencies: 'min'
env:
DEPENDS: ${{ matrix.dependencies }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v4
with:
path: ~/.cache/templateflow
key: templateflow-v1
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends graphviz
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install tox
run: |
uv tool install --with=tox-uv --with=tox-gh-actions tox
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1200
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ always() }}

checks:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
check: ['style', 'spellcheck']
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Install tox
run: uv tool install tox --with=tox-uv
- name: Show tox config
run: tox c -e ${{ matrix.check }}
- name: Run check
run: tox -e ${{ matrix.check }}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Python cache and bytecode files
__pycache__/
*.py[cod]
*$py.class
*.pyo
*.pyd

# Coverage reports
.coverage
.coverage.*
htmlcov/
coverage.xml

# Build directories
build/
dist/
.eggs/
*.egg-info/
*.egg
# docs build
/docs/_build/

# Editor and OS artifacts
.DS_Store
*.swp
*~
.vscode/
.idea/
.env
.envrc

# Additional
.ipynb_checkpoints/
_version.py
Empty file added .tox/.pkg/file.lock
Empty file.
1 change: 0 additions & 1 deletion NOTICE

This file was deleted.

15 changes: 15 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PETPrep
Copyright The NiPreps Developers.

This product includes software developed by
the NiPreps Community (https://nipreps.org/).

Portions of this software were developed at the Department of
Psychology at Stanford University, Stanford, CA, US.

This software is also distributed as a Docker container image.
The bootstrapping file for the image ("Dockerfile") is licensed
under the MIT License.

This software may be distributed through an add-on package called
"Docker Wrapper" that is under the BSD 3-clause License.
24 changes: 1 addition & 23 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -321,26 +321,4 @@ finer control can be achieved of what files are visible to PETPrep.
Note that any discrepancies between the pre-indexed database and
the BIDS dataset complicate the provenance of PETPrep derivatives.
If ``--bids-database-dir`` is used, the referenced directory should be
preserved for the sake of reporting and reproducibility.

Error in slice timing correction: *insufficient length of BOLD data after discarding nonsteady-states*
------------------------------------------------------------------------------------------------------
Typically, the scanner will be in a *nonsteady state* during a few initial time points of the acquisition,
until it stabilizes.
These *nonsteady states* (also called *dummy* scans) typically show greater T1 contrast and higher average
intensity, and therefore potentially are detrimental if used in the interpolation of slice timing corrections.
Hence, *nonsteady states* are discarded by the slice timing correction tool (in this case, AFNI's ``3dTShift``).
However, ``3dTShift`` requires that at least five (5) time points are present in the target series, after
dismissing the initial *nonsteady states*.

*PETPrep* estimates the number of *nonsteady states* within the pipeline, unless the parameter is provided
by the user with the argument ``--dummy-scans <num>``.
Either way, if the number of *nonsteady states* is, say 4, then the length of the BOLD series must be greater
than 8.
If you encounter this error, first check that the number of *nonsteady states* is not suspiciously large
(it typically ranges from zero to five).
Next, if the number of *nonsteady states* is reasonable, consider why your BOLD time series are so short
and whether slice timing correction is appropriate under these conditions.
Finally, you can either skip the slice-timing correction with the argument ``--ignore slicetiming`` or
enforce a number of *nonsteady states* lower than the maximum for your data with ``--dummy-scans <num>``.
Please note that both strategies will apply to all tasks and runs that are to be processed.
preserved for the sake of reporting and reproducibility.
19 changes: 0 additions & 19 deletions docs/outputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,25 +363,6 @@ Then the output will include::
These may then be used independently with multi-echo tools, such as `tedana`_,
to perform more advanced denoising or alternative combination strategies.

.. danger::
Slice timing correction in *PETPrep* is referenced to the middle slice by default,
which leads to a time shift in the volume onsets by 0.5 TR (repetition time).
For example, assuming a TR of 2s, original onsets of 0, 2, and 4s would be shifted
to 1, 3, and 5s, respectively.
In case you did execute slice timing correction, you must check that subsequent
analyses (e.g., general linear modeling) consider the right onset shifts.
For example, when specifying a first-level model, you should set parameters in your
software package or first-level model function accordingly (e.g., select the middle
slice as reference).
Alternatively, you could manually adjust the volume onsets (e.g. as mentioned in
the example above from [0, 2, 4] to [1, 3, 5]) or the event onsets accordingly.
In contrast to volume onsets, event onsets need to be shifted *backward* by half a TR,
for example, from [5, 10, 15] to [4, 9, 14].

Further information on this issue is found at
`this blog post (with thanks to Russell Poldrack and Jeanette Mumford)
<https://reproducibility.stanford.edu/slice-timing-correction-in-petprep-and-linear-modeling/>`__.

Confounds
---------
The :abbr:`BOLD (blood-oxygen level dependent)` signal measured with fMRI is a mixture of fluctuations
Expand Down
6 changes: 2 additions & 4 deletions docs/workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ Processing pipeline details
===========================
*PETPrep* adapts its pipeline depending on what data and metadata are
available and are used as the input.
For example, slice timing correction will be
performed only if the ``SliceTiming`` metadata field is found for the input
dataset.
Certain processing steps will run only when the required metadata is
available in the input dataset.

A (very) high-level view of the simplest pipeline (for a single-band dataset with only
one task, single-run, with no slice-timing information nor fieldmap acquisitions)
Expand Down Expand Up @@ -571,7 +570,6 @@ Confounds estimation
metadata={
"FrameTimesStart": [0, 2, 4, 6],
"FrameDuration": [2, 2, 2, 2],
"SliceTiming": [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
},
regressors_all_comps=False,
regressors_dvars_th=1.5,
Expand Down
24 changes: 9 additions & 15 deletions env.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: fmriprep
name: petprep
channels:
- https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/
- conda-forge
Expand All @@ -13,35 +13,29 @@ dependencies:
# git-annex for templateflow users with DataLad superdatasets
- git-annex=*=alldep*
# Base scientific python stack; required by FSL, so pinned here
- numpy=1.26
- numpy=2.2
- scipy=1.15
- matplotlib=3.9
- matplotlib=3.10
- pandas=2.2
- h5py=3.13
# Dependencies compiled against numpy, best to stick with conda
- nitime=0.11
- scikit-image=0.25
- scikit-learn=1.6
# Utilities
- graphviz=11.0
- pandoc=3.6
- graphviz=12.2
- pandoc=3.7
# Workflow dependencies: ANTs
- ants=2.5
# 5.4.1 and 5.4.2 cause segfaults with ants
# Try to remove this ASAP
# https://github.com/conda-forge/ants-feedstock/issues/19
- libitk=5.4.0
# Workflow dependencies: Convert3d
- convert3d=1.4
- ants=2.6
# Workflow dependencies: Connectome Workbench
- connectome-workbench-cli=2.0
# Workflow dependencies: FSL (versions pinned in 6.0.7.13)
# Workflow dependencies: FSL (versions pinned in 6.0.7.17.20250415.fe1c582e)
- fsl-bet2=2111.8
- fsl-flirt=2111.2
- fsl-flirt=2111.4
- fsl-fast4=2111.3
- fsl-fugue=2201.5
- fsl-mcflirt=2111.0
- fsl-miscmaths=2203.2
- fsl-miscmaths=2412.4
- fsl-topup=2203.5
- pip
- pip:
Expand Down
Loading
Loading