### Install PETPrep with pip (bare-metal) Source: https://petprep.readthedocs.io/en/latest/installation.html Installs PETPrep in a manually prepared Python 3.10+ environment with pip. This method is not recommended; containers are preferred. External dependencies (FSL, ANTs, AFNI, C3D, FreeSurfer, PETPVC, bids-validator, connectome-workbench) must be installed separately and available in $PATH. ```bash $ python -m pip install petprep ``` -------------------------------- ### Install petprep-docker wrapper with pip Source: https://petprep.readthedocs.io/en/latest/_sources/installation.rst.txt Installs the petprep-docker wrapper using pip. This is the recommended way to run PETPrep with Docker. ```bash $ python -m pip install petprep-docker ``` -------------------------------- ### Check Docker installation with docker info Source: https://petprep.readthedocs.io/en/latest/usage.html Check that Docker is installed and running before using the PETPrep Docker wrapper. ```bash docker info ``` -------------------------------- ### Install petprep-docker wrapper with pip Source: https://petprep.readthedocs.io/en/latest/installation.html Installs the petprep-docker wrapper via pip. Requires about 30 GB free space because the image is 24 GB; Docker's default settings may not use the last 10% of disk. ```bash $ python -m pip install petprep-docker ``` -------------------------------- ### Install PETPrep with pip in bare-metal environment Source: https://petprep.readthedocs.io/en/latest/_sources/installation.rst.txt Installs PETPrep in a manually prepared Python 3.10+ environment using pip. This method is not recommended; containers are preferred. ```bash $ python -m pip install petprep ``` -------------------------------- ### Run petprep-docker command-line Source: https://petprep.readthedocs.io/en/latest/_sources/installation.rst.txt Runs the petprep-docker command-line as if running petprep on a bare-metal installation. The command-line options are the same as for bare-metal. ```bash $ petprep-docker ``` -------------------------------- ### PETPrep HMC command examples Source: https://petprep.readthedocs.io/en/latest/_sources/usage.rst.txt Example commands for configuring head motion correction in PETPrep. The first sets FWHM to 8 and start time to 60 seconds. The second fixes the initial frame to index 10. The third disables automatic memory safeguards. The fourth disables HMC entirely. ```bash $ petprep /data/bids_root /out participant --hmc-fwhm 8 --hmc-start-time 60 ``` ```bash $ petprep /data/bids_root /out participant --hmc-init-frame 10 --hmc-init-frame-fix ``` ```bash $ petprep /data/bids_root /out participant --hmc-memory-policy off ``` ```bash $ petprep /data/bids_root /out participant --hmc-off ``` -------------------------------- ### Run PETPrep with Apptainer Source: https://petprep.readthedocs.io/en/latest/installation.html Runs PETPrep via Apptainer, binding input data, output directory, and FreeSurfer license, then passing the BIDS-Apps arguments and options. The example uses participant or group analysis level, a participant label, the FreeSurfer license file, and a work directory. ```bash $ apptainer run \ --bind /path_to_data:/data:ro \ --bind /path_to_output:/out \ --bind /path_to_freesurfer/license.txt:/license \ /path_to_sif/petprep.sif /data /out participant or group \ --participant-label sub-ID \ --fs-license-file /license \ --work-dir /out/work ``` -------------------------------- ### Check PETPrep version Source: https://petprep.readthedocs.io/en/latest/installation.html Checks the installed PETPrep version. ```bash $ petprep --version ``` -------------------------------- ### Check PETPrep version Source: https://petprep.readthedocs.io/en/latest/_sources/installation.rst.txt Checks the PETPrep installation by displaying the version information. ```bash $ petprep --version ``` -------------------------------- ### Initialize PET reference workflow (init_raw_petref_wf) Source: https://petprep.readthedocs.io/en/latest/_sources/workflows.rst.txt Initializes the PET reference image workflow. The strategy is selected via the --petref option, with 'auto' as the default. The workflow estimates a reference image for a PET series according to the requested strategy. ```python from petprep.workflows.pet.reference import init_raw_petref_wf wf = init_raw_petref_wf() ``` -------------------------------- ### Confounds metadata JSON example Source: https://petprep.readthedocs.io/en/latest/outputs.html Example of the metadata JSON file (desc-confounds_timeseries.json) that accompanies each confounds TSV file. It shows entries for aCompCor components, including fields like CumulativeVarianceExplained, Mask, Method, Retained, SingularValue, and VarianceExplained. The 'dropped_0' entry has Retained false, indicating it is not saved in the data file for denoising. ```json { "a_comp_cor_00": { "CumulativeVarianceExplained": 0.1081970825, "Mask": "combined", "Method": "aCompCor", "Retained": true, "SingularValue": 25.8270209974, "VarianceExplained": 0.1081970825 }, "dropped_0": { "CumulativeVarianceExplained": 0.5965809597, "Mask": "combined", "Method": "aCompCor", "Retained": false, "SingularValue": 20.7955177198, "VarianceExplained": 0.0701465624 } } ``` -------------------------------- ### Pull or build pre-built PETPrep image (Docker/Apptainer) Source: https://petprep.readthedocs.io/en/latest/_sources/installation.rst.txt Shows alternative ways to obtain a pre-built PETPrep image: pulling the Docker image (with a platform-specific variant for linux/amd64) or building an Apptainer SIF from the Docker image. The latest image is available at https://github.com/nipreps/petprep/pkgs/container/petprep. ```bash $ docker pull ghcr.io/nipreps/petprep:main ``` ```bash $ docker pull --platform=linux/amd64 ghcr.io/nipreps/petprep:main ``` ```bash $ apptainer build petprep.sif docker://ghcr.io/nipreps/petprep:main ``` -------------------------------- ### Run PETPrep via Apptainer with bind mounts Source: https://petprep.readthedocs.io/en/latest/_sources/installation.rst.txt Runs PETPrep via Apptainer with bind mounts for input data, output directory, and FreeSurfer license. The command includes participant/group analysis level, participant label, FreeSurfer license file, and work directory options. ```bash $ apptainer run \ --bind /path_to_data:/data:ro \ --bind /path_to_output:/out \ --bind /path_to_freesurfer/license.txt:/license \ /path_to_sif/petprep.sif /data /out participant or group \ --participant-label sub-ID \ --fs-license-file /license \ --work-dir /out/work ``` -------------------------------- ### Example confounds TSV table Source: https://petprep.readthedocs.io/en/latest/outputs.html Example TSV table of extracted confounding time series. Each row corresponds to one time point in the PET time series. Columns include csf, white_matter, global_signal, std_dvars, dvars, framewise_displacement, t_comp_cor_*, a_comp_cor_*, non_steady_state_outlier, and motion parameters (trans_x, trans_y, trans_z, rot_x, rot_y, rot_z). ```text csf white_matter global_signal std_dvars dvars framewise_displacement t_comp_cor_00 t_comp_cor_01 t_comp_cor_02 t_comp_cor_03 t_comp_cor_04 t_comp_cor_05 a_comp_cor_00 a_comp_cor_01 a_comp_cor_02 a_comp_cor_03 a_comp_cor_04 a_comp_cor_05 non_steady_state_outlier00 trans_x trans_y trans_z rot_x rot_y rot_z 682.75275 0.0 491.64752000000004 n/a n/a n/a 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 -0.00017029 -0.0 0.0 669.14166 0.0 489.4421 1.168398 17.575331 0.07211929999999998 -0.4506846719 0.1191909139 -0.0945884724 0.1542023065 -0.2302324641 0.0838194238 -0.032426848599999995 0.4284323184 -0.5809158299 0.1382414008 -0.1203486637 0.3783661265 0.0 0.0 0.0207752 0.0463124 -0.000270924 -0.0 0.0 665.3969 0.0 488.03 1.085204 16.323903999999995 0.0348966 0.010819676200000001 0.0651895837 -0.09556632150000001 -0.033148835 -0.4768871111 0.20641088559999998 0.2818768463 0.4303863764 0.41323714850000004 -0.2115232212 -0.0037154909000000004 0.10636180070000001 0.0 0.0 0.0 0.0457372 0.0 -0.0 0.0 ``` -------------------------------- ### init_pet_fit_wf workflow initialization Source: https://petprep.readthedocs.io/en/latest/_sources/workflows.rst.txt Initializes the PET fit workflow (init_pet_fit_wf) with a mock configuration and a single PET file. This is used to generate the workflow graph for the PET fit sub-workflow. ```python from petprep.workflows.tests import mock_config from petprep import config from petprep.workflows.pet.fit import init_pet_fit_wf with mock_config(): pet_file = config.execution.bids_dir / 'sub-01' / 'pet' \ / 'sub-01_task-mixedgamblestask_pet.nii.gz' wf = init_pet_fit_wf(pet_series=[str(pet_file)]) ``` -------------------------------- ### petprep-docker command-line usage Source: https://petprep.readthedocs.io/en/latest/usage.html Command-line usage for the petprep-docker wrapper. Shows positional arguments (bids_dir, output_dir, analysis_level) and named options including wrapper and developer options. ```text usage: petprep-docker [-h] [--version] [-i IMG] [-w WORK_DIR] [--output-spaces [OUTPUT_SPACES ...]] [--fs-license-file PATH] [--fs-subjects-dir PATH] [--config-file PATH] [-d PATH [PATH ...]] [--use-plugin PATH] [--bids-database-dir PATH] [--bids-filter-file PATH] [--patch PACKAGE=PATH [PACKAGE=PATH ...]] [--shell] [--config PATH] [-e ENV_VAR value] [-u USER] [--network NETWORK] [--no-tty] [bids_dir] [output_dir] [{participant}] ``` -------------------------------- ### Extract thalamus mask as reference region Source: https://petprep.readthedocs.io/en/latest/_sources/usage.rst.txt Example command to extract a thalamus mask for use as a reference region, specifying the segmentation method and region indices. ```bash $ petprep /data/bids_root /out participant \ --seg gtm --ref-mask-name thalamus --ref-mask-index 10 49 ```