In short, add the contents of the matlab folder to your matlab path with addpath:

>> addpath("PET2BIDS/matlab/")


The python version of PET2BIDS (from herein referenced by it’s library name pypet2bids) can be installed via pip for Python versions >3.7.1,<3.10

pip install pypet2bids

Additional Install Notes



To convert DICOM files, dcm2niix (Chris Rorden) must be installed.

We recommend using dcm2niix version v1.0.20220720 or above as it has been updated to better tease out PET information from source dicoms. Using older dcm2niix versions (especially year 2020 or later) can cause issues with this software. The latest releases can always be found at dcm2niix/releases

Windows users must, in addition, indicate its full path in dcm2niix4pet.m.

Redistributed functions

To convert ECAT files, ecat2nii.m uses readECAT7 (Raymond Muzic, 2002) and nii_tool (Xiangrui Li, 2016), who are included and redistributed in the repository. To write the JSON sidecar files, one uses jsonwrite.m (Guillaume Flandin, 2020) taken from


The entire repository or only the matlab subfolder (your choice) should be in your matlab path.

Defaults parameters should be set in (scannername).txt files to generate metadata easily (i.e. avoiding to pass all arguments in although this is also possible). You can find templates of such parameter file under /template_txt (SiemensHRRTparameters.txt, SiemensBiographparameters.txt, GEAdvanceparameters.txt, PhilipsVereosparameters.txt).


pypet2bids can be run from source by cloning the source code at our Github.

git clone

and then installing it’s dependencies via pip:

cd PET2BIDS/pypet2bids
pip install .

Or with Poetry:

cd PET2BIDS/pypet2bids
poetry install

Windows Only

It’s important that python be on your windows path; when installing Python be sure to select Add Python 3.XXX to PATH:


Otherwise, if you’re a savvy user w/ admin you config your PATH variable/cmd however you see fit. The above is simply this easiest and most universal way of getting python onto windows path.

Windows requires the user to manually point to the installed path of dcm2niix. Pypet2bids checks for this path in the .petbidsconfig file located at the users home director. This file needs to exist and contain a valid path to dcm2niix.exe stored under the name DCM2NIIX_PATH. This can be set up by either manually creating the file:

# get the home directory
echo $Home


# then save a configuration file at the location $Home\.pet2bidsconfig containing the following line
DCM2NIIX_PATH="<path to dcm2niix exe>"

# e.g. when printing out the contents of the file at .pet2bidsconfig on should see something
# resembling the following
cat C:\Users\pet2bidsuser\.pet2bidsconfig

Or using the dcm2niix4pet tool itself to set up the configuration:

dcm2niix4pet --set-dcm2niix-path \path\to\dcm2niix.exe