Skip to content

Commit 2f55f33

Browse files
authored
Merge branch 'main' into ref/clean-fmriprep-code-refs
2 parents 6782a65 + 1d36e32 commit 2f55f33

File tree

16 files changed

+283
-195
lines changed

16 files changed

+283
-195
lines changed

.coverage

-52 KB
Binary file not shown.

.mailmap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Alice Schiavone <[email protected]>
22
Alice Schiavone <[email protected]> alice
3+
Anthony Galassi <[email protected]>
4+
Anthony Galassi <[email protected]> bendhouseart
35
Christopher J. Markiewicz <[email protected]>
46
Christopher J. Markiewicz <[email protected]> <[email protected]>
57
Christopher J. Markiewicz <[email protected]> <[email protected]>
@@ -15,5 +17,7 @@ NiPreps Bot <[email protected]>
1517
NiPreps Bot <[email protected]> nipreps-bot
1618
Oscar Esteban <[email protected]>
1719
20+
Rami Hamati <[email protected]>
21+
Rami Hamati <[email protected]> ramroomh
1822
Ruben Dörfel <[email protected]>
1923
Ruben Dörfel <[email protected]> RDoerfel

.maint/CONTRIBUTORS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ Before every release, unlisted contributors will be invited again to add their n
88

99
| **Lastname** | **Name** | **Handle** | **ORCID** | **Affiliation** |
1010
| --- | --- | --- | --- | --- |
11+
| Bae | Jonghyun | @baej3 | 0000-0002-3987-6603 | National Institute on Aging |
12+
| Bilgel | Murat | @bilgelm | 0000-0001-5042-7422 | National Institute on Aging |
13+
| Ceballos | Eric | @eric2302 | 0000-0002-5643-1243 | Montreal Neurological Institute |
14+
| Dörfel | Ruben | @RDoerfel | 0000-0002-5920-5102 | Karolinska Institutet, and Neurobiology Research Unit |
1115
| Esteban | Oscar | @oesteban | 0000-0001-8435-6191 | School of Engineering, HES-SO University of Applied Sciences and Arts Western Switzerland, Sion, Switzerland |
16+
| Galassi | Anthony | @bendhouseart | 0000-0001-6550-4574 | Data Science and Sharing Team, National Institute of Mental Health, Bethesda, MD, USA |
1217
| Goncalves | Mathias | @mgxd | 0000-0002-7252-7771 | Department of Psychology, Stanford University, CA, USA |
18+
| Hamati | Rami | @ramroomh | 0000-0001-7213-9253 | Institute of Mental Health Research |
19+
| Jonghyun | Bae | | 0000-0002-3987-6603 | National Institute on Aging |
1320
| Legarreta Gorroño | Jon Haitz | @jhlegarreta | 0000-0002-9661-1396 | Brigham and Women's Hospital, Mass General Brigham, Harvard Medical School, MA, USA |
1421
| Markiewicz | Christopher J. | @effigies | 0000-0002-6533-164X | Department of Psychology, Stanford University, CA, USA |
1522
| Schiavone | Alice | @aliswh | 0009-0006-4844-2088 | Neurobiology Research Unit, Rigshospitalet, Copenhagen and Department of Computer Science, University of Copenhagen |

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ ENV PATH="/opt/afni-latest:$PATH" \
203203
RUN useradd -m -s /bin/bash -G users petprep
204204
WORKDIR /home/petprep
205205
ENV HOME="/home/petprep" \
206-
LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
206+
LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
207207

208208
COPY --from=micromamba /bin/micromamba /bin/micromamba
209209
COPY --from=micromamba /opt/conda/envs/petprep /opt/conda/envs/petprep
@@ -212,7 +212,7 @@ ENV MAMBA_ROOT_PREFIX="/opt/conda"
212212
RUN micromamba shell init -s bash && \
213213
echo "micromamba activate petprep" >> $HOME/.bashrc
214214
ENV PATH="/opt/conda/envs/petprep/bin:$PATH" \
215-
CPATH="/opt/conda/envs/petprep/include:$CPATH" \
215+
CPATH="/opt/conda/envs/petprep/include:${CPATH:-}" \
216216
LD_LIBRARY_PATH="/opt/conda/envs/petprep/lib:$LD_LIBRARY_PATH"
217217

218218
# Precaching atlases

README.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,13 @@ This was supported by the BRAIN Initiative
139139
grant (OpenNeuroPET, grant ID 1R24MH120004-01A1); the Novo Nordisk Foundation (OpenNeuroPET, grant ID NN20OC0063277); the Laura and John Arnold Foundation,
140140
the NIH (grant NBIB R01EB020740, PI: Ghosh);
141141
and NIMH (R24MH114705, R24MH117179, R01MH121867, PI: Poldrack)
142+
143+
.. _FSL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
144+
.. _ANTs: http://stnava.github.io/ANTs/
145+
.. _FreeSurfer: https://surfer.nmr.mgh.harvard.edu/
146+
.. _AFNI: https://afni.nimh.nih.gov/
147+
.. _PETSurfer: https://surfer.nmr.mgh.harvard.edu/fswiki/PetSurfer
148+
.. _PETPVC: https://github.com/UCL/PETPVC
149+
.. _kinfitr: https://github.com/mathesong/kinfitr
150+
.. _PMOD: https://www.pmod.com/
151+
.. _BIDS: https://bids.neuroimaging.io/

docs/installation.rst

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,46 @@ Therefore, once specified the container options and the image to be run
3232
the command line is the same as for the *bare-metal* installation but dropping
3333
the ``petprep`` executable name.
3434

35-
Containerized execution (Docker and Singularity)
35+
Containerized execution (Docker and Apptainer)
3636
================================================
3737
*PETPrep* is a *NiPreps* application, and therefore follows some overarching principles
3838
of containerized execution drawn from the BIDS-Apps protocols.
3939
For detailed information of containerized execution of *NiPreps*, please visit the corresponding
4040
`Docker <https://www.nipreps.org/apps/docker/>`__
41-
or `Singularity <https://www.nipreps.org/apps/singularity/>`__ subsections.
41+
or `Apptainer / Singularity <https://www.nipreps.org/apps/singularity/>`__ subsections.
4242
The *NiPreps* portal also contains
4343
`extended details of execution with the Docker wrapper <https://www.nipreps.org/apps/docker/#running-a-niprep-with-a-lightweight-wrapper>`__.
4444

4545
In short, install the ``petprep-docker`` wrapper with pip::
4646

4747
$ python -m pip install petprep-docker
4848

49+
Warning - since petprep relies on many tools (see below Dependencies), you need about 30 Gb free space (the image is 24GB -- also beware of docker settings which by default will not use the last 10% of your disk space).
50+
4951
Then run the ``petprep-docker`` command-line as if you were running
5052
``petprep`` on a *bare-metal* installation::
5153

5254
$ petprep-docker <input_bids_path> <derivatives_path> <analysis_level> <named_options>
5355

56+
Alternatively, you can install using a pre-built image using::
57+
58+
$ docker pull ghcr.io/nipreps/petprep:main
59+
60+
or::
61+
62+
$ apptainer build petprep.sif docker ://ghcr.io/nipreps/petprep:main
63+
64+
Then run petprep via apptainer as follows::
65+
66+
$ apptainer run \
67+
--bind /path_to_data:/data:ro \
68+
--bind /path_to_output:/out \
69+
--bind /path_to_freesurfer/license.txt:/license \
70+
/path_to_sif/petprep.sif /data /out participant or group \
71+
--participant-label sub-ID \
72+
--fs-license-file /license \
73+
--work-dir /out/work
74+
5475

5576
Manually Prepared Environment (Python 3.10+)
5677
============================================

docs/license.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ projects of the framework.
66

77
License information
88
-------------------
9-
Copyright (c) 2023, the *NiPreps* Developers.
9+
Copyright (c) 2025, the *NiPreps* Developers.
1010

11-
As of the 21.0.x pre-release and release series, *PETPrep* is
11+
As of the 0.0.x pre-release and release series, *PETPrep* is
1212
licensed under the Apache License, Version 2.0 (the "License");
1313
you may not use this file except in compliance with the License.
1414
You may obtain a copy of the License at
@@ -20,20 +20,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2020
See the License for the specific language governing permissions and
2121
limitations under the License.
2222

23-
Copyright (c) 2015-2023, the *PETPrep* developers and the CRN.
23+
Copyright (c) 2025-, the *NiPreps* developers.
2424
All rights reserved.
2525

26-
*PETPrep* 20.2 series and earlier are
27-
licensed under the BSD 3-clause license.
28-
You may obtain a copy of the License at
29-
https://opensource.org/licenses/BSD-3-Clause
30-
3126
All trademarks referenced herein are property of their respective holders.
3227

3328
The ``petprep-wrapper`` for Docker
3429
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35-
Copyright (c) 2020-2023, the *NiPreps* Developers.
36-
Copyright (c) 2015-2020, the *PETPrep* developers and the CRN.
30+
Copyright (c) 2025-, the *NiPreps* Developers.
3731
All rights reserved.
3832

3933
*PETPrep-wrapper* is

docs/usage.rst

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,39 @@ This feature has several intended use-cases:
176176
See also the ``--level`` flag, which can be used to control which derivatives are
177177
generated.
178178

179+
Head motion correction
180+
----------------------
181+
*PETPrep* can correct for head motion in the PET data.
182+
The head motion is estimated using a frame-based robust registration approach to an unbiased mean
183+
volume implemented in FreeSurfer's mri_robust_register (Reuter et al., 2010), combined with
184+
preprocessing steps using tools from FSL (Jenkinson et al., 2012). Specifically, for the estimation
185+
of head motion, each frame is initially smoothed with a Gaussian filter (full-width half-maximum [FWHM] of 10 mm, --hmc-fwhm 10),
186+
followed by thresholding at 20% of the intensity range to reduce noise and improve registration
187+
accuracy (removing stripe artefacts from filtered back projection reconstructions).
188+
Per default, the motion is estimated selectively of frames acquired after 120 seconds post-injection of the tracer (--hmc-start-time 120),
189+
as frames before this often contain low count statistics. Frames preceding 120 seconds were corrected
190+
using identical transformations as derived for the first frame after 120 seconds. The robust
191+
registration (mri_robust_register) algorithm utilized settings optimized for PET data: intensity
192+
scaling was enabled, automated sensitivity detection was activated, and the Frobenius norm threshold
193+
for convergence was set at 0.0001, ensuring precise and consistent alignment across frames.
194+
195+
To edit the motion correction parameters and run the workflow, use: ::
196+
197+
$ petprep /data/bids_root /out participant --hmc-fwhm 8 --hmc-start-time 60
198+
199+
Segmentation
200+
----------------
201+
*PETPrep* can segment the brain into different brain regions and extract time activity curves from these regions.
202+
The ``--seg`` flag selects the segmentation method to use.
203+
Available options are ``gtm`` (default) whole-brain segmentation from freesurfer, ``brainstem``, ``wm`` (white matter), ``thalamicNuclei``, ``hippocampusAmygdala``, ``raphe``, and ``limbic``.
204+
205+
The ``gtm`` segmentation is a whole-brain segmentation that includes the
206+
cerebral cortex, subcortical structures, and cerebellum.
207+
208+
To run the segmentation with the default ``gtm`` method, use: ::
209+
210+
$ petprep /data/bids_root /out participant --seg gtm
211+
179212
Partial volume correction
180213
-------------------------
181214
*PETPrep* can optionally correct PET images for partial volume effects.
@@ -223,6 +256,8 @@ Use ``--ref-mask-name`` to select a predefined region and
223256
The available masks are and do not require ``--ref-mask-index`` to be specified:
224257
- ``cerebellum``: Cerebellar gray matter (requires the ``--seg gtm`` option).
225258
- ``semiovale``: White matter in the centrum semiovale (requires the ``--seg wm`` option).
259+
- ``neocortex``: Neocortical gray matter (requires the ``--seg gtm`` option).
260+
- ``thalamus``: Thalamic gray matter (requires the ``--seg gtm`` option).
226261

227262
The presets are defined in ``petprep/data/reference_mask/config.json``.
228263

@@ -251,7 +286,7 @@ All bugs, concerns and enhancement requests for this software can be submitted h
251286
https://github.com/nipreps/petprep/issues.
252287

253288
If you have a problem or would like to ask a question about how to use *PETPrep*,
254-
please submit a question to `NeuroStars.org <https://neurostars.org/tag/petprep>`_ with an ``petprep`` tag.
289+
please submit a question to `NeuroStars.org <https://neurostars.org/tag/petprep>`_ with a ``petprep`` tag.
255290
NeuroStars.org is a platform similar to StackOverflow but dedicated to neuroinformatics.
256291

257292
Previous questions about *PETPrep* are available here:

docs/workflows.rst

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ available and are used as the input.
88
Certain processing steps will run only when the required metadata is
99
available in the input dataset.
1010

11-
A (very) high-level view of the simplest pipeline (for a single-band dataset with only
12-
one task, single-run, with no slice-timing information nor fieldmap acquisitions)
11+
A (very) high-level view of the simplest pipeline (for a single dataset with only
12+
a single tracer and single baseline)
1313
is presented below:
1414

1515
.. workflow::
@@ -394,27 +394,6 @@ customized via the :option:`--hmc-fwhm` and :option:`--hmc-start-time`
394394
command line options. By default a 10 mm FWHM Gaussian is applied and
395395
estimation begins at 120 s.
396396

397-
Susceptibility Distortion Correction (SDC)
398-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
399-
One of the major problems that affects :abbr:`EPI (echo planar imaging)` data
400-
is the spatial distortion caused by the inhomogeneity of the field inside
401-
the scanner.
402-
403-
.. figure:: _static/unwarping.svg
404-
405-
Applying susceptibility-derived distortion correction, based on
406-
fieldmap estimation.
407-
408-
Please note that all routines for susceptibility-derived distortion correction
409-
have been excised off of *PETPrep* for utilization on other projects
410-
(e.g., `dMRIPrep <https://www.nipreps.org/dmriprep>`__).
411-
For more detailed documentation on
412-
:abbr:`SDC (susceptibility-derived distortion correction)`
413-
routines, check on the `SDCFlows component <https://www.nipreps.org/sdcflows>`__.
414-
415-
Theory, methods and references are found within the
416-
`SDCFlows documentation <https://www.nipreps.org/sdcflows/master/api/sdcflows.workflows.fit.fieldmap.html>`__.
417-
418397
Pre-processed PET in native space
419398
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
420399
:py:func:`~petprep.workflows.pet.fit.init_pet_native_wf`
@@ -435,14 +414,13 @@ A new *preproc* :abbr:`PET (positron emission tomography)` series is generated
435414
from the original data in the original space.
436415
All volumes in the :abbr:`PET (positron emission tomography)` series are
437416
resampled in their native space by concatenating the mappings found in previous
438-
correction workflows (:abbr:`HMC (head-motion correction)` and
439-
:abbr:`SDC (susceptibility-derived distortion correction)` if executed)
417+
correction workflows (:abbr:`HMC (head-motion correction)`)
440418
for a one-shot interpolation process.
441419
Interpolation uses a Lanczos kernel.
442420

443421
.. _pet_reg:
444422

445-
EPI to T1w registration
423+
PET to T1w registration
446424
~~~~~~~~~~~~~~~~~~~~~~~
447425
:py:func:`~petprep.workflows.pet.registration.init_bbreg_wf`
448426

petprep/cli/parser.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,6 @@ def _bids_filter(value, parser):
360360
action=DeprecatedAction,
361361
help='Deprecated - use `--force no-bbr` instead.',
362362
)
363-
g_conf.add_argument(
364-
'--hmc-fwhm',
365-
action='store',
366-
default=10,
367-
type=float,
368-
help='FWHM for Gaussian smoothing applied during head-motion estimation.',
369-
)
370-
g_conf.add_argument(
371-
'--hmc-start-time',
372-
action='store',
373-
default=120,
374-
type=float,
375-
help='Time (in seconds) after which head-motion estimation is performed.',
376-
)
377363
g_conf.add_argument(
378364
'--random-seed',
379365
dest='_random_seed',
@@ -536,6 +522,22 @@ def _bids_filter(value, parser):
536522
'The user is responsible for ensuring that all necessary files are present.',
537523
)
538524

525+
g_hmc = parser.add_argument_group('Options for head motion correction')
526+
g_hmc.add_argument(
527+
'--hmc-fwhm',
528+
action='store',
529+
default=10,
530+
type=float,
531+
help='FWHM for Gaussian smoothing applied during head-motion estimation.',
532+
)
533+
g_hmc.add_argument(
534+
'--hmc-start-time',
535+
action='store',
536+
default=120,
537+
type=float,
538+
help='Time (in seconds) after which head-motion estimation is performed.',
539+
)
540+
539541
g_seg = parser.add_argument_group('Segmentation options')
540542
g_seg.add_argument(
541543
'--seg',

0 commit comments

Comments
 (0)