Skip to content
Merged
Show file tree
Hide file tree
Changes from 68 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
8 changes: 4 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
runs-on: macos-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: petprep
environment-file: environment.yml
environment-file: env.yml
auto-activate-base: true

- name: Install dependencies
Expand All @@ -42,13 +42,13 @@ jobs:
shell: bash -l {0}

- name: Upload coverage report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
env:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests

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

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e .[tests]
- run: pytest -sv
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Python cache and bytecode files
__pycache__/
*.py[cod]
*$py.class

# 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/
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.
22 changes: 8 additions & 14 deletions env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions petprep/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '25.0.0.dev172+gf8fd378'
__version_tuple__ = version_tuple = (25, 0, 0, 'dev172', 'gf8fd378')
__version__ = version = '25.0.0.dev238+gac5d4f1.d20250605'
__version_tuple__ = version_tuple = (25, 0, 0, 'dev238', 'gac5d4f1.d20250605')
50 changes: 2 additions & 48 deletions petprep/cli/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def _mock_check_latest(*args, **kwargs):
captured = capsys.readouterr().err

msg = f"""\
You are using fMRIPrep-{current}, and a newer version of fMRIPrep is available: {latest}.
You are using PETPrep-{current}, and a newer version of PETPrep is available: {latest}.
Please check out our documentation about how and when to upgrade:
https://fmriprep.readthedocs.io/en/latest/faq.html#upgrading"""
https://petprep.readthedocs.io/en/latest/faq.html#upgrading"""

assert (msg in captured) is expectation

Expand Down Expand Up @@ -184,52 +184,6 @@ def test_bids_filter_file(tmp_path, capsys):
_reset_config()


@pytest.mark.parametrize('st_ref', (None, '0', '1', '0.5', 'start', 'middle')) # noqa: PT007
def test_slice_time_ref(tmp_path, st_ref):
bids_path = tmp_path / 'data'
out_path = tmp_path / 'out'
args = [str(bids_path), str(out_path), 'participant']
if st_ref:
args.extend(['--slice-time-ref', st_ref])
bids_path.mkdir()

parser = _build_parser()

parser.parse_args(args)
_reset_config()


@pytest.mark.parametrize(
('args', 'expectation'),
[
([], False),
(['--use-syn-sdc'], 'error'),
(['--use-syn-sdc', 'error'], 'error'),
(['--use-syn-sdc', 'warn'], 'warn'),
(['--use-syn-sdc', 'other'], (SystemExit, ArgumentError)),
],
)
def test_use_syn_sdc(tmp_path, args, expectation):
bids_path = tmp_path / 'data'
out_path = tmp_path / 'out'
args = [str(bids_path), str(out_path), 'participant'] + args
bids_path.mkdir()

parser = _build_parser()

cm = nullcontext()
if isinstance(expectation, tuple):
cm = pytest.raises(expectation)

with cm:
opts = parser.parse_args(args)

if not isinstance(expectation, tuple):
assert opts.use_syn_sdc == expectation

_reset_config()


def test_derivatives(tmp_path):
"""Check the correct parsing of the derivatives argument."""
bids_path = tmp_path / 'data'
Expand Down
26 changes: 13 additions & 13 deletions petprep/data/io_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"queries": {
"baseline": {
"hmc": {
"datatype": "func",
"datatype": "pet",
"space": null,
"desc": "hmc",
"suffix": "boldref",
"suffix": "petref",
"extension": [
".nii.gz",
".nii"
]
},
"coreg": {
"datatype": "func",
"datatype": "pet",
"space": null,
"desc": "coreg",
"suffix": "boldref",
"suffix": "petref",
"extension": [
".nii.gz",
".nii"
Expand All @@ -24,16 +24,16 @@
},
"transforms": {
"hmc": {
"datatype": "func",
"datatype": "pet",
"from": "orig",
"to": "boldref",
"to": "petref",
"mode": "image",
"suffix": "xfm",
"extension": ".txt"
},
"boldref2anat": {
"datatype": "func",
"from": "boldref",
"petref2anat": {
"datatype": "pet",
"from": "petref",
"to": ["anat", "T1w", "T2w"],
"mode": "image",
"suffix": "xfm",
Expand All @@ -42,9 +42,9 @@
}
},
"patterns": [
"sub-{subject}[/ses-{session}]/{datatype<func>|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_res-{res}][_label-{label}][_echo-{echo}][_space-{space}][_desc-{desc}]_{suffix<bold|boldref|dseg|mask>}.{extension<nii|nii.gz|json>|nii.gz}",
"sub-{subject}[/ses-{session}]/{datatype<func>|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_from-{from}_to-{to}_mode-{mode<image|points>|image}_{suffix<xfm>|xfm}.{extension<txt|h5>}",
"sub-{subject}[/ses-{session}]/{datatype<func>|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_part-{part}][_desc-{desc}]_{suffix<timeseries>}.{extension<tsv|json>}",
"sub-{subject}[/ses-{session}]/{datatype<func>|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_space-{space}][_res-{res}][_den-{den}][_hemi-{hemi}[_label-{label}][_desc-{desc}]_{suffix<|boldref|dseg|mask>}.{extension<dtseries.nii|dtseries.json>}"
"sub-{subject}[/ses-{session}]/{datatype<func|pet>|pet}/sub-{subject}[_ses-{session}][_task-{task}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_res-{res}][_label-{label}][_echo-{echo}][_space-{space}][_desc-{desc}]_{suffix<bold|boldref|pet|petref|dseg|mask>}.{extension<nii|nii.gz|json>|nii.gz}",
"sub-{subject}[/ses-{session}]/{datatype<func|pet>|pet}/sub-{subject}[_ses-{session}][_task-{task}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_from-{from}_to-{to}_mode-{mode<image|points>|image}_{suffix<xfm>|xfm}.{extension<txt|h5>}",
"sub-{subject}[/ses-{session}]/{datatype<func|pet>|pet}/sub-{subject}[_ses-{session}][_task-{task}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_part-{part}][_desc-{desc}]_{suffix<timeseries>}.{extension<tsv|json>}",
"sub-{subject}[/ses-{session}]/{datatype<func|pet>|pet}/sub-{subject}[_ses-{session}][_task-{task}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_space-{space}][_res-{res}][_den-{den}][_hemi-{hemi}[_label-{label}][_desc-{desc}]_{suffix<|boldref|petref|dseg|mask>}.{extension<dtseries.nii|dtseries.json>}"
]
}
Loading
Loading