Skip to content

Commit c16ea4d

Browse files
committed
Merge remote-tracking branch 'upstream/next' into enh/fs_long
2 parents 92735a2 + 6995f33 commit c16ea4d

29 files changed

+2936
-1537
lines changed

.circleci/config.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ _machine_defaults: &machine_defaults
1212
_python_defaults: &python_defaults
1313
docker:
1414
- image: cimg/python:3.10.9
15+
auth:
16+
username: $DOCKER_USER
17+
password: $DOCKER_PAT
1518
working_directory: /tmp/src/smriprep
1619

1720
_docker_auth: &docker_auth
@@ -43,6 +46,9 @@ _pull_from_registry: &pull_from_registry
4346
docs_deploy: &docs
4447
docker:
4548
- image: node:8.10.0
49+
auth:
50+
username: $DOCKER_USER
51+
password: $DOCKER_PAT
4652
working_directory: /tmp/gh-pages
4753
steps:
4854
- run:
@@ -282,8 +288,10 @@ jobs:
282288
paths:
283289
- /home/circleci/.local
284290

285-
test_wrapper:
291+
test:
286292
<<: *machine_defaults
293+
environment:
294+
- FS_LICENSE: /tmp/fslicense/license.txt
287295
steps:
288296
- attach_workspace:
289297
at: /tmp
@@ -323,6 +331,24 @@ jobs:
323331
which smriprep-docker
324332
smriprep-docker -i nipreps/smriprep:latest --help
325333
smriprep-docker -i nipreps/smriprep:latest --version
334+
- restore_cache:
335+
keys:
336+
- testdata-v2-{{ .Branch }}-{{ epoch }}
337+
- testdata-v2-{{ .Branch }}
338+
- testdata-v2-
339+
- restore_cache:
340+
keys:
341+
- templateflow-v1-{{ .Branch }}-{{ epoch }}
342+
- templateflow-v1-{{ .Branch }}
343+
- templateflow-v1-
344+
- run:
345+
name: Run Pytest
346+
no_output_timeout: 2h
347+
command: |
348+
bash /tmp/src/smriprep/.circleci/pytest.sh
349+
- codecov/upload:
350+
file: /tmp/data/pytest_cov.xml
351+
flags: pytest
326352

327353
test_deploy_pypi:
328354
<<: *python_defaults
@@ -414,9 +440,9 @@ jobs:
414440
- run: *pull_from_registry
415441
- restore_cache:
416442
keys:
417-
- ds005-anat-v9-{{ .Branch }}-{{ epoch }}
418-
- ds005-anat-v9-{{ .Branch }}
419-
- ds005-anat-v9-master
443+
- ds005-anat-v0-{{ .Branch }}-{{ epoch }}
444+
- ds005-anat-v0-{{ .Branch }}
445+
- ds005-anat-v0-next
420446
- restore_cache:
421447
keys:
422448
- testdata-v2-{{ .Branch }}-{{ epoch }}
@@ -470,7 +496,7 @@ jobs:
470496
rm -rf /tmp/ds005/work/reportlets
471497
rm -rf /tmp/ds005/work/smriprep_wf/fsdir_run_*/
472498
- save_cache:
473-
key: ds005-anat-v9-{{ .Branch }}-{{ epoch }}
499+
key: ds005-anat-v0-{{ .Branch }}-{{ epoch }}
474500
paths:
475501
- /tmp/ds005/work
476502

@@ -772,8 +798,6 @@ workflows:
772798
only: /.*/
773799

774800
- get_data:
775-
context:
776-
- fs-license
777801
filters:
778802
branches:
779803
ignore:
@@ -793,10 +817,11 @@ workflows:
793817
tags:
794818
only: /.*/
795819

796-
- test_wrapper:
820+
- test:
797821
context:
798822
- nipreps-common
799823
requires:
824+
- get_data
800825
- build
801826
filters:
802827
branches:
@@ -852,7 +877,7 @@ workflows:
852877
- build_docs
853878
- ds005
854879
- ds054
855-
- test_wrapper
880+
- test
856881
filters:
857882
branches:
858883
only: /master/
@@ -865,7 +890,7 @@ workflows:
865890
- ds005
866891
- ds054
867892
- test_deploy_pypi
868-
- test_wrapper
893+
- test
869894
filters:
870895
branches:
871896
ignore: /.*/

.circleci/ds005_outputs.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ smriprep/sub-01/anat/sub-01_desc-brain_mask.json
1616
smriprep/sub-01/anat/sub-01_desc-brain_mask.nii.gz
1717
smriprep/sub-01/anat/sub-01_desc-preproc_T1w.json
1818
smriprep/sub-01/anat/sub-01_desc-preproc_T1w.nii.gz
19+
smriprep/sub-01/anat/sub-01_desc-ribbon_mask.json
1920
smriprep/sub-01/anat/sub-01_desc-ribbon_mask.nii.gz
2021
smriprep/sub-01/anat/sub-01_dseg.nii.gz
2122
smriprep/sub-01/anat/sub-01_from-fsnative_to-T1w_mode-image_xfm.txt
@@ -25,7 +26,9 @@ smriprep/sub-01/anat/sub-01_hemi-L_desc-reg_sphere.surf.gii
2526
smriprep/sub-01/anat/sub-01_hemi-L_inflated.surf.gii
2627
smriprep/sub-01/anat/sub-01_hemi-L_midthickness.surf.gii
2728
smriprep/sub-01/anat/sub-01_hemi-L_pial.surf.gii
29+
smriprep/sub-01/anat/sub-01_hemi-L_space-fsLR_desc-msmsulc_sphere.surf.gii
2830
smriprep/sub-01/anat/sub-01_hemi-L_space-fsLR_desc-reg_sphere.surf.gii
31+
smriprep/sub-01/anat/sub-01_hemi-L_sphere.surf.gii
2932
smriprep/sub-01/anat/sub-01_hemi-L_sulc.shape.gii
3033
smriprep/sub-01/anat/sub-01_hemi-L_thickness.shape.gii
3134
smriprep/sub-01/anat/sub-01_hemi-L_white.surf.gii
@@ -34,12 +37,20 @@ smriprep/sub-01/anat/sub-01_hemi-R_desc-reg_sphere.surf.gii
3437
smriprep/sub-01/anat/sub-01_hemi-R_inflated.surf.gii
3538
smriprep/sub-01/anat/sub-01_hemi-R_midthickness.surf.gii
3639
smriprep/sub-01/anat/sub-01_hemi-R_pial.surf.gii
40+
smriprep/sub-01/anat/sub-01_hemi-R_space-fsLR_desc-msmsulc_sphere.surf.gii
3741
smriprep/sub-01/anat/sub-01_hemi-R_space-fsLR_desc-reg_sphere.surf.gii
42+
smriprep/sub-01/anat/sub-01_hemi-R_sphere.surf.gii
3843
smriprep/sub-01/anat/sub-01_hemi-R_sulc.shape.gii
3944
smriprep/sub-01/anat/sub-01_hemi-R_thickness.shape.gii
4045
smriprep/sub-01/anat/sub-01_hemi-R_white.surf.gii
4146
smriprep/sub-01/anat/sub-01_label-CSF_probseg.nii.gz
4247
smriprep/sub-01/anat/sub-01_label-GM_probseg.nii.gz
4348
smriprep/sub-01/anat/sub-01_label-WM_probseg.nii.gz
49+
smriprep/sub-01/anat/sub-01_space-fsLR_den-91k_curv.dscalar.nii
50+
smriprep/sub-01/anat/sub-01_space-fsLR_den-91k_curv.json
51+
smriprep/sub-01/anat/sub-01_space-fsLR_den-91k_sulc.dscalar.nii
52+
smriprep/sub-01/anat/sub-01_space-fsLR_den-91k_sulc.json
53+
smriprep/sub-01/anat/sub-01_space-fsLR_den-91k_thickness.dscalar.nii
54+
smriprep/sub-01/anat/sub-01_space-fsLR_den-91k_thickness.json
4455
smriprep/sub-01.html
4556
/tmp/ds005/derivatives

.circleci/ds005_run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ docker run -it -e FMRIPREP_DEV=1 -u $(id -u) \
1919
--ncpus 2 --omp-nthreads 2 -vv \
2020
--fs-license-file /tmp/fslicense/license.txt \
2121
--fs-subjects-dir /tmp/ds005/freesurfer \
22+
--cifti-output \
2223
${@:1}

.circleci/pytest.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
docker run --rm -it \
3+
-v /tmp/data:/tmp/data:rw \
4+
-v /tmp/fslicense:/tmp/fslicense:ro \
5+
-v /tmp/templateflow:/home/smriprep/.cache/templateflow \
6+
-v /tmp/src/smriprep/docker/multiproc.coveragerc:/tmp/multiproc.coveragerc:ro \
7+
-v /tmp/src/smriprep/.circleci/nipype.cfg:/home/smriprep/.nipype/nipype.cfg \
8+
-e FS_LICENSE=/tmp/fslicense/license.txt \
9+
--entrypoint=pytest \
10+
nipreps/smriprep:latest \
11+
-v --doctest-modules --pyargs smriprep \
12+
--cov smriprep --cov-report=xml:/tmp/data/pytest_cov.xml \
13+
${@:1}

.github/workflows/pythonpackage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [ '*' ]
66
tags: [ '*' ]
77
pull_request:
8-
branches: [ master, 'maint/*' ]
8+
branches: [ master, 'maint/*', 'next' ]
99
schedule:
1010
- cron: '0 0 * * *'
1111

@@ -65,7 +65,7 @@ jobs:
6565
runs-on: ubuntu-latest
6666
strategy:
6767
matrix:
68-
python-version: [3.8, 3.9, "3.10", "3.11"]
68+
python-version: ["3.10", "3.11"]
6969
install: [repo]
7070
include:
7171
- python-version: "3.11"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,4 @@ Icon
311311
Network Trash Folder
312312
Temporary Items
313313
.apdisk
314+
>>>>>>> upstream/master

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"seaborn",
6565
"skimage",
6666
"svgutils",
67-
"templateflow",
6867
"transforms3d",
6968
]
7069

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ classifiers = [
1717
"Programming Language :: Python :: 3.10",
1818
]
1919
license = {file = "LICENSE"}
20-
requires-python = ">=3.8"
20+
requires-python = ">=3.10"
2121
dependencies = [
2222
"importlib_resources >= 1.3; python_version < '3.9'",
2323
"indexed_gzip >= 0.8.8",

smriprep/cli/run.py

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def get_parser():
7272
"output_dir",
7373
action="store",
7474
type=Path,
75-
help="the output path for the outcomes of preprocessing and visual " "reports",
75+
help="the output path for the outcomes of preprocessing and visual reports",
7676
)
7777
parser.add_argument(
7878
"analysis_level",
@@ -93,6 +93,15 @@ def get_parser():
9393
help="a space delimited list of participant identifiers or a single "
9494
"identifier (the sub- prefix can be removed)",
9595
)
96+
g_bids.add_argument(
97+
"-d",
98+
"--derivatives",
99+
action="store",
100+
metavar="PATH",
101+
type=Path,
102+
nargs="*",
103+
help="Search PATH(s) for pre-computed derivatives.",
104+
)
96105
g_bids.add_argument(
97106
"--bids-filter-file",
98107
action="store",
@@ -132,7 +141,7 @@ def get_parser():
132141
g_perfm.add_argument(
133142
"--low-mem",
134143
action="store_true",
135-
help="attempt to reduce memory usage (will increase disk usage " "in working directory)",
144+
help="attempt to reduce memory usage (will increase disk usage in working directory)",
136145
)
137146
g_perfm.add_argument(
138147
"--use-plugin",
@@ -212,6 +221,18 @@ def get_parser():
212221
help="Reuse freesurfer base template"
213222
"(from longitudinal preprocessing)",
214223
)
224+
g_fs.add_argument(
225+
"--cifti-output",
226+
nargs="?",
227+
const="91k",
228+
default=False,
229+
choices=("91k", "170k"),
230+
type=str,
231+
help="Output morphometry as CIFTI dense scalars. "
232+
"Optionally, the number of grayordinate can be specified "
233+
"(default is 91k, which equates to 2mm resolution)",
234+
)
235+
215236
# Surface generation xor
216237
g_surfs = parser.add_argument_group("Surface preprocessing options")
217238
g_surfs.add_argument(
@@ -248,7 +269,8 @@ def get_parser():
248269
"--fast-track",
249270
action="store_true",
250271
default=False,
251-
help="fast-track the workflow by searching for existing derivatives.",
272+
help="fast-track the workflow by searching for existing derivatives. "
273+
"(DEPRECATED for --derivatives).",
252274
)
253275
g_other.add_argument(
254276
"--resource-monitor",
@@ -280,7 +302,7 @@ def get_parser():
280302
"--stop-on-first-crash",
281303
action="store_true",
282304
default=False,
283-
help="Force stopping on first crash, even if a work directory" " was specified.",
305+
help="Force stopping on first crash, even if a work directory was specified.",
284306
)
285307
g_other.add_argument(
286308
"--notrack",
@@ -427,6 +449,7 @@ def build_workflow(opts, retval):
427449
from shutil import copyfile
428450
from os import cpu_count
429451
import uuid
452+
import warnings
430453
from time import strftime
431454
from subprocess import check_call, CalledProcessError, TimeoutExpired
432455
from pkg_resources import resource_filename as pkgrf
@@ -517,9 +540,11 @@ def build_workflow(opts, retval):
517540
"logging": {"log_directory": str(log_dir), "log_to_file": True},
518541
"execution": {
519542
"crashdump_dir": str(log_dir),
520-
"crashfile_format": "txt",
543+
"crashfile_format": "pklz",
521544
"get_linked_libs": False,
522545
"stop_on_first_crash": opts.stop_on_first_crash,
546+
"poll_sleep_duration": 0.1,
547+
"keep_unnecessary_outputs": True,
523548
},
524549
"monitoring": {
525550
"enabled": opts.resource_monitor,
@@ -568,11 +593,20 @@ def build_workflow(opts, retval):
568593
),
569594
)
570595

596+
derivatives = opts.derivatives or []
597+
if opts.fast_track:
598+
# XXX Makes strong assumption of legacy layout
599+
smriprep_dir = str(output_dir / "smriprep")
600+
warnings.warn(
601+
f"Received DEPRECATED --fast-track flag. Adding {smriprep_dir} to --derivatives list."
602+
)
603+
derivatives.append(smriprep_dir)
604+
571605
# Build main workflow
572606
retval["workflow"] = init_smriprep_wf(
573607
sloppy=opts.sloppy,
574608
debug=False,
575-
fast_track=opts.fast_track,
609+
derivatives=derivatives,
576610
freesurfer=opts.run_reconall,
577611
fs_subjects_dir=opts.fs_subjects_dir,
578612
hires=opts.hires,
@@ -591,6 +625,7 @@ def build_workflow(opts, retval):
591625
subject_list=subject_list,
592626
work_dir=str(work_dir),
593627
bids_filters=bids_filters,
628+
cifti_output=opts.cifti_output,
594629
)
595630
retval["return_code"] = 0
596631

0 commit comments

Comments
 (0)