Clone the repo at and 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.11

pip install pypet2bids

If you wish to contribute, are unable to install from PyPi, or simply wish to run pypet2bids from source, continue reading the Additional Install Notes section below.

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).


If you are unable to install this library from PyPi you can clone this repository to build and install the package as distributed on PyPi yourself with poetry.

We use poetry to build this package, no other build methods are supported, further we encourage the use of GNU make and a bash-like shell to simplify the build process.

After installing poetry, you can build and install this package to your local version of Python with the following commands (keep in mind the commands below are executed in a bash-like shell):

cp -R metadata/ pypet2bids/pypet2bids/metadata
cp pypet2bids/pyproject.toml pypet2bids/pypet2bids/pyproject.toml
cd pypet2bids && poetry lock && poetry build
pip install dist/pypet2bids-X.X.X-py3-none-any.whl


Make and the additional scripts contained in the scripts/ directory are for the convenience of non-windows users.

If you have GNU make installed and are using a bash or something bash-like in you your terminal of choice, run the following:

make installpoetry buildpackage installpackage

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 installing them with Poetry:

cd PET2BIDS/pypet2bids
poetry install

After either poetry or pip installation of dependencies modules can be executed as follows:

cd PET2BIDS/pypet2bids
python --help

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